From 8f8ce5677b85c819c8c291a956b989fc32c4ca4d Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sun, 14 Feb 2021 17:17:32 +0100 Subject: [PATCH 1/8] Add filter example plugin --- Community/Tdarr_Plugin_bbbb_Filter_Example.js | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Community/Tdarr_Plugin_bbbb_Filter_Example.js diff --git a/Community/Tdarr_Plugin_bbbb_Filter_Example.js b/Community/Tdarr_Plugin_bbbb_Filter_Example.js new file mode 100644 index 0000000..987c512 --- /dev/null +++ b/Community/Tdarr_Plugin_bbbb_Filter_Example.js @@ -0,0 +1,35 @@ +module.exports.details = function details() { + return { + id: 'Tdarr_Plugin_bbbb_Filter_Example', + Stage: 'Pre-processing', + Name: 'Filter keywords ', + Type: 'Video', + Operation: 'Filter', + Description: 'This plugin prevents processing files which contain keywords \n\n', + Version: '1.00', + Link: 'https://github.com/HaveAGitGat/Tdarr_Plugin_bbbb_Filter_Example', + Tags: '', + }; +}; + +module.exports.plugin = function plugin(file) { + // Must return this object at some point in the function else plugin will fail. + + const response = { + processFile: true, + infoLog: '', + }; + + const keywords = [ + 'Low quality', + ]; + + for (let i = 0; i < keywords.length; i += 1) { + if (file.file.includes(keywords[i])) { + response.processFile = false; + response.infoLog += `Filter preventing processing. File title contains key word ${keywords[i]}`; + } + } + + return response; +}; From cf745dc6aad319352375a4f31acdd02552e0f442 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sun, 14 Feb 2021 17:19:24 +0100 Subject: [PATCH 2/8] Add example filter plugin --- .gitignore | 1 + ...bbbb_Filter_Example.js => Tdarr_Plugin_bbbb_Filter_Example.js | 0 2 files changed, 1 insertion(+) rename Community/Tdarr_Plugin_bbbb_Filter_Example.js => Tdarr_Plugin_bbbb_Filter_Example.js (100%) diff --git a/.gitignore b/.gitignore index e69de29..ae84271 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +./node_modules \ No newline at end of file diff --git a/Community/Tdarr_Plugin_bbbb_Filter_Example.js b/Tdarr_Plugin_bbbb_Filter_Example.js similarity index 100% rename from Community/Tdarr_Plugin_bbbb_Filter_Example.js rename to Tdarr_Plugin_bbbb_Filter_Example.js From 38fd37447323a2f68d5364c355cc45010ced8e20 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sun, 14 Feb 2021 17:19:58 +0100 Subject: [PATCH 3/8] update gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ae84271..30bc162 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -./node_modules \ No newline at end of file +/node_modules \ No newline at end of file From 901322d645f1e2061d2950c3870ce501b418bf45 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sun, 14 Feb 2021 17:22:03 +0100 Subject: [PATCH 4/8] Update Tdarr_Plugin_bbbb_Filter_Example.js --- Tdarr_Plugin_bbbb_Filter_Example.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tdarr_Plugin_bbbb_Filter_Example.js b/Tdarr_Plugin_bbbb_Filter_Example.js index 987c512..8287000 100644 --- a/Tdarr_Plugin_bbbb_Filter_Example.js +++ b/Tdarr_Plugin_bbbb_Filter_Example.js @@ -7,7 +7,7 @@ module.exports.details = function details() { Operation: 'Filter', Description: 'This plugin prevents processing files which contain keywords \n\n', Version: '1.00', - Link: 'https://github.com/HaveAGitGat/Tdarr_Plugin_bbbb_Filter_Example', + Link: 'https://github.com/HaveAGitGat/Tdarr_Plugin_bbbb_Filter_Example.js', Tags: '', }; }; From 9e1e732fcd77c4421cccf266548bca3e64a907a1 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sun, 14 Feb 2021 17:23:23 +0100 Subject: [PATCH 5/8] Update Tdarr_Plugin_bbbb_Filter_Example.js --- Tdarr_Plugin_bbbb_Filter_Example.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Tdarr_Plugin_bbbb_Filter_Example.js b/Tdarr_Plugin_bbbb_Filter_Example.js index 8287000..06c015b 100644 --- a/Tdarr_Plugin_bbbb_Filter_Example.js +++ b/Tdarr_Plugin_bbbb_Filter_Example.js @@ -28,6 +28,7 @@ module.exports.plugin = function plugin(file) { if (file.file.includes(keywords[i])) { response.processFile = false; response.infoLog += `Filter preventing processing. File title contains key word ${keywords[i]}`; + break; } } From f479522456e4bee38b7b4cd6bae10e46c190ae72 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sun, 14 Feb 2021 17:23:54 +0100 Subject: [PATCH 6/8] Update Tdarr_Plugin_bbbb_Filter_Example.js --- Tdarr_Plugin_bbbb_Filter_Example.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tdarr_Plugin_bbbb_Filter_Example.js b/Tdarr_Plugin_bbbb_Filter_Example.js index 06c015b..6d8200e 100644 --- a/Tdarr_Plugin_bbbb_Filter_Example.js +++ b/Tdarr_Plugin_bbbb_Filter_Example.js @@ -27,7 +27,7 @@ module.exports.plugin = function plugin(file) { for (let i = 0; i < keywords.length; i += 1) { if (file.file.includes(keywords[i])) { response.processFile = false; - response.infoLog += `Filter preventing processing. File title contains key word ${keywords[i]}`; + response.infoLog += `Filter preventing processing. File title contains keyword ${keywords[i]}`; break; } } From c0106cdf7b49500053410e582a4a670f79e9ec27 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sun, 14 Feb 2021 17:36:30 +0100 Subject: [PATCH 7/8] Update to jpn (iso) --- Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js index 9353278..a509146 100644 --- a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js +++ b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js @@ -18,7 +18,7 @@ function details() { eng \\nExample:\\n - eng,jap`, + eng,jpn`, }, { name: 'commentary', From bbf9210139d32a056527cc511e9475b0365792cc Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Mon, 15 Feb 2021 08:00:10 +0100 Subject: [PATCH 8/8] Output subs file to original folder --- ..._Output_embedded_subs_to_SRT_and_remove.js | 20 ++++++++++++++----- ...rr01_drpeppershaker_extract_subs_to_SRT.js | 15 +++++++++++--- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Community/Tdarr_Plugin_078d_Output_embedded_subs_to_SRT_and_remove.js b/Community/Tdarr_Plugin_078d_Output_embedded_subs_to_SRT_and_remove.js index abc42db..41e4122 100644 --- a/Community/Tdarr_Plugin_078d_Output_embedded_subs_to_SRT_and_remove.js +++ b/Community/Tdarr_Plugin_078d_Output_embedded_subs_to_SRT_and_remove.js @@ -43,11 +43,21 @@ module.exports.plugin = function plugin(file, librarySettings, inputs, otherArgu lang = subStream.tags.language } - let subsFile = file.file - subsFile = subsFile.split('.') - subsFile[subsFile.length - 2] += `.${lang}` - subsFile[subsFile.length - 1] = 'srt' - subsFile = subsFile.join('.') + const { originalLibraryFile } = otherArguments; + + let subsFile = ''; + + // for Tdarr V2 (2.00.05+) + if (originalLibraryFile && originalLibraryFile.file) { + subsFile = originalLibraryFile.file; + } else { + // for Tdarr V1 + subsFile = file.file; + } + subsFile = subsFile.split('.'); + subsFile[subsFile.length - 2] += `.${lang}`; + subsFile[subsFile.length - 1] = 'srt'; + subsFile = subsFile.join('.'); let index = subStream.index let command = `${ffmpegPath} -i "${file.file}" -map 0:${index} "${subsFile}"` diff --git a/Community/Tdarr_Plugin_rr01_drpeppershaker_extract_subs_to_SRT.js b/Community/Tdarr_Plugin_rr01_drpeppershaker_extract_subs_to_SRT.js index 88eced3..5076e26 100644 --- a/Community/Tdarr_Plugin_rr01_drpeppershaker_extract_subs_to_SRT.js +++ b/Community/Tdarr_Plugin_rr01_drpeppershaker_extract_subs_to_SRT.js @@ -34,9 +34,8 @@ module.exports.details = function details() { }; }; -module.exports.plugin = function plugin(file, librarySettings, inputs) { +module.exports.plugin = function plugin(file, librarySettings, inputs, otherArguments) { // Must return this object at some point in the function else plugin will fail. - const response = { processFile: true, preset: '', @@ -76,7 +75,17 @@ module.exports.plugin = function plugin(file, librarySettings, inputs) { title = subStream.tags.title; } - let subsFile = file.file; + const { originalLibraryFile } = otherArguments; + + let subsFile = ''; + + // for Tdarr V2 (2.00.05+) + if (originalLibraryFile && originalLibraryFile.file) { + subsFile = originalLibraryFile.file; + } else { + // for Tdarr V1 + subsFile = file.file; + } subsFile = subsFile.split('.'); subsFile[subsFile.length - 2] += `.${lang}`; subsFile[subsFile.length - 1] = 'srt';