mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-15 02:05:54 -07:00
Create Tdarr_Plugin_0house_filter_by_codec.js
This commit is contained in:
parent
5ad0e7a320
commit
0c63392cd7
1 changed files with 73 additions and 0 deletions
73
Community/Tdarr_Plugin_0house_filter_by_codec.js
Normal file
73
Community/Tdarr_Plugin_0house_filter_by_codec.js
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
const details = () => ({
|
||||||
|
id: 'Tdarr_Plugin_0house_filter_by_codec',
|
||||||
|
Stage: 'Pre-processing',
|
||||||
|
Name: 'Filter by codec',
|
||||||
|
Type: 'Video',
|
||||||
|
Operation: 'Filter',
|
||||||
|
Description: 'Only allow specified codecs to be processed \n\n',
|
||||||
|
Version: '1.00',
|
||||||
|
Tags: 'filter',
|
||||||
|
Inputs: [
|
||||||
|
{
|
||||||
|
name: 'codecsToProcess',
|
||||||
|
type: 'string',
|
||||||
|
defaultValue: '',
|
||||||
|
inputUI: {
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
tooltip:
|
||||||
|
'Enter a comma separated list of codecs to be processed. Leave blank if using codecsToNotProcess',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'codecsToNotProcess',
|
||||||
|
type: 'string',
|
||||||
|
defaultValue: '',
|
||||||
|
inputUI: {
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
tooltip:
|
||||||
|
'Enter a comma separated list of codecs to be not be processed. Leave blank if using codecsToProcess',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
// 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 fileCodec = file.video_codec_name !== '' ? file.video_codec_name : file.audio_codec_name;
|
||||||
|
|
||||||
|
if (inputs.codecsToProcess !== '') {
|
||||||
|
const codecs = inputs.codecsToProcess.split(',');
|
||||||
|
if (codecs.includes(fileCodec)) {
|
||||||
|
response.processFile = true;
|
||||||
|
response.processFile += 'File is in codecsToProcess. Moving to next plugin.';
|
||||||
|
} else {
|
||||||
|
response.processFile = false;
|
||||||
|
response.processFile += 'File is not in codecsToProcess. Breaking out of plugin stack.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inputs.codecsToNotProcess !== '') {
|
||||||
|
const codecs = inputs.codecsToNotProcess.split(',');
|
||||||
|
if (codecs.includes(fileCodec)) {
|
||||||
|
response.processFile = false;
|
||||||
|
response.processFile += 'File is in codecsToNotProcess. Breaking out of plugin stack.';
|
||||||
|
} else {
|
||||||
|
response.processFile = true;
|
||||||
|
response.processFile += 'File is not in codecsToNotProcess. Moving to next plugin.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.details = details;
|
||||||
|
module.exports.plugin = plugin;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue