From 77abafca8ec2eeea59008354b2d5d441d7457cd3 Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Mon, 20 May 2024 13:19:05 +0200 Subject: [PATCH] Fix BD/DVD folder chapter image extraction --- .../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 49c208b77..9f77772b2 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 e696fa52c..26c353a54 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 8ea0f58ea..1197fc84c 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) {