diff --git a/Community/Tdarr_Plugin_00td_filter_by_file_property.js b/Community/Tdarr_Plugin_00td_filter_by_file_property.js index 2082660..cebdfbd 100644 --- a/Community/Tdarr_Plugin_00td_filter_by_file_property.js +++ b/Community/Tdarr_Plugin_00td_filter_by_file_property.js @@ -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]}` diff --git a/tests/Community/Tdarr_Plugin_00td_filter_by_file_property.js b/tests/Community/Tdarr_Plugin_00td_filter_by_file_property.js index ca67e52..30cdec6 100644 --- a/tests/Community/Tdarr_Plugin_00td_filter_by_file_property.js +++ b/tests/Community/Tdarr_Plugin_00td_filter_by_file_property.js @@ -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);