[Solved] Filebot Format into Groovy?

Support for Windows users
Post Reply
KarlKek
Posts: 3
Joined: 30 May 2023, 15:24

[Solved] Filebot Format into Groovy?

Post by KarlKek »

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?
Last edited by KarlKek on 30 May 2023, 19:29, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot Format into Groovy?

Post by rednoah »

e.g. -rename files and use a custom --format

Code: Select all

filebot -rename -r "/path/to/files" --db TheMovieDB::TV -non-strict --format "{s} - {s00e00} - {t}"
:idea: https://www.filebot.net/cli.html


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
:arrow: 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
:idea: Please read the FAQ and How to Request Help.
KarlKek
Posts: 3
Joined: 30 May 2023, 15:24

Re: Filebot Format into Groovy?

Post by KarlKek »

rednoah wrote: 30 May 2023, 15:43 e.g. -rename files and use a custom --format

Code: Select all

filebot -rename -r "/path/to/files" --db TheMovieDB::TV -non-strict --format "{s} - {s00e00} - {t}"
:idea: https://www.filebot.net/cli.html


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
:arrow: 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
Thanks for your reply.

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 }}
This is my preset in Filebot, and it works fine - I just need a way to use same code with CLI.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot Format into Groovy?

Post by rednoah »

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 file

Code: Select all

filebot -rename -r "/path/to/files" --db TheMovieDB::TV -non-strict --format /path/to/format.groovy
:arrow: viewtopic.php?t=3244

Image


:arrow: [FAQ] How can I use the same format in both GUI and CLI?
:idea: Please read the FAQ and How to Request Help.
KarlKek
Posts: 3
Joined: 30 May 2023, 15:24

Re: Filebot Format into Groovy?

Post by KarlKek »

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 file

Code: Select all

filebot -rename -r "/path/to/files" --db TheMovieDB::TV -non-strict --format /path/to/format.groovy
:arrow: viewtopic.php?t=3244

Image


:arrow: [FAQ] How can I use the same format in both GUI and CLI?
Worked like a charm!

Thanks :)
Post Reply