Lots of bug fixes around publishing and handling weird cases on a real manga library. Implemented ability to have Volumes number 0 aka just latest chapters. Refactored DirectoryService code for scanning into it's own service. Lots of debug code, will be cleaned up later.

This commit is contained in:
Joseph Milazzo 2021-01-23 17:44:48 -06:00
parent be6d4f2d09
commit a057e3ce1d
24 changed files with 589 additions and 472 deletions

View file

@ -13,35 +13,6 @@ namespace API.Interfaces
/// <returns>List of folder names</returns>
IEnumerable<string> ListDirectory(string rootPath);
/// <summary>
/// Given a library id, scans folders for said library. Parses files and generates DB updates. Will overwrite
/// cover images if forceUpdate is true.
/// </summary>
/// <param name="libraryId">Library to scan against</param>
/// <param name="forceUpdate">Force overwriting for cover images</param>
void ScanLibrary(int libraryId, bool forceUpdate);
void ScanLibraries();
/// <summary>
/// Returns the path a volume would be extracted to.
/// Deprecated.
/// </summary>
/// <param name="volumeId"></param>
/// <returns></returns>
string GetExtractPath(int volumeId);
Task<ImageDto> ReadImageAsync(string imagePath);
/// <summary>
/// Extracts an archive to a temp cache directory. Returns path to new directory. If temp cache directory already exists,
/// will return that without performing an extraction. Returns empty string if there are any invalidations which would
/// prevent operations to perform correctly (missing archivePath file, empty archive, etc).
/// </summary>
/// <param name="archivePath">A valid file to an archive file.</param>
/// <param name="extractPath">Path to extract to</param>
/// <returns></returns>
string ExtractArchive(string archivePath, string extractPath);
}
}

View file

@ -14,7 +14,6 @@ namespace API.Interfaces
Task<Library> GetLibraryForIdAsync(int libraryId);
Task<IEnumerable<LibraryDto>> GetLibraryDtosForUsernameAsync(string userName);
Task<IEnumerable<Library>> GetLibrariesAsync();
Task<Library> GetLibraryForNameAsync(string libraryName);
Task<bool> DeleteLibrary(int libraryId);
}
}

View file

@ -0,0 +1,25 @@
using System.Threading.Tasks;
using API.DTOs;
namespace API.Interfaces
{
public interface IScannerService
{
/// <summary>
/// Given a library id, scans folders for said library. Parses files and generates DB updates. Will overwrite
/// cover images if forceUpdate is true.
/// </summary>
/// <param name="libraryId">Library to scan against</param>
/// <param name="forceUpdate">Force overwriting for cover images</param>
void ScanLibrary(int libraryId, bool forceUpdate);
void ScanLibraries();
/// <summary>
/// Performs a forced scan of just a series folder.
/// </summary>
/// <param name="libraryId"></param>
/// <param name="seriesId"></param>
void ScanSeries(int libraryId, int seriesId);
}
}

View file

@ -23,6 +23,7 @@ namespace API.Interfaces
Task<IEnumerable<Volume>> GetVolumesForSeriesAsync(int[] seriesIds);
Task<bool> DeleteSeriesAsync(int seriesId);
Task<Volume> GetVolumeByIdAsync(int volumeId);
Task<Series> GetSeriesByIdAsync(int seriesId);
}
}

View file

@ -2,12 +2,8 @@
{
public interface ITaskScheduler
{
public void ScanLibrary(int libraryId, bool forceUpdate = false);
public void CleanupVolumes(int[] volumeIds);
/// <summary>
/// Clears the cache directory entirely.
/// </summary>
public void ClearCache();
void ScanLibrary(int libraryId, bool forceUpdate = false);
void CleanupVolumes(int[] volumeIds);
void ScanSeries(int libraryId, int seriesId);
}
}