Scanner & Parser Changes (#735)

* Fixed a bug where partial volume support got missed on the epub parser.

* When a drive is unavailable during when a scan starts, abort so user doesn't loose half library if their networked drive goes down.

* Moved format for card details to highest level (since all chapters/files have same format) and added date added to each file to help when new chapters/files are added and grouped into a volume.

* Implemented handling on the UI when a series is deleted

* Added case for series removal for series detail

* Only redirect for this series
This commit is contained in:
Joseph Milazzo 2021-11-09 06:51:45 -06:00 committed by GitHub
parent 0bc63dda32
commit 78f3ccf889
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 85 additions and 17 deletions

View file

@ -371,7 +371,7 @@ namespace API.Services
FullFilePath = filePath,
IsSpecial = false,
Series = series.Trim(),
Volumes = seriesIndex.Split(".")[0]
Volumes = seriesIndex
};
}
}

View file

@ -173,7 +173,15 @@ namespace API.Services
return true;
}
/// <summary>
/// Checks if the root path of a path exists or not.
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public static bool IsDriveMounted(string path)
{
return new DirectoryInfo(Path.GetPathRoot(path) ?? string.Empty).Exists;
}
public static string[] GetFilesWithExtension(string path, string searchPatternExpression = "")
{

View file

@ -56,6 +56,14 @@ namespace API.Services.Tasks
var chapterIds = await _unitOfWork.SeriesRepository.GetChapterIdsForSeriesAsync(new[] {seriesId});
var library = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(libraryId, LibraryIncludes.Folders);
var folderPaths = library.Folders.Select(f => f.Path).ToList();
// Check if any of the folder roots are not available (ie disconnected from network, etc) and fail if any of them are
if (folderPaths.Any(f => !DirectoryService.IsDriveMounted(f)))
{
_logger.LogError("Some of the root folders for library are not accessible. Please check that drives are connected and rescan. Scan will be aborted");
return;
}
var dirs = DirectoryService.FindHighestDirectoriesFromFiles(folderPaths, files.Select(f => f.FilePath).ToList());
_logger.LogInformation("Beginning file scan on {SeriesName}", series.Name);
@ -195,6 +203,14 @@ namespace API.Services.Tasks
return;
}
// Check if any of the folder roots are not available (ie disconnected from network, etc) and fail if any of them are
if (library.Folders.Any(f => !DirectoryService.IsDriveMounted(f.Path)))
{
_logger.LogError("Some of the root folders for library are not accessible. Please check that drives are connected and rescan. Scan will be aborted");
return;
}
_logger.LogInformation("[ScannerService] Beginning file scan on {LibraryName}", library.Name);
await _messageHub.Clients.All.SendAsync(SignalREvents.ScanLibraryProgress,
MessageFactory.ScanLibraryProgressEvent(libraryId, 0));