Page 1 of 1

Issue with IF statement

Posted: 23 Apr 2017, 18:33
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

Re: Issue with IF statement

Posted: 24 Apr 2017, 01:11
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

Re: Issue with IF statement

Posted: 24 Apr 2017, 17:36
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?