Merge pull request #405 from HaveAGitGat/filter_by_file_property_amend

Check includes property
make-only-subtitle-default
HaveAGitGat 3 years ago committed by GitHub
commit 2d6eb64f6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -74,12 +74,16 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
let fileContainsProperty = false;
try {
try {
if (propertyValues.includes(file[propertyName])) {
fileContainsProperty = true;
for (let i = 0; i < propertyValues.length; i += 1) {
try {
if (file[propertyName].includes(propertyValues[i])) {
fileContainsProperty = true;
break;
}
} catch (err) {
// eslint-disable-next-line no-console
console.log(err);
}
} catch (err) {
// err
}
const message = `File property ${propertyName} of ${file[propertyName]}`

@ -88,6 +88,24 @@ const tests = [
},
},
{
input: {
file: _.cloneDeep(require('../sampleData/media/sampleH264_2.json')),
librarySettings: {},
inputs: {
propertyName: 'file',
propertyValues: 'Source Folder/h264.mkv',
continueIfPropertyFound: false,
},
otherArguments: {},
},
output: {
processFile: false,
infoLog: 'File property file of C:/Transcode/Source Folder/h264.mkv being one of Source Folder/h264.mkv has been found, breaking out of stack \n',
},
},
// // continueIfPropertyFound: true
{
@ -161,6 +179,24 @@ const tests = [
infoLog: 'File property video_resolution of 1080p being one of 721p,1081p has not been found, breaking out of stack \n',
},
},
{
input: {
file: _.cloneDeep(require('../sampleData/media/sampleH264_2.json')),
librarySettings: {},
inputs: {
propertyName: 'file',
propertyValues: 'Source Folder/h264.mkv',
continueIfPropertyFound: true,
},
otherArguments: {},
},
output: {
processFile: true,
infoLog: 'File property file of C:/Transcode/Source Folder/h264.mkv being one of Source Folder/h264.mkv has been found, continuing to next plugin \n',
},
},
];
run(tests);

Loading…
Cancel
Save