mirror of
				https://github.com/Kareadita/Kavita.git
				synced 2025-11-04 03:27:05 -05:00 
			
		
		
		
	Merge branch 'develop' of https://github.com/Kareadita/Kavita into develop
This commit is contained in:
		
						commit
						a859e3e2bc
					
				@ -9,5 +9,10 @@ namespace API.Extensions
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            return comparison.Equals(fileInfo.LastWriteTime);
 | 
					            return comparison.Equals(fileInfo.LastWriteTime);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        public static bool IsLastWriteOlder(this FileInfo fileInfo, DateTime comparison)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return comparison > fileInfo.LastWriteTime;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -32,19 +32,17 @@ namespace API.Services
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
       public void UpdateMetadata(Chapter chapter, bool forceUpdate)
 | 
					       public void UpdateMetadata(Chapter chapter, bool forceUpdate)
 | 
				
			||||||
       {
 | 
					       {
 | 
				
			||||||
          // TODO: Figure a way to skip UpdateMetadata:  && new FileInfo(chapter.Files.FirstOrDefault()?.FilePath).LastWriteTime < 
 | 
					          var firstFile = chapter.Files.OrderBy(x => x.Chapter).FirstOrDefault();
 | 
				
			||||||
          if (chapter != null && ShouldFindCoverImage(chapter.CoverImage, forceUpdate))
 | 
					          if (ShouldFindCoverImage(chapter.CoverImage, forceUpdate) && firstFile != null && new FileInfo(firstFile.FilePath).IsLastWriteOlder(firstFile.LastModified))
 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
             chapter.Files ??= new List<MangaFile>();
 | 
					             chapter.Files ??= new List<MangaFile>();
 | 
				
			||||||
             var firstFile = chapter.Files.OrderBy(x => x.Chapter).FirstOrDefault();
 | 
					             chapter.CoverImage = _archiveService.GetCoverImage(firstFile.FilePath, true);
 | 
				
			||||||
             if (firstFile != null) chapter.CoverImage = _archiveService.GetCoverImage(firstFile.FilePath, true);
 | 
					 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
       }
 | 
					       }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       
 | 
					       
 | 
				
			||||||
       public void UpdateMetadata(Volume volume, bool forceUpdate)
 | 
					       public void UpdateMetadata(Volume volume, bool forceUpdate)
 | 
				
			||||||
       {
 | 
					       {
 | 
				
			||||||
          // TODO: Figure a way to skip UpdateMetadata:  
 | 
					 | 
				
			||||||
          if (volume != null && ShouldFindCoverImage(volume.CoverImage, forceUpdate))
 | 
					          if (volume != null && ShouldFindCoverImage(volume.CoverImage, forceUpdate))
 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
             // TODO: Create a custom sorter for Chapters so it's consistent across the application
 | 
					             // TODO: Create a custom sorter for Chapters so it's consistent across the application
 | 
				
			||||||
@ -55,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).DoesLastWriteMatch(firstFile.LastModified))
 | 
					                if (firstFile != null && !new FileInfo(firstFile.FilePath).IsLastWriteOlder(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