mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-11 00:10:29 -07:00
Add multi value to !=
This commit is contained in:
parent
e5dc35064f
commit
806af22b44
1 changed files with 6 additions and 8 deletions
|
|
@ -65,9 +65,7 @@ const details = (): IpluginDetails => ({
|
||||||
type: 'text',
|
type: 'text',
|
||||||
},
|
},
|
||||||
tooltip: `Value of variable to check.
|
tooltip: `Value of variable to check.
|
||||||
For == condition, you can specify multiple values separated by comma. For example: value1,value2,value3
|
You can specify multiple values separated by comma. For example: value1,value2,value3`,
|
||||||
If the variable matches any of the values, the condition is true.
|
|
||||||
`,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
|
|
@ -125,21 +123,21 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
|
||||||
targetValue = String(targetValue);
|
targetValue = String(targetValue);
|
||||||
let outputNumber = 1;
|
let outputNumber = 1;
|
||||||
|
|
||||||
|
const valuesArr = value.trim().split(',');
|
||||||
if (condition === '==') {
|
if (condition === '==') {
|
||||||
const valuesArr = value.trim().split(',');
|
|
||||||
if (valuesArr.includes(targetValue)) {
|
if (valuesArr.includes(targetValue)) {
|
||||||
args.jobLog(`Variable ${variable} of value ${targetValue} matches condition ${condition} ${valuesArr}`);
|
args.jobLog(`Variable ${variable} of value ${targetValue} matches condition ${condition} ${valuesArr}`);
|
||||||
outputNumber = 1;
|
outputNumber = 1;
|
||||||
} else {
|
} else {
|
||||||
args.jobLog(`Variable ${variable} of value ${targetValue} does not match condition ${condition} ${value}`);
|
args.jobLog(`Variable ${variable} of value ${targetValue} does not match condition ${condition} ${valuesArr}`);
|
||||||
outputNumber = 2;
|
outputNumber = 2;
|
||||||
}
|
}
|
||||||
} else if (condition === '!=') {
|
} else if (condition === '!=') {
|
||||||
if (targetValue !== value) {
|
if (!valuesArr.includes(targetValue)) {
|
||||||
args.jobLog(`Variable ${variable} of value ${targetValue} matches condition ${condition} ${value}`);
|
args.jobLog(`Variable ${variable} of value ${targetValue} matches condition ${condition} ${valuesArr}`);
|
||||||
outputNumber = 1;
|
outputNumber = 1;
|
||||||
} else {
|
} else {
|
||||||
args.jobLog(`Variable ${variable} of value ${targetValue} does not match condition ${condition} ${value}`);
|
args.jobLog(`Variable ${variable} of value ${targetValue} does not match condition ${condition} ${valuesArr}`);
|
||||||
outputNumber = 2;
|
outputNumber = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue