mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 23:48:15 -07:00
Update plugin
This commit is contained in:
parent
16afcf09bf
commit
3dc2d1a322
4 changed files with 342 additions and 114 deletions
|
|
@ -1,56 +0,0 @@
|
|||
const details = () => ({
|
||||
id: 'Tdarr_Plugin_00td_filter_10_bit_video',
|
||||
Stage: 'Pre-processing',
|
||||
Name: 'Filter 10 bit video',
|
||||
Type: 'Video',
|
||||
Operation: 'Filter',
|
||||
Description: 'Allow/disallow 10 bit video to be processed.',
|
||||
Version: '1.00',
|
||||
Tags: 'filter',
|
||||
Inputs: [
|
||||
{
|
||||
name: 'process10BitVideo',
|
||||
type: 'boolean',
|
||||
defaultValue: false,
|
||||
inputUI: {
|
||||
type: 'dropdown',
|
||||
options: [
|
||||
'false',
|
||||
'true',
|
||||
],
|
||||
},
|
||||
tooltip: 'Set true to allow 10 bit video to be processed.',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const plugin = (file, librarySettings, inputs, otherArguments) => {
|
||||
const lib = require('../methods/lib')();
|
||||
// eslint-disable-next-line no-unused-vars,no-param-reassign
|
||||
inputs = lib.loadDefaultValues(inputs, details);
|
||||
const response = {
|
||||
processFile: true,
|
||||
infoLog: 'File will be processed.',
|
||||
};
|
||||
|
||||
try {
|
||||
const streams10Bit = file.ffProbeData.streams.filter((row) => row.profile === 'Main 10');
|
||||
if (inputs.process10BitVideo === false && streams10Bit.length > 0) {
|
||||
response.processFile = false;
|
||||
response.infoLog = 'File video is 10 bit but 10 bit video processing is not allowed. Skipping plugins.';
|
||||
} else if (inputs.process10BitVideo === true && streams10Bit.length > 0) {
|
||||
response.infoLog = 'File video is 10 bit and 10 bit video processing is allowed. Continuing to plugins';
|
||||
} else if (streams10Bit.length === 0) {
|
||||
response.infoLog += 'File is not 10 bit.';
|
||||
}
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
return response;
|
||||
};
|
||||
|
||||
module.exports.details = details;
|
||||
module.exports.plugin = plugin;
|
||||
100
Community/Tdarr_Plugin_00td_filter_bit_depth.js
Normal file
100
Community/Tdarr_Plugin_00td_filter_bit_depth.js
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
const details = () => ({
|
||||
id: 'Tdarr_Plugin_00td_filter_bit_depth',
|
||||
Stage: 'Pre-processing',
|
||||
Name: 'Filter bit depth: 8,10,12 bit video',
|
||||
Type: 'Video',
|
||||
Operation: 'Filter',
|
||||
Description: 'Allow/disallow 8,10,12 bit video to be processed.',
|
||||
Version: '1.00',
|
||||
Tags: 'filter',
|
||||
Inputs: [
|
||||
{
|
||||
name: 'process8BitVideo',
|
||||
type: 'boolean',
|
||||
defaultValue: true,
|
||||
inputUI: {
|
||||
type: 'dropdown',
|
||||
options: [
|
||||
'false',
|
||||
'true',
|
||||
],
|
||||
},
|
||||
tooltip: 'Set true to allow 8 bit video to be processed.',
|
||||
},
|
||||
{
|
||||
name: 'process10BitVideo',
|
||||
type: 'boolean',
|
||||
defaultValue: true,
|
||||
inputUI: {
|
||||
type: 'dropdown',
|
||||
options: [
|
||||
'false',
|
||||
'true',
|
||||
],
|
||||
},
|
||||
tooltip: 'Set true to allow 10 bit video to be processed.',
|
||||
},
|
||||
{
|
||||
name: 'process12BitVideo',
|
||||
type: 'boolean',
|
||||
defaultValue: true,
|
||||
inputUI: {
|
||||
type: 'dropdown',
|
||||
options: [
|
||||
'false',
|
||||
'true',
|
||||
],
|
||||
},
|
||||
tooltip: 'Set true to allow 12 bit video to be processed.',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const plugin = (file, librarySettings, inputs, otherArguments) => {
|
||||
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 bitDepths = {
|
||||
8: 'Main',
|
||||
10: 'Main 10',
|
||||
12: 'Main 12',
|
||||
};
|
||||
|
||||
let foundBitDepth = false;
|
||||
Object.keys(bitDepths).forEach((bitDepth) => {
|
||||
try {
|
||||
const fileHasSpecifiedBitDepth = file.ffProbeData.streams
|
||||
.filter((row) => row.bits_per_raw_sample === bitDepth).length > 0
|
||||
|| file.ffProbeData.streams.filter((row) => row.profile === bitDepths[bitDepth]).length > 0;
|
||||
|
||||
if (fileHasSpecifiedBitDepth) {
|
||||
foundBitDepth = true;
|
||||
response.infoLog += `File video is ${bitDepth} bit.`;
|
||||
if (inputs[`process${bitDepth}BitVideo`]) {
|
||||
response.processFile = true;
|
||||
response.infoLog += ` ${bitDepth} bit is allowed, will process.`;
|
||||
} else {
|
||||
response.infoLog += ` ${bitDepth} bit is not allowed, will not process.`;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
|
||||
if (!foundBitDepth) {
|
||||
response.infoLog += ' Unable to find file bit depth. Won\'t process.';
|
||||
}
|
||||
|
||||
return response;
|
||||
};
|
||||
|
||||
module.exports.details = details;
|
||||
module.exports.plugin = plugin;
|
||||
Loading…
Add table
Add a link
Reference in a new issue