Release Polish (#1586)

* Fixed a scaling issue in the epub reader, where images could scale when they shouldn't.

* Removed some caching on library/ api and added more output for a foreign key constraint

* Hooked in Restricted Profile stat collection

* Added a new boolean on age restrictions to explicitly allow unknowns or not. Since unknown is the default state of metadata, if users are allowed access to Unknown, age restricted content could leak.

* Fixed a bug where sometimes series cover generation could fail under conditions where only specials existed.

* Fixed foreign constraint issue when cleaning up series not seen at end of scan loop

* Removed an additional epub parse when scanning and handled merging differently

* Code smell
This commit is contained in:
Joe Milazzo 2022-10-17 15:33:18 -07:00 committed by GitHub
parent 78762a5626
commit 9149c4cbca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 2504 additions and 145 deletions

View file

@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using API.Comparators;
using API.Entities;
using API.Parser;
using API.Services.Tasks.Scanner;
@ -45,4 +46,26 @@ public static class SeriesExtensions
|| info.Series == series.Name || info.Series == series.LocalizedName || info.Series == series.OriginalName
|| Services.Tasks.Scanner.Parser.Parser.Normalize(info.Series) == Services.Tasks.Scanner.Parser.Parser.Normalize(series.OriginalName);
}
/// <summary>
/// Calculates the Cover Image for the Series
/// </summary>
/// <param name="series"></param>
/// <returns></returns>
/// <remarks>This is under the assumption that the Volume already has a Cover Image calculated and set</remarks>
public static string GetCoverImage(this Series series)
{
var volumes = series.Volumes ?? new List<Volume>();
var firstVolume = volumes.GetCoverImage(series.Format);
string coverImage = null;
var chapters = firstVolume.Chapters.OrderBy(c => double.Parse(c.Number), ChapterSortComparerZeroFirst.Default).ToList();
if (chapters.Count > 1 && chapters.Any(c => c.IsSpecial))
{
coverImage = chapters.FirstOrDefault(c => !c.IsSpecial)?.CoverImage ?? chapters.First().CoverImage;
firstVolume = null;
}
return firstVolume?.CoverImage ?? coverImage;
}
}