From 93ff21021ca2c48d1f33b8bd4390b8ab8f2210c2 Mon Sep 17 00:00:00 2001 From: MrMeeb Date: Sun, 21 Apr 2024 15:54:43 +0000 Subject: [PATCH] Make eachs stage optional and configurable --- Tdarr_Plugin_MM1_MrMeeb_Full_Stack.js | 91 ++++++++++++++++++++++++--- 1 file changed, 82 insertions(+), 9 deletions(-) diff --git a/Tdarr_Plugin_MM1_MrMeeb_Full_Stack.js b/Tdarr_Plugin_MM1_MrMeeb_Full_Stack.js index 62cfc6e..eb43b39 100644 --- a/Tdarr_Plugin_MM1_MrMeeb_Full_Stack.js +++ b/Tdarr_Plugin_MM1_MrMeeb_Full_Stack.js @@ -1,13 +1,62 @@ const details = () => ({ - id: 'Tdarr_Plugin_MM1_Full_Stack', - Stage: 'Pre-processing', - Name: 'MrMeeb Full Stack Processing', - Type: 'Video', - Operation: 'Transcode', - Description: 'Automatically removes TrueHD and replaces with a suitable AC3 5.1 track, either pre-existing or created.\n Removes non-English and non-German subtitles.\n Transcodes x264 content to HEVC using NVENC, with a focus on quality', - Version: '0.1', - Tags: 'pre-processing', - Inputs: [], + id: 'Tdarr_Plugin_MM1_MrMeeb_Full_Stack', + Stage: 'Pre-processing', + Name: 'MrMeeb Full Stack Processing', + Type: 'Video', + Operation: 'Transcode', + Description: 'Automatically removes TrueHD and replaces with a suitable AC3 5.1 track, either pre-existing or created.\n Removes non-English and non-German subtitles.\n Transcodes x264 content to HEVC using NVENC, with a focus on quality', + Version: '0.1', + Tags: 'pre-processing', + Inputs: [ + { + name: 'process_video', + type: 'boolean', + defaultValue: true, + inputUI: { + type: 'dropdown', + options: [ + 'true', + 'false', + ], + }, + tooltip: `Select whether to process video, or just copy over`, + }, + { + name: 'process_audio', + type: 'boolean', + defaultValue: true, + inputUI: { + type: 'dropdown', + options: [ + 'true', + 'false', + ], + }, + tooltip: `Select whether to process audio, or just copy over`, + }, + { + name: 'process_subs', + type: 'boolean', + defaultValue: true, + inputUI: { + type: 'dropdown', + options: [ + 'true', + 'false', + ], + }, + tooltip: `Select whether to process subs, or just copy over`, + }, + { + name: 'crf', + type: 'string', // set the data type of the input ('string', 'number', 'boolean') + defaultValue: '19', // set the default value of the input incase the user enters no input + inputUI: { + type: 'text', // specify how the input UI will appear to the user ('text' or 'dropdown') + }, + tooltip: `Enter CRF value used for video transcoding.`, + }, + ], }); @@ -53,6 +102,14 @@ const plugin = (file, librarySettings, inputs, otherArguments) => { const processAudio = (file, librarySettings, inputs, otherArguments) => { + if (inputs.process_audio == false) { + + response.infoLog += `Processing audio set to skip. Copying all present tracks over.\n` + + } + + else { + // Function variables let audioIdx = -1; let audioIdxTruehd = -1; @@ -431,6 +488,14 @@ const plugin = (file, librarySettings, inputs, otherArguments) => { const processSubs = (file, librarySettings, inputs, otherArguments) => { + if (inputs.process_subs == false) { + + response.infoLog += `Processing subs set to skip. Copying all present tracks over.\n` + + } + + else { + // Function variables let subIdx = -1; @@ -496,6 +561,14 @@ const plugin = (file, librarySettings, inputs, otherArguments) => { const processVideo = (file, librarySettings, inputs, otherArguments) => { + if (inputs.process_video == false) { + + response.infoLog += `Processing video set to skip. Copying all present tracks over.\n` + + } + + else { + console.log(` === Running processVideo function === `) // Check if video track is already HEVC