mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 07:29:04 -07:00
Check includes property
This commit is contained in:
parent
5a47a13501
commit
c00dfa7d9e
2 changed files with 45 additions and 5 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue