diff options
Diffstat (limited to 'Emby.Server.Implementations/MediaEncoder/EncodingManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/MediaEncoder/EncodingManager.cs | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs b/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs index 1d74e8788..9a9e619a6 100644 --- a/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs +++ b/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs @@ -29,9 +29,9 @@ namespace Emby.Server.Implementations.MediaEncoder private readonly IChapterManager _chapterManager; private readonly ILibraryManager _libraryManager; - public EncodingManager(IFileSystem fileSystem, - ILogger logger, - IMediaEncoder encoder, + public EncodingManager(IFileSystem fileSystem, + ILogger logger, + IMediaEncoder encoder, IChapterManager chapterManager, ILibraryManager libraryManager) { _fileSystem = fileSystem; @@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.MediaEncoder /// Gets the chapter images data path. /// </summary> /// <value>The chapter images data path.</value> - private string GetChapterImagesPath(IHasImages item) + private string GetChapterImagesPath(IHasMetadata item) { return Path.Combine(item.GetInternalMetadataPath(), "chapters"); } @@ -75,6 +75,11 @@ namespace Emby.Server.Implementations.MediaEncoder return false; } + if (!video.IsCompleteMedia) + { + return false; + } + // Can't extract images if there are no video streams return video.DefaultVideoStreamIndex.HasValue; } @@ -84,13 +89,8 @@ namespace Emby.Server.Implementations.MediaEncoder /// </summary> private static readonly long FirstChapterTicks = TimeSpan.FromSeconds(15).Ticks; - public async Task<bool> RefreshChapterImages(ChapterImageRefreshOptions options, CancellationToken cancellationToken) + public async Task<bool> RefreshChapterImages(Video video, List<ChapterInfo> chapters, bool extractImages, bool saveChapters, CancellationToken cancellationToken) { - var extractImages = options.ExtractImages; - var video = options.Video; - var chapters = options.Chapters; - var saveChapters = options.SaveChapters; - if (!IsEligibleForChapterImageExtraction(video)) { extractImages = false; @@ -117,16 +117,14 @@ namespace Emby.Server.Implementations.MediaEncoder { if (extractImages) { - if (video.VideoType == VideoType.HdDvd || video.VideoType == VideoType.Iso) + if (video.VideoType == VideoType.Iso) { continue; } + if (video.VideoType == VideoType.BluRay || video.VideoType == VideoType.Dvd) { - if (video.PlayableStreamFileNames.Count != 1) - { - continue; - } + continue; } try @@ -136,13 +134,13 @@ namespace Emby.Server.Implementations.MediaEncoder var protocol = MediaProtocol.File; - var inputPath = MediaEncoderHelpers.GetInputArgument(_fileSystem, video.Path, protocol, null, video.PlayableStreamFileNames); + var inputPath = MediaEncoderHelpers.GetInputArgument(_fileSystem, video.Path, protocol, null, new string[] { }); _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path)); var container = video.Container; - var tempFile = await _encoder.ExtractVideoImage(inputPath, container, protocol, video.Video3DFormat, time, cancellationToken).ConfigureAwait(false); + var tempFile = await _encoder.ExtractVideoImage(inputPath, container, protocol, video.GetDefaultVideoStream(), video.Video3DFormat, time, cancellationToken).ConfigureAwait(false); _fileSystem.CopyFile(tempFile, path, true); try @@ -151,7 +149,7 @@ namespace Emby.Server.Implementations.MediaEncoder } catch { - + } chapter.ImagePath = path; @@ -181,7 +179,7 @@ namespace Emby.Server.Implementations.MediaEncoder if (saveChapters && changesMade) { - await _chapterManager.SaveChapters(video.Id.ToString(), chapters, cancellationToken).ConfigureAwait(false); + _chapterManager.SaveChapters(video.Id.ToString(), chapters); } DeleteDeadImages(currentImages, chapters); |
