mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 15:38:19 -07:00
Add filter example plugin
This commit is contained in:
parent
330dc5b2ea
commit
8f8ce5677b
1 changed files with 35 additions and 0 deletions
35
Community/Tdarr_Plugin_bbbb_Filter_Example.js
Normal file
35
Community/Tdarr_Plugin_bbbb_Filter_Example.js
Normal file
|
|
@ -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;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue