Conditional formating "LANG"

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
noviceiii
Posts: 8
Joined: 05 Dec 2017, 08:15

Conditional formating "LANG"

Post by noviceiii »

Dear all

I have a bit a hard time to figure out the correct syntax. Maybe someone could give me a hand?

I would like to label video files according their language - if any has been detected by filebot. If none has been found, it should remain empty.
Therefore I have {lang} in my formating.

Example
if I have "Avatar2017.stuff.n.things.mp4" in English and would like to get "Avatar (2017).eng.mp4".

So far, so good.
However, if "lang" hasn't been detected, it remains empty and gives "Avatar (2017)..mp4". I would like it to be substituted with "NOLANG".

I was trying with no luck:
- {lang ~= // ? lang : 'NOLANG'}
- {lang = "" ? 'NOLANG' : lang}
- {lang.length < 2 ? lang : 'NOLANG'}

How would it be correct?

Kind regards
n3
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Conditional formating "LANG"

Post by rednoah »

This thread should get you on the right track:
viewtopic.php?f=5&t=1895

Let me know if anything isn't clear.
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Conditional formating "LANG"

Post by kim »

I think you are looking for something like this?

Code: Select all

{any{languages}{'NOLANG'}.join('.')}

Code: Select all

{any{languages}{'NOLANG'}.first()}
{lang} is from filename or subs
{languages} is Spoken Languages
Post Reply