mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 07:29:04 -07:00
Add Tdarr_Plugin_a9hf_New_file_duration_check test
This commit is contained in:
parent
c74b7678b4
commit
ad646d04b5
4 changed files with 73 additions and 5 deletions
|
|
@ -52,6 +52,7 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|||
|
||||
const ratio = parseInt((newSize / oldSize) * 100, 10);
|
||||
|
||||
console.log(newSize, oldSize);
|
||||
const sizeText = `New file has size ${newSize.toFixed(3)} MB which is ${ratio}% `
|
||||
+ `of original file size: ${oldSize.toFixed(3)} MB`;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
// eslint-disable-next-line import/no-unresolved
|
||||
|
||||
// tdarrSkipTest
|
||||
const details = () => ({
|
||||
id: 'Tdarr_Plugin_a9hf_New_file_duration_check',
|
||||
Stage: 'Pre-processing',
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ const run = require('../helpers/run');
|
|||
const tests = [
|
||||
{
|
||||
input: {
|
||||
file: require('../sampleData/media/sampleH264_1.json'),
|
||||
file: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')),
|
||||
librarySettings: {},
|
||||
inputs: {},
|
||||
otherArguments: {
|
||||
originalLibraryFile: require('../sampleData/media/sampleH264_1.json'),
|
||||
originalLibraryFile: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')),
|
||||
},
|
||||
},
|
||||
output: {
|
||||
|
|
@ -23,7 +23,7 @@ const tests = [
|
|||
},
|
||||
{
|
||||
input: {
|
||||
file: require('../sampleData/media/sampleH264_1.json'),
|
||||
file: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')),
|
||||
librarySettings: {},
|
||||
inputs: {
|
||||
upperBound: '110',
|
||||
|
|
@ -44,7 +44,7 @@ const tests = [
|
|||
},
|
||||
{
|
||||
input: {
|
||||
file: require('../sampleData/media/sampleH264_1.json'),
|
||||
file: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')),
|
||||
librarySettings: {},
|
||||
inputs: {
|
||||
upperBound: '120',
|
||||
|
|
|
|||
68
tests/Community/Tdarr_Plugin_a9hf_New_file_duration_check.js
Normal file
68
tests/Community/Tdarr_Plugin_a9hf_New_file_duration_check.js
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/* eslint max-len: 0 */
|
||||
const _ = require('lodash');
|
||||
const run = require('../helpers/run');
|
||||
|
||||
const tests = [
|
||||
{
|
||||
input: {
|
||||
file: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')),
|
||||
librarySettings: {},
|
||||
inputs: {},
|
||||
otherArguments: {
|
||||
originalLibraryFile: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')),
|
||||
},
|
||||
},
|
||||
output: {
|
||||
processFile: false,
|
||||
preset: '',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: 'New file has duration 5.312 s which is 100.000% of original file duration: 5.312 s',
|
||||
},
|
||||
},
|
||||
{
|
||||
input: {
|
||||
file: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')),
|
||||
librarySettings: {},
|
||||
inputs: {
|
||||
upperBound: '110',
|
||||
lowerBound: '35',
|
||||
},
|
||||
otherArguments: {
|
||||
originalLibraryFile: (() => {
|
||||
const file = _.cloneDeep(require('../sampleData/media/sampleH264_1.json'));
|
||||
file.mediaInfo.track.filter((row) => row['@type'] === 'General')[0].Duration = 20;
|
||||
return file;
|
||||
})(),
|
||||
},
|
||||
},
|
||||
output: 'New file duration not within limits. New file has duration 5.312 s which is 26.560% of original file duration: 20 s. lowerBound is 35%',
|
||||
error: {
|
||||
shouldThrow: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
input: {
|
||||
file: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')),
|
||||
librarySettings: {},
|
||||
inputs: {
|
||||
upperBound: '110',
|
||||
lowerBound: '35',
|
||||
},
|
||||
otherArguments: {
|
||||
originalLibraryFile: (() => {
|
||||
const file = _.cloneDeep(require('../sampleData/media/sampleH264_1.json'));
|
||||
file.mediaInfo.track.filter((row) => row['@type'] === 'General')[0].Duration = 1;
|
||||
return file;
|
||||
})(),
|
||||
},
|
||||
},
|
||||
output: 'New file duration not within limits. New file has duration 5.312 s which is 531.200% of original file duration: 1 s. upperBound is 110%',
|
||||
error: {
|
||||
shouldThrow: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
run(tests);
|
||||
Loading…
Add table
Add a link
Reference in a new issue