Merge pull request #13847 from Shadowghost/rework-chapter-management

Rework chapter management
This commit is contained in:
Tim Eisele
2025-04-26 14:01:12 +02:00
committed by GitHub
parent f35b8dd33d
commit df5671263f
15 changed files with 447 additions and 395 deletions

View File

@@ -11,8 +11,6 @@ using MediaBrowser.Controller.Chapters;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.IO;
@@ -28,42 +26,34 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
{
private readonly ILogger<ChapterImagesTask> _logger;
private readonly ILibraryManager _libraryManager;
private readonly IItemRepository _itemRepo;
private readonly IApplicationPaths _appPaths;
private readonly IEncodingManager _encodingManager;
private readonly IChapterManager _chapterManager;
private readonly IFileSystem _fileSystem;
private readonly ILocalizationManager _localization;
private readonly IChapterRepository _chapterRepository;
/// <summary>
/// Initializes a new instance of the <see cref="ChapterImagesTask" /> class.
/// </summary>
/// <param name="logger">Instance of the <see cref="ILogger"/> interface.</param>
/// <param name="libraryManager">Instance of the <see cref="ILibraryManager"/> interface.</param>
/// <param name="itemRepo">Instance of the <see cref="IItemRepository"/> interface.</param>
/// <param name="appPaths">Instance of the <see cref="IApplicationPaths"/> interface.</param>
/// <param name="encodingManager">Instance of the <see cref="IEncodingManager"/> interface.</param>
/// <param name="chapterManager">Instance of the <see cref="IChapterManager"/> interface.</param>
/// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param>
/// <param name="localization">Instance of the <see cref="ILocalizationManager"/> interface.</param>
/// <param name="chapterRepository">Instance of the <see cref="IChapterRepository"/> interface.</param>
public ChapterImagesTask(
ILogger<ChapterImagesTask> logger,
ILibraryManager libraryManager,
IItemRepository itemRepo,
IApplicationPaths appPaths,
IEncodingManager encodingManager,
IChapterManager chapterManager,
IFileSystem fileSystem,
ILocalizationManager localization,
IChapterRepository chapterRepository)
ILocalizationManager localization)
{
_logger = logger;
_libraryManager = libraryManager;
_itemRepo = itemRepo;
_appPaths = appPaths;
_encodingManager = encodingManager;
_chapterManager = chapterManager;
_fileSystem = fileSystem;
_localization = localization;
_chapterRepository = chapterRepository;
}
/// <inheritdoc />
@@ -126,12 +116,12 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
}
catch (IOException)
{
previouslyFailedImages = new List<string>();
previouslyFailedImages = [];
}
}
else
{
previouslyFailedImages = new List<string>();
previouslyFailedImages = [];
}
var directoryService = new DirectoryService(_fileSystem);
@@ -146,9 +136,9 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
try
{
var chapters = _chapterRepository.GetChapters(video.Id);
var chapters = _chapterManager.GetChapters(video.Id);
var success = await _encodingManager.RefreshChapterImages(video, directoryService, chapters, extract, true, cancellationToken).ConfigureAwait(false);
var success = await _chapterManager.RefreshChapterImages(video, directoryService, chapters, extract, true, cancellationToken).ConfigureAwait(false);
if (!success)
{