Starting to think that me setup has worked by sheer dumb luck for the last few years...
I'm really confused by the difference, from what I understand:
The format.groovy file should not contain groovy code, only a string formatted to include the different actual groovy files.
The utiliities groovy files should not contain any formatting code, but be pure groovy code (I am unsure how they get access to any, allOf and such in that case)...
Previously I had one of my utilities (strVideoCodec.groovy which I now interpret as a groovy file, not a format file) as
Groovy: Select all
allOf
{hdr}
{ vc.replace('Microsoft', 'VC-1') }
.join(".")
And I used it like this in my movieFormat.groovy (which I assume is then a formatFile):
Groovy: Select all
def formattedCodec = include "strVideoCodec.groovy"
allOf {
{title}
{formattedCodec}
}
.join('.)
Which no longer works, even when changing to full path for the include.
I've tried to use --format @/[snipped]/movieFormat.groovy, which results in my files being renamed to "def formattedCode[..snip rest of raw text content]"
If I change my movieFormat.groovy to be:
{include 'fullpath/strVideoCodec.groovy'}
It seems to evaluate the value correctly, _but_ I cannot then use allOf {...}.join('.) to concatenate the different parts...
I did find one way that seems to work, which is:
Edit movieFormat.groovy file and change all "def X = include path/X.groovy" to instead be { include path }.
Create a new movieFormat2.groovy that contains only "{ include movieFormat.groovy }".
Update my format expression to use be @/path/movieFormat2.groovy.
Is that the expected behaviour? I.e. the formatFile only contains a single { }-expression (i tried to have allOf {include 1} {include 2}.join('.') in it, but it resulted in my filenames becoming "allOf Title Metadata.join('.')"....
For reference my updated files are now looking more like:
strMetadata.groovy:
Groovy: Select all
allOf
{include "D:/FileBot/scripts/sharedExpressions/strEditions.groovy"}
{vf}
{include "D:/FileBot/scripts/sharedExpressions/strSource.groovy"}
{include "D:/FileBot/scripts/sharedExpressions/strVideo.groovy"}
{include "D:/FileBot/scripts/sharedExpressions/strAudio.groovy"}
.join('.')
movieFormat.groovy (I'm guessing the def stuff here works as they are functions, not expressions):
Groovy: Select all
def normalize = include "D:/FileBot/scripts/utility/normalize.groovy"
def transliterate = include "D:/FileBot/scripts/utility/transliterate.groovy"
def isLatin = { java.text.Normalizer.normalize(it, java.text.Normalizer.Form.NFD).replaceAll(/\p{InCombiningDiacriticalMarks}+/, "") ==~ /^\p{InBasicLatin}+$/ }
def useOriginalName = any {audio[0]?.language == "da"}{false}
def strTitle = normalize(useOriginalName ? primaryTitle : n)
def strOriginalTitle = (useOriginalName || normalize(n) == normalize(primaryTitle)) ? null : normalize(isLatin(primaryTitle) ? primaryTitle : transliterate(primaryTitle))
allOf
{strTitle}
{"($y)"}
{strOriginalTitle}
{include "D:/FileBot/scripts/sharedExpressions/strMetadata.groovy"}
.join(".")
.space(".")
movieFormat2.groovy
Groovy: Select all
{include D:/FileBot/scripts/movieFormat.groovy}
And then finally I use --movieFormat=@D:/FileBot/scripts/movieFormat2.groovy.
Is that the expected setup, or am I just lucking into a combination that works again?
Really grateful for the help btw, the concept of a formatfile and real groovy files that are both using groovy is really confusing me.