Implemented the ability to extract an archive image to a cache directory.

This commit is contained in:
Joseph Milazzo 2021-01-08 13:28:59 -06:00
parent 14ad2a3dd5
commit 7ab7e8acc4
8 changed files with 127 additions and 8 deletions

View file

@ -4,8 +4,38 @@ namespace API.Interfaces
{
public interface IDirectoryService
{
/// <summary>
/// Lists out top-level folders for a given directory. Filters out System and Hidden folders.
/// </summary>
/// <param name="rootPath">Absolute path of directory to scan.</param>
/// <returns>List of folder names</returns>
IEnumerable<string> ListDirectory(string rootPath);
/// <summary>
/// Lists out top-level files for a given directory.
/// TODO: Implement ability to provide a filter for file types
/// </summary>
/// <param name="rootPath">Absolute path </param>
/// <returns>List of folder names</returns>
IEnumerable<string> ListFiles(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);
/// <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="volumeId">Id of volume being extracted.</param>
/// <returns></returns>
string ExtractArchive(string archivePath, int volumeId);
}
}