From 0b11e8ad757ca4368e9808e08fa5ae6b600bec47 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Mon, 20 May 2024 10:04:07 +0100 Subject: [PATCH] Check mediaInfo properties --- ...ion_remove_stream_by_specified_property.js | 5 +++- ...ion_remove_stream_by_specified_property.js | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js b/Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js index 4c80689..8e1732c 100644 --- a/Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js +++ b/Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js @@ -76,7 +76,10 @@ const plugin = (file, librarySettings, inputs, otherArguments) => { let streamToRemove = false; for (let i = 0; i < file.ffProbeData.streams.length; i += 1) { try { - if (valuesToRemove.includes(String(file.ffProbeData.streams[i][propertyToCheck]))) { + if ( + valuesToRemove.includes(String(file.ffProbeData.streams[i][propertyToCheck])) + || valuesToRemove.includes(String(file.mediaInfo.track[i + 1][propertyToCheck])) + ) { response.preset += ` -map -0:${i} `; response.infoLog += ` Removing stream ${i} which is has ${propertyToCheck}` + ` of ${file.ffProbeData.streams[i][propertyToCheck]} \n`; diff --git a/tests/Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js b/tests/Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js index 1457d04..b397f1c 100644 --- a/tests/Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js +++ b/tests/Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js @@ -217,6 +217,30 @@ const tests = [ + ' Files has streams which need to be removed, processing \n', }, }, + + { + input: { + file: _.cloneDeep(require('../sampleData/media/sampleH264_2.json')), + librarySettings: {}, + inputs: { + propertyToCheck: 'CodecID', + valuesToRemove: 'A_AAC-2,S_TEXT/UTF8', + }, + otherArguments: {}, + }, + output: { + processFile: true, + preset: ', -map 0 -c copy -max_muxing_queue_size 9999 -map -0:4 -map -0:5 -map -0:6 ', + container: '.mkv', + handBrakeMode: false, + FFmpegMode: true, + reQueueAfter: false, + infoLog: ' Removing stream 4 which is has CodecID of undefined \n' + + ' Removing stream 5 which is has CodecID of undefined \n' + + ' Removing stream 6 which is has CodecID of undefined \n' + + ' Files has streams which need to be removed, processing \n', + }, + }, ]; void run(tests);