Create Tdarr_Plugin_0house_filter_by_bitrate.js

make-only-subtitle-default
HaveAGitGat 4 years ago
parent 0c63392cd7
commit ee932f5445

@ -0,0 +1,60 @@
const details = () => ({
id: 'Tdarr_Plugin_0house_filter_by_bitrate',
Stage: 'Pre-processing',
Name: 'Filter by bitrate',
Type: 'Video',
Operation: 'Filter',
Description: 'Only allow files to be transcoded which are within the lower and upper bounds (Kb) \n\n',
Version: '1.00',
Tags: 'filter',
Inputs: [
{
name: 'upperBound',
type: 'number',
defaultValue: 10000,
inputUI: {
type: 'text',
},
tooltip:
'Enter the upper bound bitrate in Kb for files which should be processed.',
},
{
name: 'lowerBound',
type: 'number',
defaultValue: 0,
inputUI: {
type: 'text',
},
tooltip:
'Enter the lower bound bitrate in Kb 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: '',
};
if (
file.bit_rate >= inputs.lowerBound * 1000
&& file.bit_rate <= inputs.upperBound * 1000
) {
response.processFile = true;
response.processFile += '☑File bitrate is within filter limits. Moving to next plugin.';
} else {
response.processFile = false;
response.processFile += '☒File bitrate is not within filter limits. Breaking out of plugin stack.\n';
return response;
}
return response;
};
module.exports.details = details;
module.exports.plugin = plugin;
Loading…
Cancel
Save