From 147115cc12cda3860724010ce4c3765d580eae6c Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Tue, 18 Jun 2024 08:10:39 +0100 Subject: [PATCH] Add original container option. --- ...gin_00td_action_handbrake_ffmpeg_custom.js | 10 +++++++-- ...gin_00td_action_handbrake_ffmpeg_custom.js | 21 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_00td_action_handbrake_ffmpeg_custom.js b/Community/Tdarr_Plugin_00td_action_handbrake_ffmpeg_custom.js index 910fdee3a..ee1baa561 100644 --- a/Community/Tdarr_Plugin_00td_action_handbrake_ffmpeg_custom.js +++ b/Community/Tdarr_Plugin_00td_action_handbrake_ffmpeg_custom.js @@ -70,7 +70,7 @@ HandBrake examples: type: 'text', }, tooltip: - 'Enter the desired container', + 'Enter the desired container. Set to "original" to keep the original container.', }, ], }); @@ -91,7 +91,13 @@ const plugin = (file, librarySettings, inputs, otherArguments) => { }; response.preset = inputs.arguments; - response.container = `.${inputs.container}`; + + if (inputs.container === 'original') { + response.container = `.${file.container}`; + } else { + response.container = `.${inputs.container}`; + } + response.handbrakeMode = inputs.cli === 'handbrake'; response.ffmpegMode = inputs.cli === 'ffmpeg'; response.reQueueAfter = true; diff --git a/tests/Community/Tdarr_Plugin_00td_action_handbrake_ffmpeg_custom.js b/tests/Community/Tdarr_Plugin_00td_action_handbrake_ffmpeg_custom.js index b4105a4ec..9d4f85ee5 100644 --- a/tests/Community/Tdarr_Plugin_00td_action_handbrake_ffmpeg_custom.js +++ b/tests/Community/Tdarr_Plugin_00td_action_handbrake_ffmpeg_custom.js @@ -61,6 +61,27 @@ const tests = [ infoLog: 'File is being transcoded using custom arguments \n', }, }, + { + input: { + file: require('../sampleData/media/sampleH264_1.json'), + librarySettings: {}, + inputs: { + cli: 'ffmpeg', + arguments: '-c:v libx265 -crf 23 -ac 6 -c:a aac -preset veryfast', + container: 'original', + }, + otherArguments: {}, + }, + output: { + processFile: true, + preset: '-c:v libx265 -crf 23 -ac 6 -c:a aac -preset veryfast', + container: '.mp4', + handbrakeMode: false, + ffmpegMode: true, + reQueueAfter: true, + infoLog: 'File is being transcoded using custom arguments \n', + }, + }, ]; void run(tests);