Added a sorting mechanism to emulate how windows sorts files. Refactored cache to support chapter folders as well.

This commit is contained in:
Joseph Milazzo 2021-01-10 12:47:34 -06:00
parent 6020697d7d
commit f737f662df
11 changed files with 237 additions and 32 deletions

View file

@ -1,21 +1,28 @@
using API.Entities;
using System.Threading.Tasks;
using API.Entities;
namespace API.Interfaces
{
public interface ICacheService
{
/// <summary>
/// Ensures the cache is created for the given volume and if not, will create it.
/// Ensures the cache is created for the given volume and if not, will create it. Should be called before any other
/// cache operations (except cleanup).
/// </summary>
/// <param name="volumeId"></param>
void Ensure(int volumeId);
/// <returns>Volume for the passed volumeId. Side-effect from ensuring cache.</returns>
Task<Volume> Ensure(int volumeId);
bool Cleanup(Volume volume);
//bool CleanupAll();
string GetCachePath(int volumeId);
/// <summary>
/// Returns the absolute path of a cached page.
/// </summary>
/// <param name="volume"></param>
/// <param name="page">Page number to look for</param>
/// <returns></returns>
string GetCachedPagePath(Volume volume, int page);
}
}

View file

@ -20,7 +20,7 @@ namespace API.Interfaces
/// </summary>
/// <param name="rootPath">Absolute path </param>
/// <returns>List of folder names</returns>
IEnumerable<string> ListFiles(string rootPath);
IList<string> ListFiles(string rootPath);
/// <summary>
/// Given a library id, scans folders for said library. Parses files and generates DB updates. Will overwrite