mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 23:48:15 -07:00
Create Tdarr_Plugin_0house_filter_by_size.js
This commit is contained in:
parent
68eb996322
commit
d7f58b2530
1 changed files with 57 additions and 0 deletions
57
Community/Tdarr_Plugin_0house_filter_by_size.js
Normal file
57
Community/Tdarr_Plugin_0house_filter_by_size.js
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
const details = () => ({
|
||||
id: 'Tdarr_Plugin_0house_filter_by_size',
|
||||
Stage: 'Pre-processing',
|
||||
Name: 'Filter by size',
|
||||
Type: 'Video',
|
||||
Operation: 'Filter',
|
||||
Description: 'Only allow files to be transcoded which are within the lower and upper bounds (MB) \n\n',
|
||||
Version: '1.00',
|
||||
Tags: 'filter',
|
||||
Inputs: [
|
||||
{
|
||||
name: 'upperBound',
|
||||
type: 'number',
|
||||
defaultValue: 100000,
|
||||
inputUI: {
|
||||
type: 'text',
|
||||
},
|
||||
tooltip:
|
||||
'Enter the upper bound size in MB for files which should be processed.',
|
||||
},
|
||||
{
|
||||
name: 'lowerBound',
|
||||
type: 'number',
|
||||
defaultValue: 0,
|
||||
inputUI: {
|
||||
type: 'text',
|
||||
},
|
||||
tooltip:
|
||||
'Enter the lower bound size in MB for files which should be processed.',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const plugin = (file, librarySettings, inputs, otherArguments) => {
|
||||
// eslint-disable-next-line global-require
|
||||
const lib = require('../methods/lib')();
|
||||
// eslint-disable-next-line no-unused-vars,no-param-reassign
|
||||
inputs = lib.loadDefaultValues(inputs, details);
|
||||
const response = {
|
||||
processFile: false,
|
||||
infoLog: '',
|
||||
};
|
||||
|
||||
const fileSize = file.file_size;
|
||||
if (fileSize >= inputs.lowerBound && fileSize <= inputs.upperBound) {
|
||||
response.processFile = true;
|
||||
response.infoLog += 'File is within lower and upper bound size limits. Moving to next plugin.';
|
||||
} else {
|
||||
response.infoLog += 'File is not within lower and upper bound size limits. Breaking out of plugin stack.';
|
||||
}
|
||||
|
||||
return response;
|
||||
};
|
||||
|
||||
module.exports.details = details;
|
||||
module.exports.plugin = plugin;
|
||||
Loading…
Add table
Add a link
Reference in a new issue