Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.
C# annotationscbzcomicinfocomicscomics-readercross-platformcsharpepubepub-readerfreelinuxmangamedia-servermetadataopdsopds-feedpdfself-hostedubooquitywindows
Implemented the LastWrite check for Summaries and Series Cover Images. Removed a TODO after validation.
Joseph Milazzoc639b8ca042f
diff --git a/API/Services/ArchiveService.cs b/API/Services/ArchiveService.csindex 3cda2b4a1..03635188a 100644--- a/API/Services/ArchiveService.cs+++ b/API/Services/ArchiveService.cs@@ -203,7 +203,7 @@ namespace API.Services{formatExtension = "." + formatExtension;}- // TODO: Validate if jpeg is same as jpg+try{using var thumbnail = Image.ThumbnailBuffer(entry, ThumbnailWidth);@@ -227,7 +227,7 @@ namespace API.Services{using var stream = entry.Open();using var thumbnail = Image.ThumbnailStream(stream, ThumbnailWidth);- return thumbnail.WriteToBuffer(formatExtension); // TODO: Validate this code works with .png files+ return thumbnail.WriteToBuffer(formatExtension);}catch (Exception ex){diff --git a/API/Services/MetadataService.cs b/API/Services/MetadataService.csindex 4c1dbc118..9c8ee95bb 100644--- a/API/Services/MetadataService.cs+++ b/API/Services/MetadataService.cs@@ -1,9 +1,11 @@using System;using System.Collections.Generic;using System.Diagnostics;+using System.IO;using System.Linq;using System.Threading.Tasks;using API.Entities;+using API.Extensions;using API.Interfaces;using API.Interfaces.Services;using Microsoft.Extensions.Logging;@@ -51,7 +53,10 @@ namespace API.Services// Skip calculating Cover Image (I/O) if the chapter already has it setif (firstChapter == null || ShouldFindCoverImage(firstChapter.CoverImage)){- if (firstFile != null) volume.CoverImage = _archiveService.GetCoverImage(firstFile.FilePath, true);+ if (firstFile != null && !new FileInfo(firstFile.FilePath).DoesLastWriteMatch(firstFile.LastModified))+ {+ volume.CoverImage = _archiveService.GetCoverImage(firstFile.FilePath, true);+ }}else{@@ -80,9 +85,11 @@ namespace API.Servicesvar firstVolume = series.Volumes.FirstOrDefault(v => v.Chapters.Any() && v.Number == 1);var firstChapter = firstVolume?.Chapters.FirstOrDefault(c => c.Files.Any());- if (firstChapter != null)++ var firstFile = firstChapter?.Files.FirstOrDefault();+ if (firstFile != null && !new FileInfo(firstFile.FilePath).DoesLastWriteMatch(firstFile.LastModified)){- series.Summary = _archiveService.GetSummaryInfo(firstChapter.Files.FirstOrDefault()?.FilePath);+ series.Summary = _archiveService.GetSummaryInfo(firstFile.FilePath);}}