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

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

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

Post by rednoah »

1.
These two format expressions are equivalent:

Code: Select all

{plex.name}

Code: Select all

{evaluate('plex.name')}

Code: Select all

{evaluate('/path/to/code.groovy' as File)}

2.
This approach can be used to refactor complex formats into one or more reusable components and split them into external *.groovy script files:

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"}
:arrow: groovy.lang.Script
:arrow: net.filebot.format.ExpressionFormatFunctions
:idea: Please read the FAQ and How to Request Help.
Locked