Remove extraneous covers from imageCache.
This commit is contained in:
parent
238a2775f4
commit
51a6f216af
@ -162,14 +162,21 @@ public class JobBoss : GlobalBase
|
|||||||
new JobJsonConverter(this, new MangaConnectorJsonConverter(this, connectors)))!;
|
new JobJsonConverter(this, new MangaConnectorJsonConverter(this, connectors)))!;
|
||||||
this.jobs.Add(job);
|
this.jobs.Add(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Connect jobs to parent-jobs and add Publications to cache
|
//Connect jobs to parent-jobs and add Publications to cache
|
||||||
foreach (Job job in this.jobs)
|
foreach (Job job in this.jobs)
|
||||||
{
|
{
|
||||||
this.jobs.FirstOrDefault(jjob => jjob.id == job.parentJobId)?.AddSubJob(job);
|
this.jobs.FirstOrDefault(jjob => jjob.id == job.parentJobId)?.AddSubJob(job);
|
||||||
if(job is DownloadNewChapters dncJob)
|
if (job is DownloadNewChapters dncJob)
|
||||||
cachedPublications.Add(dncJob.manga);
|
cachedPublications.Add(dncJob.manga);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HashSet<string> coverFileNames = cachedPublications.Select(manga => manga.coverFileNameInCache!).ToHashSet();
|
||||||
|
foreach (string fileName in Directory.GetFiles(settings.coverImageCache))
|
||||||
|
{
|
||||||
|
if(!coverFileNames.Any(existingManga => fileName.Contains(existingManga)))
|
||||||
|
File.Delete(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateJobFile(Job job)
|
private void UpdateJobFile(Job job)
|
||||||
|
Loading…
Reference in New Issue
Block a user