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] 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; +};