OPDS-PS v1.2 Support + a few bugfixes (#1869)

* Fixed up a localization lookup test case

* Refactored some webp to a unified method

* Cleaned up some code

* Expanded webp conversion for covers to all entities

* Code cleanup

* Prompt the user when they are about to delete multiple series via bulk actions

* Aligned Kavita to OPDS-PS 1.2.

* Fixed a bug where clearing metadata filter of series name didn't clear the actual field.

* Added some documentation

* Refactored how covert covers to webp works. Now we will handle all custom covers for all entities. Volumes and Series will not be touched but instead be updated via a RefreshCovers call. This will fix up the references much faster.

* Fixed up the OPDS-PS 1.2 attributes to only show on PS links
This commit is contained in:
Joe Milazzo 2023-03-09 18:41:42 -06:00 committed by GitHub
parent 1f34068662
commit 47269b4c51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 334 additions and 99 deletions

View file

@ -30,6 +30,7 @@ public interface ITaskScheduler
void CancelStatsTasks();
Task RunStatCollection();
void ScanSiteThemes();
Task CovertAllCoversToWebP();
}
public class TaskScheduler : ITaskScheduler
{
@ -46,6 +47,7 @@ public class TaskScheduler : ITaskScheduler
private readonly IThemeService _themeService;
private readonly IWordCountAnalyzerService _wordCountAnalyzerService;
private readonly IStatisticService _statisticService;
private readonly IBookmarkService _bookmarkService;
public static BackgroundJobServer Client => new BackgroundJobServer();
public const string ScanQueue = "scan";
@ -66,7 +68,8 @@ public class TaskScheduler : ITaskScheduler
public TaskScheduler(ICacheService cacheService, ILogger<TaskScheduler> logger, IScannerService scannerService,
IUnitOfWork unitOfWork, IMetadataService metadataService, IBackupService backupService,
ICleanupService cleanupService, IStatsService statsService, IVersionUpdaterService versionUpdaterService,
IThemeService themeService, IWordCountAnalyzerService wordCountAnalyzerService, IStatisticService statisticService)
IThemeService themeService, IWordCountAnalyzerService wordCountAnalyzerService, IStatisticService statisticService,
IBookmarkService bookmarkService)
{
_cacheService = cacheService;
_logger = logger;
@ -80,6 +83,7 @@ public class TaskScheduler : ITaskScheduler
_themeService = themeService;
_wordCountAnalyzerService = wordCountAnalyzerService;
_statisticService = statisticService;
_bookmarkService = bookmarkService;
}
public async Task ScheduleTasks()
@ -174,6 +178,17 @@ public class TaskScheduler : ITaskScheduler
BackgroundJob.Enqueue(() => _themeService.Scan());
}
public async Task CovertAllCoversToWebP()
{
await _bookmarkService.ConvertAllCoverToWebP();
_logger.LogInformation("[BookmarkService] Queuing tasks to update Series and Volume references via Cover Refresh");
var libraryIds = await _unitOfWork.LibraryRepository.GetLibrariesAsync();
foreach (var lib in libraryIds)
{
RefreshMetadata(lib.Id, false);
}
}
#endregion
#region UpdateTasks