Templating
Many config options can include template variables that will be replaced by information parsed from each file.
Note
Variables can be formatted as either $variable or ${variable}.
When the variable name contains a . or a |, the { } form must be used: ${variable.one|upper}
Global Variables¶
These variables can be used pretty much anywhere
| Key | Value |
|---|---|
| $date | Current date in the show's configured timezone (YYYY-MM-DD) |
| $year | Current year (YYYY) |
| $month | Current month (00 - 12) |
| $datetime | Current date and time in the show's configured timezone, in iso format (YYYY-MM-DD HH:MM:SS) |
Item Specific Variables¶
These can only be used for templated strings specifically associated with an item or file.
| Variable | Replaced Value |
|---|---|
| $date_uploaded | The item's uploaded date in the show's configured timezone (YYYY-MM-DD) |
| $parent_folders | The item's parent folders, or empty if none Note: parent_folders do not include a leading '/' |
| $parent_folder | The item's first parent folder, or empty if none |
| $frame_parent_folders | A special value that detects resolution folders in a directory of EXR frames. This will either be one or two folders, e.g.: - 100_100_0100_v001, or- 100_100_0100_v001/1920x1080 |
| $package_name | The name of the package the item was delivered in. Note: will be sanitized to remove invalid characters |
| $local_path | The local path to disk of the file |
| $remote_path | The remote (cloud) path of the file |
| $type | The item type (as parsed from the filename) |
| $extension | The file extension (e.g. mov or csv) |
| $uploaded_by | Who the item was uploaded by (default: Unknown Uploader) Note: will be sanitized to remove invalid characters |
| $vendor | The vendor value parsed from regex (default: Unknown Vendor) |
| $episode | The episode value parsed from regex (default: Unknown Episode) |
| $project | The project value parsed from regex (default: Unknown Project) |
| ${any_other_string} | Any value captured by the regex parser can also be used here. Note: If the regex capture group is named the same as any of the variables above, the previous values will be overwritten |
Modifiers¶
You can add |value modifiers to the end of variable names to transform the result.
| Modifier | Example | Example Result |
|---|---|---|
| upper | ${var|upper} | EXAMPLE RESULT |
| lower | ${var|lower} | example result |
| capitalize | ${var|capitalize} | Example result |
| title | ${var|title} | Example Result |
Expression Evaluation¶
In most cases across the configuration, you can use eval() to calculate values based on templated variables.
For example, if cut out is 10 and cut in is 1,
$sg_cut_out - $sg_cut_in will template to the string "10 - 1"
but eval($sg_cut_out - $sg_cut_in)
will template to 9
You can use this, for example, to use calculated values in a lineup or webhook:
lineup_creator:
template:
col1:
- title: calculated duration
contents: eval($sg_cut_out - $sg_cut_in)
Info
You also can eval() inline if statements, randint(), rand(), etc.
For more information about the specific operations you can do, refer to the simpleeval documentation
