mirror of
https://github.com/C9Glax/tranga.git
synced 2025-06-23 11:34:16 +02:00
Add UpdateCoverJob.cs
Covers get updated on every pull If a Manga has no DownloadAvailableChaptersJob, Cover is removed Add endpoint POST Settings/CleanupCovers that removed covers not associated to any Manga
This commit is contained in:
@ -32,11 +32,9 @@ public static class Tranga
|
||||
Log.Info(TRANGA);
|
||||
}
|
||||
|
||||
internal static void RemoveStaleFiles(IServiceProvider serviceProvider)
|
||||
internal static void RemoveStaleFiles(PgsqlContext context)
|
||||
{
|
||||
Log.Info($"Removing stale files...");
|
||||
using IServiceScope scope = serviceProvider.CreateScope();
|
||||
PgsqlContext context = scope.ServiceProvider.GetRequiredService<PgsqlContext>();
|
||||
string[] usedFiles = context.Mangas.Select(m => m.CoverFileNameInCache).Where(s => s != null).ToArray()!;
|
||||
string[] extraneousFiles = new DirectoryInfo(TrangaSettings.coverImageCache).GetFiles()
|
||||
.Where(f => usedFiles.Contains(f.FullName) == false)
|
||||
|
Reference in New Issue
Block a user