mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-31 14:33:50 -04:00
Fixed a bug where chapter cover images weren't being updated due to a missed not.
This commit is contained in:
parent
480c990c1b
commit
7d54923041
@ -10,9 +10,9 @@ namespace API.Extensions
|
|||||||
return comparison.Equals(fileInfo.LastWriteTime);
|
return comparison.Equals(fileInfo.LastWriteTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsLastWriteOlder(this FileInfo fileInfo, DateTime comparison)
|
public static bool IsLastWriteLessThan(this FileInfo fileInfo, DateTime comparison)
|
||||||
{
|
{
|
||||||
return comparison > fileInfo.LastWriteTime;
|
return fileInfo.LastWriteTime < comparison;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -33,7 +33,7 @@ namespace API.Services
|
|||||||
public void UpdateMetadata(Chapter chapter, bool forceUpdate)
|
public void UpdateMetadata(Chapter chapter, bool forceUpdate)
|
||||||
{
|
{
|
||||||
var firstFile = chapter.Files.OrderBy(x => x.Chapter).FirstOrDefault();
|
var firstFile = chapter.Files.OrderBy(x => x.Chapter).FirstOrDefault();
|
||||||
if (ShouldFindCoverImage(chapter.CoverImage, forceUpdate) && firstFile != null && new FileInfo(firstFile.FilePath).IsLastWriteOlder(firstFile.LastModified))
|
if (ShouldFindCoverImage(chapter.CoverImage, forceUpdate) && firstFile != null && !new FileInfo(firstFile.FilePath).IsLastWriteLessThan(firstFile.LastModified))
|
||||||
{
|
{
|
||||||
chapter.Files ??= new List<MangaFile>();
|
chapter.Files ??= new List<MangaFile>();
|
||||||
chapter.CoverImage = _archiveService.GetCoverImage(firstFile.FilePath, true);
|
chapter.CoverImage = _archiveService.GetCoverImage(firstFile.FilePath, true);
|
||||||
@ -53,7 +53,7 @@ namespace API.Services
|
|||||||
// Skip calculating Cover Image (I/O) if the chapter already has it set
|
// Skip calculating Cover Image (I/O) if the chapter already has it set
|
||||||
if (firstChapter == null || ShouldFindCoverImage(firstChapter.CoverImage))
|
if (firstChapter == null || ShouldFindCoverImage(firstChapter.CoverImage))
|
||||||
{
|
{
|
||||||
if (firstFile != null && !new FileInfo(firstFile.FilePath).IsLastWriteOlder(firstFile.LastModified))
|
if (firstFile != null && !new FileInfo(firstFile.FilePath).IsLastWriteLessThan(firstFile.LastModified))
|
||||||
{
|
{
|
||||||
volume.CoverImage = _archiveService.GetCoverImage(firstFile.FilePath, true);
|
volume.CoverImage = _archiveService.GetCoverImage(firstFile.FilePath, true);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user