Hi there.
I have an working filebot format, and now I would like to use a command like: filebot -script "{groovy_script_path}"
But no matter what I try, the .groovy script seems not to work.
I get outputs like: Done ?(?????)?
I attempted to get ChatGTP to convert it for me, and that didn't work either - So why one know of an method to convert the filebot format into a .groovy script?
[Solved] Filebot Format into Groovy?
[Solved] Filebot Format into Groovy?
Last edited by KarlKek on 30 May 2023, 19:29, edited 1 time in total.
Re: Filebot Format into Groovy?
e.g. -rename files and use a custom --format
https://www.filebot.net/cli.html
e.g. -rename files and use a custom --format read from an external *.groovy text file
viewtopic.php?t=3244
Note that the -script option is for running groovy scripts, conceptually unrelated to custom formats, think bash script or powershell script, but better: https://www.filebot.net/script.html
Code: Select all
filebot -rename -r "/path/to/files" --db TheMovieDB::TV -non-strict --format "{s} - {s00e00} - {t}"

e.g. -rename files and use a custom --format read from an external *.groovy text file
Code: Select all
filebot -rename -r "/path/to/files" --db TheMovieDB::TV -non-strict --format /path/to/format.groovy


Re: Filebot Format into Groovy?
Thanks for your reply.rednoah wrote: ↑30 May 2023, 15:43 e.g. -rename files and use a custom --formatCode: Select all
filebot -rename -r "/path/to/files" --db TheMovieDB::TV -non-strict --format "{s} - {s00e00} - {t}"
https://www.filebot.net/cli.html
e.g. -rename files and use a custom --format read from an external *.groovy text fileCode: Select all
filebot -rename -r "/path/to/files" --db TheMovieDB::TV -non-strict --format /path/to/format.groovy
viewtopic.php?t=3244
Note that the -script option is for running groovy scripts, conceptually unrelated to custom formats, think bash script or powershell script, but better: https://www.filebot.net/script.html
My code is a little more complicated:
Code: Select all
if ((textlanguages.size > 3) && (textlanguages[0].ISO3 == "dan" || textlanguages[0].ISO3 == "nor" || textlanguages[0].ISO3 == "fin" || textlanguages[0].ISO3 == "swe") && (textlanguages[1].ISO3 == "dan" || textlanguages[1].ISO3 == "nor" || textlanguages[1].ISO3 == "fin" || textlanguages[1].ISO3 == "swe") && (textlanguages[2].ISO3 == "dan" || textlanguages[2].ISO3 == "nor" || textlanguages[2].ISO3 == "fin" || textlanguages[2].ISO3 == "swe") && (textlanguages[3].ISO3 == "dan" || textlanguages[3].ISO3 == "nor" || textlanguages[3].ISO3 == "fin" || textlanguages[3].ISO3 == "swe")){ textlanguages = "NORDiC" }
else if ((textlanguages.size > 2) && (textlanguages[0].ISO3 == "dan" || textlanguages[0].ISO3 == "nor" || textlanguages[0].ISO3 == "fin" || textlanguages[0].ISO3 == "swe") && (textlanguages[1].ISO3 == "dan" || textlanguages[1].ISO3 == "nor" || textlanguages[1].ISO3 == "fin" || textlanguages[1].ISO3 == "swe") && (textlanguages[2].ISO3 == "dan" || textlanguages[2].ISO3 == "nor" || textlanguages[2].ISO3 == "fin" || textlanguages[2].ISO3 == "swe")){ textlanguages = "NORDiC" }
else if (textlanguages[0].ISO3 == "dan") { textlanguages = "DANiSH" }
else if (textlanguages[0].ISO3 == "nor") { textlanguages = "NORWEGiAN" }
else if (textlanguages[0].ISO3 == "fin") { textlanguages = "FiNNiSH" }
else if (textlanguages[0].ISO3 == "swe") { textlanguages = "SWEDiSH" }
else {textlanguages = "ERROR"}
}.WEB-DL.{vf}.
{if (vc == "AVC") { vc = "H.264." }
else if (vc == "HEVC") { vc = "H.265." } else { vc +"." }}
{if (ac == "EAC3") { ac = "DD" } else { ac }}
{channels}{if (subt == null) {} else if (subt == ".dan") {subt = ".da"} else if (subt == ".swe") {subt = ".sv"} else if (subt == ".nor") {subt = ".no"} else if (subt == ".nob") {subt = ".no"} else if (subt == ".fin") {subt = ".fi"} else if (subt == ".eng") {subt = ".en"} else { subt }}
Re: Filebot Format into Groovy?
Yes, you can copy & paste your format code unchanged into a new text file and then specify that text file as --format option value. In the example I gave you, /path/to/format.groovy refers to a text file that contains your format code:

[FAQ] How can I use the same format in both GUI and CLI?
rednoah wrote: ↑30 May 2023, 15:43 e.g. -rename files and use a custom --format read from an external *.groovy text fileCode: Select all
filebot -rename -r "/path/to/files" --db TheMovieDB::TV -non-strict --format /path/to/format.groovy
viewtopic.php?t=3244


Re: Filebot Format into Groovy?
Worked like a charm!rednoah wrote: ↑30 May 2023, 18:14 Yes, you can copy & paste your format code unchanged into a new text file and then specify that text file as --format option value. In the example I gave you, /path/to/format.groovy refers to a text file that contains your format code:rednoah wrote: ↑30 May 2023, 15:43 e.g. -rename files and use a custom --format read from an external *.groovy text fileCode: Select all
filebot -rename -r "/path/to/files" --db TheMovieDB::TV -non-strict --format /path/to/format.groovy
viewtopic.php?t=3244
[FAQ] How can I use the same format in both GUI and CLI?
Thanks
