[DOCS] Split code into external *.groovy script files

All about user-defined episode / movie format expressions
Locked
User avatar
rednoah
The Source
Posts: 20177
Joined: 16 Nov 2011, 08:59

[DOCS] Split code into external *.groovy script files

Post by rednoah »

1.
(requires FileBot r8757) Use @format.groovy syntax to include external format expression code at compile time:

Code: Select all

@/path/to/TargetFolder.groovy
@/path/to/MovieNaming.groovy
@/path/to/MediaInfoTags.groovy

Image


:!: Note that the @file syntax for reading command-line arguments from external text files is a distinct concept and takes precedence on the command-line, so literal argument values cannot start with an @ character, so we start with a \n character (New Line) instead:

Code: Select all

filebot … --format "
@/path/to/TargetFolder.groovy
@/path/to/MovieNaming.groovy
@/path/to/MediaInfoTags.groovy
"


2.
Dynamically evaluate external Groovy scripts at runtime:

Code: Select all

{ include '/path/to/TargetFolder.groovy' }
{ include '/path/to/MovieNaming.groovy' }
{ include '/path/to/MediaInfoTags.groovy' }

Code: Select all

{ include "/path/to/MovieFormat.${y > 1980 ? 'Recent' : 'Classic'}.groovy" }


3.
Dynamically evaluate Groovy code at runtime:

Code: Select all

{ evaluate('plex.name') }


:arrow: groovy.lang.Script
:arrow: net.filebot.format.ExpressionFormatFunctions
:idea: Please read the FAQ and How to Request Help.
Locked