just add the tools
folder from this repository to your local flows folder
{Tdarr install folder}\server\Tdarr\Plugins\FlowPlugins\LocalFlowPlugins
e.g. C:\ProgramData\Tdarr\server\Tdarr\Plugins\FlowPlugins\LocalFlowPlugins
the plugins will then show up on the local tab on the flows page.
We Start by adding a SetFlowVariable
plugin to the flow. We dont have to set a SetFlowVariable
if we want to start the first number at 0 but it's good practice in case you need to change the calculation starting number further down the line.
Then we can add the Variable Math
plugin to the flow and set the plugin settings. the User Variable
must be the name of the variable in the first step, you can't pass {{{args}}}
into this plugin as it uses the variable name to calculate and update that variable. We then choose the MathOperator
and the NumberValue
we want to calculate against the stored variable.
We can also choose the number of DecimalPlaces
we want to round to. For example, some FFMPEG filters require the number to be rounded to 1 decimal place, passing a number with 2 decimal places will break the FFMPEG filter.
That is all there is to it, but i'm going to show one more example, i've added another Variable Math
plugin to the flow and this time I'm going to multiply by 5
As you can see by the tutorial flow what we have done above.
SetFlowVariable
Variable Math
plugin to +1 to VariableVariable Math
plugin to multiply variable x5
When we check the Job Log, we can see that the plugin has completed the calculation.
The same for the multiplication calculation.
We add the Greater/Less Than plugin to the page, the settings are self-explanatory. The first number is the first number we want to check against the second number. in the text box for the first or second number, if you would like to check variables, you must type the full variable: e.g. {{{args.variables.user.myVariable}}}
. This allows us to match against not just the Local flow variables but the Global and Library variables as well.
So for instance, you could check if a number is greater than the video file duration using {{{args.inputFileObj.ffProbeData.format.duration}}}
in the second number field.
As you can see from this tutorial adding on from the last example, we can now create a count loop.
- We add a
SetFlowVariable
and set this to 0 - We use the
Greater / Less Than
plugin to run a check to see if the count is 10. - We then use the
Variable Math
plugin to +1 to the count. - Once the count is greater than 10, the
Greater / Less Than
plugin will then break out to the next flow.
When we add the plugin to the flow, we can then edit the plugin settings. Again it's pretty self-explanatory, We add the number we want to check if it's Odd or Even into the Check Number box. Again if you would like to check variables, you must type the full variable: e.g. {{{args.variables.user.myVariable}}}
. This allows us to match against not just the Local flow variables but also the Global and Library variables. If the number is Even it exits through point 1, if the number is odd, it exits through point 2.
You can see from the tutorial image below, that we are going to do something similar with the Variable Math
plugin. We will set the variable as 2 and check if it's odd or even. it will be Even so exit from point 1. We will then use the Variable Math
plugin to add one to the number, to make it an Odd number so it can progress. Why would we need an Even / Odd checker? FFMPEG Filters such as dynaudnorm
, atadenoise
, convolution
, nlmeans
, nlmeans_vulkan
require only an odd number within a range otherwise FFMPEG will fail and spit out an error message. checking the input before we pass it to the CLI is useful to ensure it doesn't break our code. Especially when using automated calculations on the filter values.