Skip to content
TechieGuy12 edited this page Jul 12, 2024 · 2 revisions

Note

Steps are available in version 2.x and higher.

Steps are the basic execution blocks for a workflow. They provide a series of tasks that will be performed within the workflow.

Structure

The structure of steps within a workflow is as follows:

<watches>
    <watch>
        <workflows>
            <workflow>        
                <steps>
                    <variables></variables>
                    <step>
                        <id></id>
                        <needs></needs>
                        <variables></variables>                        
                        <action></action>
                        <command></command>
                        <notification></notification>
                    </step>
                </steps>
            </workflow>
        </workflows>
    </watch>
</watches>

Steps Elements

A <steps> element can contain the following child elements:

Element Description
variables (Optional) The variables for all child steps. For more information, see Variables.
step Each step to be executed.

Step Elements

Each step element can contain the following elements:

Element Description
id The unique identifier for the step within the workflow.
needs (Optional) A list of steps that will need to completed before this step can run. For more information, see Needs.
variables (Optional) The variables for all child steps. For more information, see Variables.
action (Optional) The action to be performed. For more information, see Actions.
command (Optional) The action to be performed. For more information, see Commands.
notification (Optional) The action to be performed. For more information, see Notifications.

Unlike a watch, a <step> element can only contain one action, command, and notification.

Examples

The following is a config file showing a workflow with three steps:

<watches>
    <watch>
        <path>F:\Pictures</path>
        <id>create-photos-watch</id>
        <workflows>
            <workflow>
                <triggers>
                    <trigger>Create</trigger>
                </triggers>
                <steps>
                    <step>
                        <id>create-picture-get-checksum</id>
                        <command>          
                            <path>C:\Tools\fv\fv.exe</path>                 
                            <arguments>-f "[exactpath]" -sf C:\Tools\fv\config.xml</arguments>
                        </command>
                    </step>
                    <step>
                        <id>create-picture-gotify-send-message</id>
                        <needs>
                            <need>create-picture-get-checksum</need>
                        </needs>
                        <notification>
                            <url>[env:gotify_url]/message</url>
                            <method>POST</method>
                            <data>
                                <headers>
                                    <header>
                                        <name>X-Gotify-Key</name>
                                        <value>[env:gotify_key]</value>
                                    </header>
                                </headers>
                                <body>
                                    {
                                        "message": "[message]",
                                        "priority": 7,
                                        "title": "Pictures Folder"
                                    }            
                                </body>
                            </data>
                        </notification>                        
                    </step>
                    <step>
                        <id>create-picture-plex-refresh-library</id>
                        <needs>
                            <need>create-picture-get-checksum</need>
                        </needs>                 
                        <notification>
                            <method>GET</method>
                            <url>[env:plex_url]/library/sections/1/refresh?path=[urlenc:F:\Pictures\[path]]&amp;X-Plex-Token=[env:plex_token]</url>
                        </notification>                    
                    </step>                    
                </steps>
            </workflow>
        </workflows>
    </watch>
</watches>

The flow of execution for the steps defined in the workflow will be:

  1. The command C:\Tools\fv\fv.exe f "[exactpath]" -sf C:\Tools\fv\config.xml will be run for each file to generate a checksum as per the create-picture-get-checksum step in the workflow in the create-photos-watch watch.
  2. After the create-picture-get-checksum step has completed, the create-picture-gotify-send-message and create-picture-plex-refresh-library steps in the workflow will then run because they have a need for the create-picture-get-checksum step to complete.
Clone this wiki locally