v0.7.8 - New Filtering System (#2260)
Co-authored-by: JeanPaulDOT <jp.houssier@gmail.com> Co-authored-by: Francois Wilhelmy <ice_mouton@hotmail.com> Co-authored-by: Gazy Mahomar <gmahomarf@gmail.com> Co-authored-by: Stijn <stijn.biemans@gmail.com> Co-authored-by: 無情天 <kofzhanganguo@126.com> Co-authored-by: Havokdan <havokdan@yahoo.com.br> Co-authored-by: Andre <andruecha32@gmail.com> Co-authored-by: Mateusz <mateuszvx8.96@gmail.com> Co-authored-by: Antonio Sanchez Castellón <angelfx19@gmail.com> Co-authored-by: Duarte Silva <smallflake@protonmail.com> Co-authored-by: LeeWan1210 <dldhks456@live.com> Co-authored-by: aleixcox <18121624@qq.com> Co-authored-by: Tomas Battistini <tomas.battistini@gmail.com> Co-authored-by: mareczek82 <marek.posiadala@gmail.com> Co-authored-by: Hans Kalisvaart <hans.kalisvaart@gmail.com> Co-authored-by: majora2007 <kavitareader@gmail.com> Co-authored-by: afermar <adrian.fm@protonmail.com> Co-authored-by: oxygen44k <iiccpp@outlook.com> Co-authored-by: Weblate (bot) <hosted@weblate.org> Co-authored-by: Hadrien b <hadrien.1997@gmail.com> Co-authored-by: Robbie Davis <robbie@therobbiedavis.com> Co-authored-by: Andre Smith <Hobogrammer@users.noreply.github.com> Co-authored-by: Safu Wan <safu@yahoo.com> Co-authored-by: sibeck <sibeck.clown@gmail.com> Co-authored-by: Florestano Pepe <florestano.pepe@gmail.com> Co-authored-by: 书签 <shuqian.emu@gmail.com> Co-authored-by: Stéphane Dupont <aleistor@gmail.com> Co-authored-by: gallegonovato <fran-carro@hotmail.es> Co-authored-by: AlienHack <the4got10@windowslive.com> Co-authored-by: 周書丞 <tmrsm_chan@hotmail.com> Co-authored-by: Andre Smith <andrepsmithjr@gmail.com> Co-authored-by: xe1st <dnzkckali@gmail.com> Co-authored-by: Jiří Heger <jiri.heger@gmail.com> Co-authored-by: DR <weblate-kavita.snowflake668@slmail.me> Co-authored-by: Mathieu Ares <matguitarist@gmail.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Gazy Mahomar <gmahomarf@users.noreply.github.com> Co-authored-by: Elias Jakob <elias.jakob100@gmail.com> Co-authored-by: Christian Zanon <chri8431@libero.it> Co-authored-by: Eryk Michalak <gnu.ewm@protonmail.com> Co-authored-by: Hoshino0881118 <hoshino0881118@gmail.com>
This commit is contained in:
parent
bdaadbecfc
commit
979508047c
221 changed files with 23403 additions and 6863 deletions
|
|
@ -33,7 +33,7 @@ public interface IMetadataService
|
|||
/// <param name="forceUpdate">Overrides any cache logic and forces execution</param>
|
||||
|
||||
Task GenerateCoversForSeries(int libraryId, int seriesId, bool forceUpdate = true);
|
||||
Task GenerateCoversForSeries(Series series, EncodeFormat encodeFormat, bool forceUpdate = false);
|
||||
Task GenerateCoversForSeries(Series series, EncodeFormat encodeFormat, CoverImageSize coverImageSize, bool forceUpdate = false);
|
||||
Task RemoveAbandonedMetadataKeys();
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ public class MetadataService : IMetadataService
|
|||
/// <param name="chapter"></param>
|
||||
/// <param name="forceUpdate">Force updating cover image even if underlying file has not been modified or chapter already has a cover image</param>
|
||||
/// <param name="encodeFormat">Convert image to Encoding Format when extracting the cover</param>
|
||||
private Task<bool> UpdateChapterCoverImage(Chapter chapter, bool forceUpdate, EncodeFormat encodeFormat)
|
||||
private Task<bool> UpdateChapterCoverImage(Chapter chapter, bool forceUpdate, EncodeFormat encodeFormat, CoverImageSize coverImageSize)
|
||||
{
|
||||
var firstFile = chapter.Files.MinBy(x => x.Chapter);
|
||||
if (firstFile == null) return Task.FromResult(false);
|
||||
|
|
@ -79,7 +79,7 @@ public class MetadataService : IMetadataService
|
|||
_logger.LogDebug("[MetadataService] Generating cover image for {File}", firstFile.FilePath);
|
||||
|
||||
chapter.CoverImage = _readingItemService.GetCoverImage(firstFile.FilePath,
|
||||
ImageService.GetChapterFormat(chapter.Id, chapter.VolumeId), firstFile.Format, encodeFormat);
|
||||
ImageService.GetChapterFormat(chapter.Id, chapter.VolumeId), firstFile.Format, encodeFormat, coverImageSize);
|
||||
_unitOfWork.ChapterRepository.Update(chapter);
|
||||
_updateEvents.Add(MessageFactory.CoverUpdateEvent(chapter.Id, MessageFactoryEntityTypes.Chapter));
|
||||
return Task.FromResult(true);
|
||||
|
|
@ -143,7 +143,7 @@ public class MetadataService : IMetadataService
|
|||
/// <param name="series"></param>
|
||||
/// <param name="forceUpdate"></param>
|
||||
/// <param name="encodeFormat"></param>
|
||||
private async Task ProcessSeriesCoverGen(Series series, bool forceUpdate, EncodeFormat encodeFormat)
|
||||
private async Task ProcessSeriesCoverGen(Series series, bool forceUpdate, EncodeFormat encodeFormat, CoverImageSize coverImageSize)
|
||||
{
|
||||
_logger.LogDebug("[MetadataService] Processing cover image generation for series: {SeriesName}", series.OriginalName);
|
||||
try
|
||||
|
|
@ -156,7 +156,7 @@ public class MetadataService : IMetadataService
|
|||
var index = 0;
|
||||
foreach (var chapter in volume.Chapters)
|
||||
{
|
||||
var chapterUpdated = await UpdateChapterCoverImage(chapter, forceUpdate, encodeFormat);
|
||||
var chapterUpdated = await UpdateChapterCoverImage(chapter, forceUpdate, encodeFormat, coverImageSize);
|
||||
// If cover was update, either the file has changed or first scan and we should force a metadata update
|
||||
UpdateChapterLastModified(chapter, forceUpdate || chapterUpdated);
|
||||
if (index == 0 && chapterUpdated)
|
||||
|
|
@ -208,7 +208,9 @@ public class MetadataService : IMetadataService
|
|||
await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
|
||||
MessageFactory.CoverUpdateProgressEvent(library.Id, 0F, ProgressEventType.Started, $"Starting {library.Name}"));
|
||||
|
||||
var encodeFormat = (await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EncodeMediaAs;
|
||||
var settings = await _unitOfWork.SettingsRepository.GetSettingsDtoAsync();
|
||||
var encodeFormat = settings.EncodeMediaAs;
|
||||
var coverImageSize = settings.CoverImageSize;
|
||||
|
||||
for (var chunk = 1; chunk <= chunkInfo.TotalChunks; chunk++)
|
||||
{
|
||||
|
|
@ -238,7 +240,7 @@ public class MetadataService : IMetadataService
|
|||
|
||||
try
|
||||
{
|
||||
await ProcessSeriesCoverGen(series, forceUpdate, encodeFormat);
|
||||
await ProcessSeriesCoverGen(series, forceUpdate, encodeFormat, coverImageSize);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -288,8 +290,10 @@ public class MetadataService : IMetadataService
|
|||
return;
|
||||
}
|
||||
|
||||
var encodeFormat = (await _unitOfWork.SettingsRepository.GetSettingsDtoAsync()).EncodeMediaAs;
|
||||
await GenerateCoversForSeries(series, encodeFormat, forceUpdate);
|
||||
var settings = await _unitOfWork.SettingsRepository.GetSettingsDtoAsync();
|
||||
var encodeFormat = settings.EncodeMediaAs;
|
||||
var coverImageSize = settings.CoverImageSize;
|
||||
await GenerateCoversForSeries(series, encodeFormat, coverImageSize, forceUpdate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -298,13 +302,13 @@ public class MetadataService : IMetadataService
|
|||
/// <param name="series">A full Series, with metadata, chapters, etc</param>
|
||||
/// <param name="encodeFormat">When saving the file, what encoding should be used</param>
|
||||
/// <param name="forceUpdate"></param>
|
||||
public async Task GenerateCoversForSeries(Series series, EncodeFormat encodeFormat, bool forceUpdate = false)
|
||||
public async Task GenerateCoversForSeries(Series series, EncodeFormat encodeFormat, CoverImageSize coverImageSize, bool forceUpdate = false)
|
||||
{
|
||||
var sw = Stopwatch.StartNew();
|
||||
await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
|
||||
MessageFactory.CoverUpdateProgressEvent(series.LibraryId, 0F, ProgressEventType.Started, series.Name));
|
||||
|
||||
await ProcessSeriesCoverGen(series, forceUpdate, encodeFormat);
|
||||
await ProcessSeriesCoverGen(series, forceUpdate, encodeFormat, coverImageSize);
|
||||
|
||||
|
||||
if (_unitOfWork.HasChanges())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue