mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-15 18:25:54 -07:00
Create Tdarr_Plugin_0house_filter_by_bitrate.js
This commit is contained in:
parent
0c63392cd7
commit
ee932f5445
1 changed files with 60 additions and 0 deletions
60
Community/Tdarr_Plugin_0house_filter_by_bitrate.js
Normal file
60
Community/Tdarr_Plugin_0house_filter_by_bitrate.js
Normal file
|
|
@ -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…
Add table
Add a link
Reference in a new issue