mirror of
				https://github.com/Kareadita/Kavita.git
				synced 2025-10-26 08:12:28 -04:00 
			
		
		
		
	* Fixed a bug with RBS on non-admin accounts * Fixed a bug where get next/prev chapter wouldn't respect floating point volume numbers * Fixed a bad migration version check * When building kavita ignore exclusions, ignore blank lines. * Hooked up the GetFullSeriesByAnyName to check against OriginalName exactly * Refactored some code for building ignore from library root, to keep the code cleaner * Tweaked some messaging * Fixed a bad directory join when a change event occurs in a nested series folder. * Fixed a bug where cover generation would prioritize a special if there were only chapters in the series. * Fixed a bug where you couldn't update a series modal if there wasn't a release year present * Fixed an issue where renaming the Series in Kavita wouldn't allow ScanSeries to see the files, and thus would delete the Series. * Added an additional check with Hangfire to make sure ScanFolder doesn't kick off a change when a bunch of changes come through for the same directory, but a job is already running. * Added more documentation * Migrated more response caching to profiles and merged 2 apis into one, since they do the same thing. * Fixed a bug where NotApplicable age ratings were breaking Recently Updated Series * Cleaned up some cache profiles * More caching * Provide response caching on Get Next/Prev Chapter * Code smells
		
			
				
	
	
		
			34 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using API.Comparators;
 | |
| using API.Entities;
 | |
| using API.Entities.Enums;
 | |
| 
 | |
| namespace API.Extensions;
 | |
| 
 | |
| public static class VolumeListExtensions
 | |
| {
 | |
|     /// <summary>
 | |
|     /// Selects the first Volume to get the cover image from. For a book with only a special, the special will be returned.
 | |
|     /// If there are both specials and non-specials, then the first non-special will be returned.
 | |
|     /// </summary>
 | |
|     /// <param name="volumes"></param>
 | |
|     /// <param name="seriesFormat"></param>
 | |
|     /// <returns></returns>
 | |
|     public static Volume GetCoverImage(this IList<Volume> volumes, MangaFormat seriesFormat)
 | |
|     {
 | |
|         if (seriesFormat == MangaFormat.Epub || seriesFormat == MangaFormat.Pdf)
 | |
|         {
 | |
|             return volumes.MinBy(x => x.Number);
 | |
|         }
 | |
| 
 | |
|         if (volumes.Any(x => x.Number != 0))
 | |
|         {
 | |
|             return volumes.OrderBy(x => x.Number).FirstOrDefault(x => x.Number != 0);
 | |
|         }
 | |
| 
 | |
|         // We only have 1 volume of chapters, we need to be cautious if there are specials, as we don't want to order them first
 | |
|         return volumes.MinBy(x => x.Number);
 | |
|     }
 | |
| }
 |