Issue with IF statement

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
pjburnhill
Posts: 18
Joined: 15 Mar 2017, 20:02

Issue with IF statement

Post by pjburnhill »

My arguments (movie processing):

Code: Select all

/usr/bin/filebot -script fn:amc --output "/GD/Media/Plex" --action move "/GD/Media/Plex/Incoming/Film" --def @/root/.filebot/args.txt --def excludeList -no-xattr --def subtitles=en --def pushbullet=[mykey] --def storeReport=y --def clean=y --def "ut_label=Movie" --def unsorted=y --log-file amc_movies.log --conflict override
args.txt (movie section)

Code: Select all

movieFormat={if (fn =~ /KORSUB|HC|HARDCODED/) 'Unsorted' else if (genre == 'Documentary') 'Documentaries' else 'Films'}/{n.space('.').upperInitial()}.({y})/{fn.space('.').upperInitial()}
I'm running Filebot on a VPS with Google Drive mounted into /GD. I'm running the above every hour and having some issues with dealing with some specific files. The files in question are these:

Code: Select all

Don.Giovanni.2008.Part.1.BRRip.XviD.MP3-RARBG.avi
Don.Giovanni.2008.Part.2.BRRip.XviD.MP3-RARBG.avi
And this is what the report gives:

Code: Select all

Don.Giovanni.2008.Part.1.BRRip.XviD.MP3-RARBG.avi	Don.Giovanni.2008.Part.1.BRRip.XviD.MP3-RARBG.avi	/Don.Giovanni.(2008)
Don.Giovanni.2008.Part.2.BRRip.XviD.MP3-RARBG.avi	Don.Giovanni.2008.Part.2.BRRip.XviD.MP3-RARBG.avi	/Don.Giovanni.(2008)
For some reason, it's resolving the IF statement to <null> which must somehow resolve the whole output (/GD/Media/Plex/Incoming/Film) to '/', which actually moves the files into the VPS root and trashes the files on Google Drive. Could someone point me the error in my statement?

Thanks!
PJ
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Issue with IF statement

Post by rednoah »

I recommend using the Format Editor so you can quickly prototype your format.

Here's some help on how to do conditionals and deal with undefined values:
:arrow: viewtopic.php?f=5&t=1895
:arrow: viewtopic.php?f=5&t=4191

Image
:idea: Please read the FAQ and How to Request Help.
pjburnhill
Posts: 18
Joined: 15 Mar 2017, 20:02

Re: Issue with IF statement

Post by pjburnhill »

Thanks! I think I got it.. using this for the folders now, hopefully it works!

Code: Select all

{if (fn =~ /HARDCODED|HC|KORSUB/) 'Unsorted' else {self.genre == 'Documentary' ? 'Documentaries' : 'Films'}}
Not really sure why it threw 'null' with the previous version.. Also, how does the command line version determine which film match to select? Is it always the first one?
Post Reply