UX Pass 5 (#3128)
Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
This commit is contained in:
parent
dbc4f35107
commit
c93af3e56f
126 changed files with 1989 additions and 2877 deletions
|
@ -12,10 +12,10 @@
|
|||
<LangVersion>latestmajor</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="Build" Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<Delete Files="../openapi.json" />
|
||||
<Exec Command="swagger tofile --output ../openapi.json bin/$(Configuration)/$(TargetFramework)/$(AssemblyName).dll v1" />
|
||||
</Target>
|
||||
<!-- <Target Name="PostBuild" AfterTargets="Build" Condition=" '$(Configuration)' == 'Debug' ">-->
|
||||
<!-- <Delete Files="../openapi.json" />-->
|
||||
<!-- <Exec Command="swagger tofile --output ../openapi.json bin/$(Configuration)/$(TargetFramework)/$(AssemblyName).dll v1" />-->
|
||||
<!-- </Target>-->
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
|
|
|
@ -88,6 +88,7 @@ public class ChapterController : BaseApiController
|
|||
chapter.AgeRating = dto.AgeRating;
|
||||
}
|
||||
|
||||
dto.Summary ??= string.Empty;
|
||||
|
||||
if (chapter.Summary != dto.Summary.Trim())
|
||||
{
|
||||
|
@ -260,6 +261,8 @@ public class ChapterController : BaseApiController
|
|||
#endregion
|
||||
|
||||
|
||||
_unitOfWork.ChapterRepository.Update(chapter);
|
||||
|
||||
if (!_unitOfWork.HasChanges())
|
||||
{
|
||||
return Ok();
|
||||
|
|
|
@ -310,9 +310,9 @@ public class LibraryController : BaseApiController
|
|||
|
||||
[Authorize(Policy = "RequireAdminRole")]
|
||||
[HttpPost("refresh-metadata")]
|
||||
public ActionResult RefreshMetadata(int libraryId, bool force = true)
|
||||
public ActionResult RefreshMetadata(int libraryId, bool force = true, bool forceColorscape = true)
|
||||
{
|
||||
_taskScheduler.RefreshMetadata(libraryId, force);
|
||||
_taskScheduler.RefreshMetadata(libraryId, force, forceColorscape);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -835,16 +835,26 @@ public class ReaderController : BaseApiController
|
|||
return Ok(_unitOfWork.UserTableOfContentRepository.GetPersonalToC(User.GetUserId(), chapterId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the user's personal table of content for the given chapter
|
||||
/// </summary>
|
||||
/// <param name="chapterId"></param>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="title"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("ptoc")]
|
||||
public async Task<ActionResult> DeletePersonalToc([FromQuery] int chapterId, [FromQuery] int pageNum, [FromQuery] string title)
|
||||
{
|
||||
var userId = User.GetUserId();
|
||||
if (string.IsNullOrWhiteSpace(title)) return BadRequest(await _localizationService.Translate(userId, "name-required"));
|
||||
if (pageNum < 0) return BadRequest(await _localizationService.Translate(userId, "valid-number"));
|
||||
|
||||
var toc = await _unitOfWork.UserTableOfContentRepository.Get(userId, chapterId, pageNum, title);
|
||||
if (toc == null) return Ok();
|
||||
|
||||
_unitOfWork.UserTableOfContentRepository.Remove(toc);
|
||||
await _unitOfWork.CommitAsync();
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -402,7 +402,7 @@ public class SeriesController : BaseApiController
|
|||
[HttpPost("refresh-metadata")]
|
||||
public ActionResult RefreshSeriesMetadata(RefreshSeriesDto refreshSeriesDto)
|
||||
{
|
||||
_taskScheduler.RefreshSeriesMetadata(refreshSeriesDto.LibraryId, refreshSeriesDto.SeriesId, refreshSeriesDto.ForceUpdate);
|
||||
_taskScheduler.RefreshSeriesMetadata(refreshSeriesDto.LibraryId, refreshSeriesDto.SeriesId, refreshSeriesDto.ForceUpdate, refreshSeriesDto.ForceColorscape);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,4 +18,9 @@ public class RefreshSeriesDto
|
|||
/// </summary>
|
||||
/// <remarks>This is expensive if true. Defaults to true.</remarks>
|
||||
public bool ForceUpdate { get; init; } = true;
|
||||
/// <summary>
|
||||
/// Should the task force re-calculation of colorscape.
|
||||
/// </summary>
|
||||
/// <remarks>This is expensive if true. Defaults to true.</remarks>
|
||||
public bool ForceColorscape { get; init; } = false;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public class ImageService : IImageService
|
|||
public const string CollectionTagCoverImageRegex = @"tag\d+";
|
||||
public const string ReadingListCoverImageRegex = @"readinglist\d+";
|
||||
|
||||
private const double WhiteThreshold = 0.90; // Colors with lightness above this are considered too close to white
|
||||
private const double WhiteThreshold = 0.95; // Colors with lightness above this are considered too close to white
|
||||
private const double BlackThreshold = 0.25; // Colors with lightness below this are considered too close to black
|
||||
|
||||
|
||||
|
@ -486,9 +486,11 @@ public class ImageService : IImageService
|
|||
// Resize the image to speed up processing
|
||||
var resizedImage = image.Resize(0.1);
|
||||
|
||||
var processedImage = PreProcessImage(resizedImage);
|
||||
|
||||
|
||||
// Convert image to RGB array
|
||||
var pixels = resizedImage.WriteToMemory().ToArray();
|
||||
var pixels = processedImage.WriteToMemory().ToArray();
|
||||
|
||||
// Convert to list of Vector3 (RGB)
|
||||
var rgbPixels = new List<Vector3>();
|
||||
|
@ -502,6 +504,9 @@ public class ImageService : IImageService
|
|||
|
||||
var sorted = SortByVibrancy(clusters);
|
||||
|
||||
// Ensure white and black are not selected as primary/secondary colors
|
||||
sorted = sorted.Where(c => !IsCloseToWhiteOrBlack(c)).ToList();
|
||||
|
||||
if (sorted.Count >= 2)
|
||||
{
|
||||
return (sorted[0], sorted[1]);
|
||||
|
@ -535,17 +540,18 @@ public class ImageService : IImageService
|
|||
|
||||
private static Image PreProcessImage(Image image)
|
||||
{
|
||||
return image;
|
||||
// Create a mask for white and black pixels
|
||||
var whiteMask = image.Colourspace(Enums.Interpretation.Lab)[0] > (WhiteThreshold * 100);
|
||||
var blackMask = image.Colourspace(Enums.Interpretation.Lab)[0] < (BlackThreshold * 100);
|
||||
|
||||
// Create a replacement color (e.g., medium gray)
|
||||
var replacementColor = new[] { 128.0, 128.0, 128.0 };
|
||||
var replacementColor = new[] { 240.0, 240.0, 240.0 };
|
||||
|
||||
// Apply the masks to replace white and black pixels
|
||||
var processedImage = image.Copy();
|
||||
processedImage = processedImage.Ifthenelse(whiteMask, replacementColor);
|
||||
processedImage = processedImage.Ifthenelse(blackMask, replacementColor);
|
||||
//processedImage = processedImage.Ifthenelse(blackMask, replacementColor);
|
||||
|
||||
return processedImage;
|
||||
}
|
||||
|
@ -627,6 +633,13 @@ public class ImageService : IImageService
|
|||
}).ToList();
|
||||
}
|
||||
|
||||
private static bool IsCloseToWhiteOrBlack(Vector3 color)
|
||||
{
|
||||
var threshold = 30;
|
||||
return (color.X > 255 - threshold && color.Y > 255 - threshold && color.Z > 255 - threshold) ||
|
||||
(color.X < threshold && color.Y < threshold && color.Z < threshold);
|
||||
}
|
||||
|
||||
private static string RgbToHex(Vector3 color)
|
||||
{
|
||||
return $"#{(int)color.X:X2}{(int)color.Y:X2}{(int)color.Z:X2}";
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using API.Comparators;
|
||||
|
@ -27,7 +26,7 @@ public interface IMetadataService
|
|||
/// <param name="forceUpdate"></param>
|
||||
[DisableConcurrentExecution(timeoutInSeconds: 60 * 60 * 60)]
|
||||
[AutomaticRetry(Attempts = 3, OnAttemptsExceeded = AttemptsExceededAction.Delete)]
|
||||
Task GenerateCoversForLibrary(int libraryId, bool forceUpdate = false);
|
||||
Task GenerateCoversForLibrary(int libraryId, bool forceUpdate = false, bool forceColorScape = false);
|
||||
/// <summary>
|
||||
/// Performs a forced refresh of cover images just for a series and it's nested entities
|
||||
/// </summary>
|
||||
|
@ -35,8 +34,8 @@ public interface IMetadataService
|
|||
/// <param name="seriesId"></param>
|
||||
/// <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, CoverImageSize coverImageSize, bool forceUpdate = false);
|
||||
Task GenerateCoversForSeries(int libraryId, int seriesId, bool forceUpdate = true, bool forceColorScape = true);
|
||||
Task GenerateCoversForSeries(Series series, EncodeFormat encodeFormat, CoverImageSize coverImageSize, bool forceUpdate = false, bool forceColorScape = true);
|
||||
Task RemoveAbandonedMetadataKeys();
|
||||
}
|
||||
|
||||
|
@ -75,7 +74,8 @@ 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, CoverImageSize coverImageSize)
|
||||
/// <param name="forceColorScape">Force colorscape gen</param>
|
||||
private Task<bool> UpdateChapterCoverImage(Chapter? chapter, bool forceUpdate, EncodeFormat encodeFormat, CoverImageSize coverImageSize, bool forceColorScape = false)
|
||||
{
|
||||
if (chapter == null) return Task.FromResult(false);
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class MetadataService : IMetadataService
|
|||
_directoryService.FileSystem.Path.Join(_directoryService.CoverImageDirectory, chapter.CoverImage),
|
||||
firstFile, chapter.Created, forceUpdate, chapter.CoverImageLocked))
|
||||
{
|
||||
if (NeedsColorSpace(chapter))
|
||||
if (NeedsColorSpace(chapter, forceColorScape))
|
||||
{
|
||||
_imageService.UpdateColorScape(chapter);
|
||||
_unitOfWork.ChapterRepository.Update(chapter);
|
||||
|
@ -118,9 +118,11 @@ public class MetadataService : IMetadataService
|
|||
firstFile.UpdateLastModified();
|
||||
}
|
||||
|
||||
private static bool NeedsColorSpace(IHasCoverImage? entity)
|
||||
private static bool NeedsColorSpace(IHasCoverImage? entity, bool force)
|
||||
{
|
||||
if (entity == null) return false;
|
||||
if (force) return true;
|
||||
|
||||
return !string.IsNullOrEmpty(entity.CoverImage) &&
|
||||
(string.IsNullOrEmpty(entity.PrimaryColor) || string.IsNullOrEmpty(entity.SecondaryColor));
|
||||
}
|
||||
|
@ -132,7 +134,8 @@ public class MetadataService : IMetadataService
|
|||
/// </summary>
|
||||
/// <param name="volume"></param>
|
||||
/// <param name="forceUpdate">Force updating cover image even if underlying file has not been modified or chapter already has a cover image</param>
|
||||
private Task<bool> UpdateVolumeCoverImage(Volume? volume, bool forceUpdate)
|
||||
/// <param name="forceColorScape">Force updating colorscape</param>
|
||||
private Task<bool> UpdateVolumeCoverImage(Volume? volume, bool forceUpdate, bool forceColorScape = false)
|
||||
{
|
||||
// We need to check if Volume coverImage matches first chapters if forceUpdate is false
|
||||
if (volume == null) return Task.FromResult(false);
|
||||
|
@ -141,7 +144,7 @@ public class MetadataService : IMetadataService
|
|||
_directoryService.FileSystem.Path.Join(_directoryService.CoverImageDirectory, volume.CoverImage),
|
||||
null, volume.Created, forceUpdate))
|
||||
{
|
||||
if (NeedsColorSpace(volume))
|
||||
if (NeedsColorSpace(volume, forceColorScape))
|
||||
{
|
||||
_imageService.UpdateColorScape(volume);
|
||||
_unitOfWork.VolumeRepository.Update(volume);
|
||||
|
@ -176,7 +179,7 @@ public class MetadataService : IMetadataService
|
|||
/// </summary>
|
||||
/// <param name="series"></param>
|
||||
/// <param name="forceUpdate">Force updating cover image even if underlying file has not been modified or chapter already has a cover image</param>
|
||||
private Task UpdateSeriesCoverImage(Series? series, bool forceUpdate)
|
||||
private Task UpdateSeriesCoverImage(Series? series, bool forceUpdate, bool forceColorScape = false)
|
||||
{
|
||||
if (series == null) return Task.CompletedTask;
|
||||
|
||||
|
@ -185,13 +188,12 @@ public class MetadataService : IMetadataService
|
|||
null, series.Created, forceUpdate, series.CoverImageLocked))
|
||||
{
|
||||
// Check if we don't have a primary/seconary color
|
||||
if (NeedsColorSpace(series))
|
||||
if (NeedsColorSpace(series, forceColorScape))
|
||||
{
|
||||
_imageService.UpdateColorScape(series);
|
||||
_updateEvents.Add(MessageFactory.CoverUpdateEvent(series.Id, MessageFactoryEntityTypes.Series));
|
||||
}
|
||||
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
@ -211,7 +213,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, CoverImageSize coverImageSize)
|
||||
private async Task ProcessSeriesCoverGen(Series series, bool forceUpdate, EncodeFormat encodeFormat, CoverImageSize coverImageSize, bool forceColorScape = false)
|
||||
{
|
||||
_logger.LogDebug("[MetadataService] Processing cover image generation for series: {SeriesName}", series.OriginalName);
|
||||
try
|
||||
|
@ -224,7 +226,7 @@ public class MetadataService : IMetadataService
|
|||
var index = 0;
|
||||
foreach (var chapter in volume.Chapters)
|
||||
{
|
||||
var chapterUpdated = await UpdateChapterCoverImage(chapter, forceUpdate, encodeFormat, coverImageSize);
|
||||
var chapterUpdated = await UpdateChapterCoverImage(chapter, forceUpdate, encodeFormat, coverImageSize, forceColorScape);
|
||||
// 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)
|
||||
|
@ -235,7 +237,7 @@ public class MetadataService : IMetadataService
|
|||
index++;
|
||||
}
|
||||
|
||||
var volumeUpdated = await UpdateVolumeCoverImage(volume, firstChapterUpdated || forceUpdate);
|
||||
var volumeUpdated = await UpdateVolumeCoverImage(volume, firstChapterUpdated || forceUpdate, forceColorScape);
|
||||
if (volumeIndex == 0 && volumeUpdated)
|
||||
{
|
||||
firstVolumeUpdated = true;
|
||||
|
@ -243,7 +245,7 @@ public class MetadataService : IMetadataService
|
|||
volumeIndex++;
|
||||
}
|
||||
|
||||
await UpdateSeriesCoverImage(series, firstVolumeUpdated || forceUpdate);
|
||||
await UpdateSeriesCoverImage(series, firstVolumeUpdated || forceUpdate, forceColorScape);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -258,9 +260,10 @@ public class MetadataService : IMetadataService
|
|||
/// <remarks>This can be heavy on memory first run</remarks>
|
||||
/// <param name="libraryId"></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="forceColorScape">Force updating colorscape</param>
|
||||
[DisableConcurrentExecution(timeoutInSeconds: 60 * 60 * 60)]
|
||||
[AutomaticRetry(Attempts = 3, OnAttemptsExceeded = AttemptsExceededAction.Delete)]
|
||||
public async Task GenerateCoversForLibrary(int libraryId, bool forceUpdate = false)
|
||||
public async Task GenerateCoversForLibrary(int libraryId, bool forceUpdate = false, bool forceColorScape = false)
|
||||
{
|
||||
var library = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(libraryId);
|
||||
if (library == null) return;
|
||||
|
@ -308,7 +311,7 @@ public class MetadataService : IMetadataService
|
|||
|
||||
try
|
||||
{
|
||||
await ProcessSeriesCoverGen(series, forceUpdate, encodeFormat, coverImageSize);
|
||||
await ProcessSeriesCoverGen(series, forceUpdate, encodeFormat, coverImageSize, forceColorScape);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -349,7 +352,8 @@ public class MetadataService : IMetadataService
|
|||
/// <param name="libraryId"></param>
|
||||
/// <param name="seriesId"></param>
|
||||
/// <param name="forceUpdate">Overrides any cache logic and forces execution</param>
|
||||
public async Task GenerateCoversForSeries(int libraryId, int seriesId, bool forceUpdate = true)
|
||||
/// <param name="forceColorscape">Will ensure that the colorscape is regenned</param>
|
||||
public async Task GenerateCoversForSeries(int libraryId, int seriesId, bool forceUpdate = true, bool forceColorScape = true)
|
||||
{
|
||||
var series = await _unitOfWork.SeriesRepository.GetFullSeriesForSeriesIdAsync(seriesId);
|
||||
if (series == null)
|
||||
|
@ -361,7 +365,8 @@ public class MetadataService : IMetadataService
|
|||
var settings = await _unitOfWork.SettingsRepository.GetSettingsDtoAsync();
|
||||
var encodeFormat = settings.EncodeMediaAs;
|
||||
var coverImageSize = settings.CoverImageSize;
|
||||
await GenerateCoversForSeries(series, encodeFormat, coverImageSize, forceUpdate);
|
||||
|
||||
await GenerateCoversForSeries(series, encodeFormat, coverImageSize, forceUpdate, forceColorScape);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -370,13 +375,14 @@ 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, CoverImageSize coverImageSize, bool forceUpdate = false)
|
||||
/// <param name="forceColorScape">Forces just colorscape generation</param>
|
||||
public async Task GenerateCoversForSeries(Series series, EncodeFormat encodeFormat, CoverImageSize coverImageSize, bool forceUpdate = false, bool forceColorScape = true)
|
||||
{
|
||||
var sw = Stopwatch.StartNew();
|
||||
await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
|
||||
MessageFactory.CoverUpdateProgressEvent(series.LibraryId, 0F, ProgressEventType.Started, series.Name));
|
||||
|
||||
await ProcessSeriesCoverGen(series, forceUpdate, encodeFormat, coverImageSize);
|
||||
await ProcessSeriesCoverGen(series, forceUpdate, encodeFormat, coverImageSize, forceColorScape);
|
||||
|
||||
|
||||
if (_unitOfWork.HasChanges())
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace API.Services;
|
|||
|
||||
public static class ReviewService
|
||||
{
|
||||
private const int BodyTextLimit = 175;
|
||||
public static IEnumerable<UserReviewDto> SelectSpectrumOfReviews(IList<UserReviewDto> reviews)
|
||||
{
|
||||
IList<UserReviewDto> externalReviews;
|
||||
|
@ -76,7 +77,7 @@ public static class ReviewService
|
|||
plainText = Regex.Replace(plainText, @"__", string.Empty);
|
||||
|
||||
// Take the first 100 characters
|
||||
plainText = plainText.Length > 100 ? plainText.Substring(0, 100) : plainText;
|
||||
plainText = plainText.Length > 100 ? plainText.Substring(0, BodyTextLimit) : plainText;
|
||||
|
||||
return plainText + "…";
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ public interface ITaskScheduler
|
|||
Task ScanLibrary(int libraryId, bool force = false);
|
||||
Task ScanLibraries(bool force = false);
|
||||
void CleanupChapters(int[] chapterIds);
|
||||
void RefreshMetadata(int libraryId, bool forceUpdate = true);
|
||||
void RefreshSeriesMetadata(int libraryId, int seriesId, bool forceUpdate = false);
|
||||
void RefreshMetadata(int libraryId, bool forceUpdate = true, bool forceColorscape = true);
|
||||
void RefreshSeriesMetadata(int libraryId, int seriesId, bool forceUpdate = false, bool forceColorscape = false);
|
||||
Task ScanSeries(int libraryId, int seriesId, bool forceUpdate = false);
|
||||
void AnalyzeFilesForSeries(int libraryId, int seriesId, bool forceUpdate = false);
|
||||
void AnalyzeFilesForLibrary(int libraryId, bool forceUpdate = false);
|
||||
|
@ -371,12 +371,12 @@ public class TaskScheduler : ITaskScheduler
|
|||
BackgroundJob.Enqueue(() => _cacheService.CleanupChapters(chapterIds));
|
||||
}
|
||||
|
||||
public void RefreshMetadata(int libraryId, bool forceUpdate = true)
|
||||
public void RefreshMetadata(int libraryId, bool forceUpdate = true, bool forceColorscape = true)
|
||||
{
|
||||
var alreadyEnqueued = HasAlreadyEnqueuedTask(MetadataService.Name, "GenerateCoversForLibrary",
|
||||
[libraryId, true]) ||
|
||||
[libraryId, true, true]) ||
|
||||
HasAlreadyEnqueuedTask("MetadataService", "GenerateCoversForLibrary",
|
||||
[libraryId, false]);
|
||||
[libraryId, false, false]);
|
||||
if (alreadyEnqueued)
|
||||
{
|
||||
_logger.LogInformation("A duplicate request to refresh metadata for library occured. Skipping");
|
||||
|
@ -384,19 +384,19 @@ public class TaskScheduler : ITaskScheduler
|
|||
}
|
||||
|
||||
_logger.LogInformation("Enqueuing library metadata refresh for: {LibraryId}", libraryId);
|
||||
BackgroundJob.Enqueue(() => _metadataService.GenerateCoversForLibrary(libraryId, forceUpdate));
|
||||
BackgroundJob.Enqueue(() => _metadataService.GenerateCoversForLibrary(libraryId, forceUpdate, forceColorscape));
|
||||
}
|
||||
|
||||
public void RefreshSeriesMetadata(int libraryId, int seriesId, bool forceUpdate = false)
|
||||
public void RefreshSeriesMetadata(int libraryId, int seriesId, bool forceUpdate = false, bool forceColorscape = false)
|
||||
{
|
||||
if (HasAlreadyEnqueuedTask(MetadataService.Name,"GenerateCoversForSeries", [libraryId, seriesId, forceUpdate]))
|
||||
if (HasAlreadyEnqueuedTask(MetadataService.Name,"GenerateCoversForSeries", [libraryId, seriesId, forceUpdate, forceColorscape]))
|
||||
{
|
||||
_logger.LogInformation("A duplicate request to refresh metadata for library occured. Skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogInformation("Enqueuing series metadata refresh for: {SeriesId}", seriesId);
|
||||
BackgroundJob.Enqueue(() => _metadataService.GenerateCoversForSeries(libraryId, seriesId, forceUpdate));
|
||||
BackgroundJob.Enqueue(() => _metadataService.GenerateCoversForSeries(libraryId, seriesId, forceUpdate, forceColorscape));
|
||||
}
|
||||
|
||||
public async Task ScanSeries(int libraryId, int seriesId, bool forceUpdate = false)
|
||||
|
|
|
@ -221,7 +221,7 @@ public class ScannerService : IScannerService
|
|||
var libraryPaths = library.Folders.Select(f => f.Path).ToList();
|
||||
if (await ShouldScanSeries(seriesId, library, libraryPaths, series, true) != ScanCancelReason.NoCancel)
|
||||
{
|
||||
BackgroundJob.Enqueue(() => _metadataService.GenerateCoversForSeries(series.LibraryId, seriesId, false));
|
||||
BackgroundJob.Enqueue(() => _metadataService.GenerateCoversForSeries(series.LibraryId, seriesId, false, false));
|
||||
BackgroundJob.Enqueue(() => _wordCountAnalyzerService.ScanSeries(library.Id, seriesId, bypassFolderOptimizationChecks));
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue