Basics
This documentation is still under construction
Flow plugins have input and ouput handles which can connect with other flow plugins. There is only a single input handle but 1 or more ouput handles depending on what you'd like to happen.
Have a look at the tutorial templates when clicking Flow+ on the Flows tab to get an idea of how flows work.
Flow plugins, templates and helpers are written in Typescript which is compiled into Javascript. You can see both here:
https://github.com/HaveAGitGat/Tdarr_Plugins/tree/master/FlowPluginsTs https://github.com/HaveAGitGat/Tdarr_Plugins/tree/master/FlowPlugins
Flow plugins are broken down into categories here:
https://github.com/HaveAGitGat/Tdarr_Plugins/tree/master/FlowPluginsTs/CommunityFlowPlugins
Each plugin is passed an args
object which you can see the interface for here:
For example, to access the current working filename in a plugin, you'd use args.inputFileObj._id
.
Plugin Variable Templating
In Flow plugin inputs, you can access information using templating. For example, to access args.inputFileObj._id
, you'd use:
{{{args.inputFileObj._id}}}
This is useful, for example, if you're using the Send Web Request
plugin to send a notfication and you'd like to include the filename in the notification body.
To access an item in an array, use the following syntax which in this case will access the first item in the track
array (index starts at 0):
{{{args.inputFileObj.mediaInfo.track.0.BitRate}}}
To access the 4th item:
{{{args.inputFileObj.mediaInfo.track.3.BitRate}}}
Plugin Global and Library Variables
You can also use global and library variables in flow plugin inputs. Global variables can be set on the Tools tab and library variables can be set on the Libraries tab in the respective library.
In a plugin input, to access a global variable named test
you'd use:
{{{args.userVariables.global.test}}}
In a plugin input, to access a library variable named test
you'd use:
{{{args.userVariables.library.test}}}
This feature can be used for things such as storing API keys and creating different quality encodes for different libraries. For example, in your flow you could set custom ffmpeg arguments which depend on the {{{args.userVariables.library.quality}}}
variable for the library the current file belongs to.