From debd9eb8ce3ee2731ee71f508b4260f654b12d02 Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Sat, 25 May 2024 11:46:12 -0400 Subject: [PATCH] Backport pull request #11754 from jellyfin/release-10.9.z Fix BD/DVD folder chapter image extraction Original-merge: 52be8be28fa27c0c7b4f53dc32e00ec0543616a9 Merged-by: Bond-009 Backported-by: Joshua M. Boniface --- .../MediaEncoding/EncodingHelper.cs | 12 +----------- .../MediaEncoding/IMediaEncoder.cs | 15 +++++++++++++++ .../Encoder/MediaEncoder.cs | 19 ++++++++++++++++--- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index ed64156d69..5d5b645f6a 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -680,16 +680,6 @@ namespace MediaBrowser.Controller.MediaEncoding return -1; } - public string GetInputPathArgument(EncodingJobInfo state) - { - return state.MediaSource.VideoType switch - { - VideoType.Dvd => _mediaEncoder.GetInputArgument(_mediaEncoder.GetPrimaryPlaylistVobFiles(state.MediaPath, null).ToList(), state.MediaSource), - VideoType.BluRay => _mediaEncoder.GetInputArgument(_mediaEncoder.GetPrimaryPlaylistM2tsFiles(state.MediaPath).ToList(), state.MediaSource), - _ => _mediaEncoder.GetInputArgument(state.MediaPath, state.MediaSource) - }; - } - /// /// Gets the audio encoder. /// @@ -1203,7 +1193,7 @@ namespace MediaBrowser.Controller.MediaEncoding else { arg.Append(" -i ") - .Append(GetInputPathArgument(state)); + .Append(_mediaEncoder.GetInputPathArgument(state)); } // sub2video for external graphical subtitles diff --git a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs index e696fa52ce..26c353a54f 100644 --- a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs @@ -245,6 +245,21 @@ namespace MediaBrowser.Controller.MediaEncoding /// A playlist. IReadOnlyList GetPrimaryPlaylistM2tsFiles(string path); + /// + /// Gets the input path argument from . + /// + /// The . + /// The input path argument. + string GetInputPathArgument(EncodingJobInfo state); + + /// + /// Gets the input path argument. + /// + /// The item path. + /// The . + /// The input path argument. + string GetInputPathArgument(string path, MediaSourceInfo mediaSource); + /// /// Generates a FFmpeg concat config for the source. /// diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 8ea0f58ea3..1197fc84c9 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -30,10 +30,8 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Globalization; using MediaBrowser.Model.IO; using MediaBrowser.Model.MediaInfo; -using Microsoft.AspNetCore.Components.Forms; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; -using static Nikse.SubtitleEdit.Core.Common.IfoParser; namespace MediaBrowser.MediaEncoding.Encoder { @@ -621,7 +619,7 @@ namespace MediaBrowser.MediaEncoding.Encoder ImageFormat? targetFormat, CancellationToken cancellationToken) { - var inputArgument = GetInputArgument(inputFile, mediaSource); + var inputArgument = GetInputPathArgument(inputFile, mediaSource); if (!isAudio) { @@ -1147,6 +1145,21 @@ namespace MediaBrowser.MediaEncoding.Encoder .ToList(); } + /// + public string GetInputPathArgument(EncodingJobInfo state) + => GetInputPathArgument(state.MediaPath, state.MediaSource); + + /// + public string GetInputPathArgument(string path, MediaSourceInfo mediaSource) + { + return mediaSource.VideoType switch + { + VideoType.Dvd => GetInputArgument(GetPrimaryPlaylistVobFiles(path, null).ToList(), mediaSource), + VideoType.BluRay => GetInputArgument(GetPrimaryPlaylistM2tsFiles(path).ToList(), mediaSource), + _ => GetInputArgument(path, mediaSource) + }; + } + /// public void GenerateConcatConfig(MediaSourceInfo source, string concatFilePath) {