Misc Bugfixes (#1582)
* 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
This commit is contained in:
parent
b6f6b0ed99
commit
c652c36081
28 changed files with 227 additions and 82 deletions
|
|
@ -51,7 +51,6 @@ public class MetadataService : IMetadataService
|
|||
private readonly ICacheHelper _cacheHelper;
|
||||
private readonly IReadingItemService _readingItemService;
|
||||
private readonly IDirectoryService _directoryService;
|
||||
private readonly ChapterSortComparerZeroFirst _chapterSortComparerForInChapterSorting = new ChapterSortComparerZeroFirst();
|
||||
private readonly IList<SignalRMessage> _updateEvents = new List<SignalRMessage>();
|
||||
public MetadataService(IUnitOfWork unitOfWork, ILogger<MetadataService> logger,
|
||||
IEventHub eventHub, ICacheHelper cacheHelper,
|
||||
|
|
@ -108,7 +107,7 @@ public class MetadataService : IMetadataService
|
|||
|
||||
|
||||
volume.Chapters ??= new List<Chapter>();
|
||||
var firstChapter = volume.Chapters.MinBy(x => double.Parse(x.Number), _chapterSortComparerForInChapterSorting);
|
||||
var firstChapter = volume.Chapters.MinBy(x => double.Parse(x.Number), ChapterSortComparerZeroFirst.Default);
|
||||
if (firstChapter == null) return Task.FromResult(false);
|
||||
|
||||
volume.CoverImage = firstChapter.CoverImage;
|
||||
|
|
@ -133,20 +132,14 @@ public class MetadataService : IMetadataService
|
|||
series.Volumes ??= new List<Volume>();
|
||||
var firstCover = series.Volumes.GetCoverImage(series.Format);
|
||||
string coverImage = null;
|
||||
if (firstCover == null && series.Volumes.Any())
|
||||
{
|
||||
// If firstCover is null and one volume, the whole series is Chapters under Vol 0.
|
||||
if (series.Volumes.Count == 1)
|
||||
{
|
||||
coverImage = series.Volumes[0].Chapters.OrderBy(c => double.Parse(c.Number), _chapterSortComparerForInChapterSorting)
|
||||
.FirstOrDefault(c => !c.IsSpecial)?.CoverImage;
|
||||
}
|
||||
|
||||
if (!_cacheHelper.CoverImageExists(coverImage))
|
||||
{
|
||||
coverImage = series.Volumes[0].Chapters.MinBy(c => double.Parse(c.Number), _chapterSortComparerForInChapterSorting)?.CoverImage;
|
||||
}
|
||||
var chapters = firstCover.Chapters.OrderBy(c => double.Parse(c.Number), ChapterSortComparerZeroFirst.Default).ToList();
|
||||
if (chapters.Count > 1 && chapters.Any(c => c.IsSpecial))
|
||||
{
|
||||
coverImage = chapters.First(c => !c.IsSpecial).CoverImage ?? chapters.First().CoverImage;
|
||||
firstCover = null;
|
||||
}
|
||||
|
||||
series.CoverImage = firstCover?.CoverImage ?? coverImage;
|
||||
_updateEvents.Add(MessageFactory.CoverUpdateEvent(series.Id, MessageFactoryEntityTypes.Series));
|
||||
return Task.CompletedTask;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue