Script works with filebot but not filebot fn:amc

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
MD500Pilot
Posts: 19
Joined: 10 Jan 2017, 22:30

Script works with filebot but not filebot fn:amc

Post by MD500Pilot »

I am trying to add all of this:

Code: Select all

/usr/bin/filebot -no-xattr -rename --db TheMovieDB -non-strict --log-file /root/filebot.log --format /mount/media/Movies/"{genres.contains('Comedy') ? 'Comedy' : genres.contains('Animation') ? 'Animation' : genres.contains('Science Fiction') ? 'Sci-Fi' : genres.contains('War') ? 'War' : genres.contains('Documentary') ? 'Documentary' : genres.contains('Fantasy') ? 'Fantasy': genres.contains('Sport') ? 'Sport': genres.contains('Horror') ? 'Horror': any{genre}{'NoGenre'}}/{n} ({y})/{n} ({y})" /mount/media/pre-process/*
to this:

Code: Select all

/usr/bin/filebot -script fn:amc -no-xattr -rename --db TheMovieDB -non-strict "/mount/media/pre-process" --log-file /root/filebot/filebot_amc.log --output "/mount/media" --def movieFormat="Movies/{any{genre}{'NoGenre'}} /{n} ({y})/{n} ({y}){' CD'+pi}{'.'+lang}" --def plex=10.200.50.2:XxxXxXxxXXxXX --def excludeList=/root/filebot/amc.txt
for the sole purpose of being able to let Plex know to update it's libraries. However no matter how much I try to add all of the additional categories it fails unless I pull them all the way back out.

Any help would be greatly appreciated.
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script works with filebot but not filebot fn:amc

Post by rednoah »

1.
What exactly is not working? Screenshots. Logs. Thx.


2.
I recommend using @files for passing complex format expressions: viewtopic.php?f=3&t=3244
:idea: Please read the FAQ and How to Request Help.
MD500Pilot
Posts: 19
Joined: 10 Jan 2017, 22:30

Re: Script works with filebot but not filebot fn:amc

Post by MD500Pilot »

Here is the code:

Code: Select all

/usr/bin/filebot -script fn:amc -no-xattr -rename --db TheMovieDB -non-strict "/mount/media/pre-process" --log-file /root/filebot/filebot_amc.log --output "/mount/media" --def movieFormat="Movies/{genres.contains('Comedy') ? 'Comedy' : genres.contains('Animation') ? 'Animation' : genres.contains('Science Fiction') ? 'Sci-Fi' : genres.contains('War') ? 'War' : genres.contains('Documentary') ? 'Documentary' : genres.contains('Fantasy') ? 'Fantasy': genres.contains('Sport') ? 'Sport': genres.contains('Horror') ? 'Horror': {any{genre}{'NoGenre'}} /{n} ({y})/{n} ({y}){' CD'+pi}{'.'+lang}" --def plex=10.200.50.2:xxXxXXxXXXXX --def excludeList=/root/filebot/amc.txt
Here is the output:

Code: Select all

Locking /root/filebot/filebot_amc.log
Run script [fn:amc] at [Fri Jan 13 15:55:28 PST 2017]
Parameter: movieFormat = Movies/{genres.contains('Comedy') ? 'Comedy' : genres.contains('Animation') ? 'Animation' : genres.contains('Science Fiction') ? 'Sci-Fi' : genres.contains('War') ? 'War' : genres.contains('Documentary') ? 'Documentary' : genres.contains('Fantasy') ? 'Fantasy': genres.contains('Sport') ? 'Sport': genres.contains('Horror') ? 'Horror': {any{genre}{'NoGenre'}} /{n} ({y})/{n} ({y}){' CD'+pi}{'.'+lang}
Parameter: plex = *****
Parameter: excludeList = /root/filebot/amc.txt
Argument[0]: /mount/media/pre-process
Use excludes: /root/filebot/amc.txt (5)
Input: /mount/media/pre-process/12 Rounds (2009).mkv
Group: [mov:12 rounds 2009] => [12 Rounds (2009).mkv]
SyntaxError: missing token: }
Finished without processing any files
Failure (°_°)
Keeps saying:

Code: Select all

SyntaxError: missing token: }
I does not seem to matter where I try and add the } I cannot seem to make it work properly!
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script works with filebot but not filebot fn:amc

Post by rednoah »

Please use the Format Editor. It'll help you with matching brackets.

Image

:idea: Not using the Format Editor clearly results in you wasting your time, and then you wasting my time. So what's the point?

:!: Why is it my job to count brackets for you? The error message is very clear. You open 10 {... brackets and you only close 9 ...} of them.
:idea: Please read the FAQ and How to Request Help.
MD500Pilot
Posts: 19
Joined: 10 Jan 2017, 22:30

Re: Script works with filebot but not filebot fn:amc

Post by MD500Pilot »

This works fine with Format Editor on OSX:

Code: Select all

{genres.contains('Comedy') ? 'Comedy' : genres.contains('Animation') ? 'Animation' : genres.contains('Science Fiction') ? 'Sci-Fi' : genres.contains('War') ? 'War' : genres.contains('Documentary') ? 'Documentary' : genres.contains('Fantasy') ? 'Fantasy': genres.contains('Sport') ? 'Sport': genres.contains('Horror') ? 'Horror': {any{genre}{'NoGenre'}}} /{n} ({y})/{n} ({y}){' CD'+pi}

Code: Select all

Movie Format
         Action/12 Rounds (2009)/12 Rounds (2009)

But still fails on the command line:

Code: Select all

Locking /root/filebot/filebot_amc.log
Run script [fn:amc] at [Sun Jan 15 11:29:44 PST 2017]
Parameter: movieFormat = Movies/{genres.contains('Comedy') ? 'Comedy' : genres.contains('Animation') ? 'Animation' : genres.contains('Science Fiction') ? 'Sci-Fi' : genres.contains('War') ? 'War' : genres.contains('Documentary') ? 'Documentary' : genres.contains('Fantasy') ? 'Fantasy': genres.contains('Sport') ? 'Sport': genres.contains('Horror') ? 'Horror': {any{genre}{'NoGenre'}}} /{n} ({y})/{n} ({y}){' CD'+pi}
Parameter: plex = *****
Parameter: excludeList = /root/filebot/amc.txt
Argument[0]: /mount/media/pre-process
Use excludes: /root/filebot/amc.txt (5)
Input: /mount/media/pre-process/12 Rounds.mkv
12 Rounds.mkv [series: pre process, movie: 12 Rounds (2009)]
Exclude Series: pre process
Group: [tvs:null, mov:12 rounds 2009] => [12 Rounds.mkv]
Rename movies using [TheMovieDB]
Auto-detect movie from context: [/mount/media/pre-process/12 Rounds.mkv]
Stripping invalid characters from new path: Movies/Script5$_run_closure1@30bcf3c1 /12 Rounds (2009)/12 Rounds (2009)
[TEST] Rename [/mount/media/pre-process/12 Rounds.mkv] to [/mount/media/Movies/Script5$_run_closure1@30bcf3c1/12 Rounds (2009)/12 Rounds (2009).mkv]
Processed 1 files
Finished without processing any files
Failure (°_°)
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script works with filebot but not filebot fn:amc

Post by rednoah »

Your format works for neither GUI nor CLI.

NO:

Code: Select all

{false ? null : {any{genre}{'NoGenre'}}}
YES:

Code: Select all

{false ? null : any{genre}{'NoGenre'}}
:idea: Please read the FAQ and How to Request Help.
MD500Pilot
Posts: 19
Joined: 10 Jan 2017, 22:30

Re: Script works with filebot but not filebot fn:amc

Post by MD500Pilot »

hummm...it is actually working fine via GUI and has some kind of script error in CLI:

Image


CLI error:

Code: Select all

/mount/media/Movies/Script5$_run_closure1@30bcf3c1
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Script works with filebot but not filebot fn:amc

Post by rednoah »

You're comparing apples and oranges. If you want to compare results, then you need to work with the same movie.

Avatar is a Science Fiction movie. The bug in your format only affects movies where the genre is not in your custom list of genres that you check beforehand.

i.e. Just because one code branch works, that doesn't mean that all other branches work:

Code: Select all

true ? 1 : 1/0

Code: Select all

false ? 1 : 1/0
:idea: Please read the FAQ and How to Request Help.
MD500Pilot
Posts: 19
Joined: 10 Jan 2017, 22:30

Re: Script works with filebot but not filebot fn:amc

Post by MD500Pilot »

Understood - I will move the exact file over and test on it!

Thanks for the patience!
MD500Pilot
Posts: 19
Joined: 10 Jan 2017, 22:30

Re: Script works with filebot but not filebot fn:amc

Post by MD500Pilot »

rednoah -


Thank you for your patience:

OK, So I moved my media file (12 Rounds.mkv) to my local machine, went into filebot and went to options => edit format, then pasted this format into the expression box:

Code: Select all

{genres.contains('Comedy') ? 'Comedy' :
 genres.contains('Animation') ? 'Animation' :
 genres.contains('Science Fiction') ? 'Sci-Fi' :
 genres.contains('War') ? 'War' :
 genres.contains('Documentary') ? 'Documentary' :
 genres.contains('Fantasy') ? 'Fantasy':
 genres.contains('Sport') ? 'Sport':
 genres.contains('Horror') ? 'Horror':
 any{genre}{'NoGenre'}} /{n} ({y})/{n} ({y}){' CD'+pi}
 
Image

Then selected "Change Sample", selected my sample (12 Rounds.mkv), selected Open Media Info and got the following:

Image

But the info object never changes from the Avitar sample file:

Image

So I clicked on "Use Bindings" and then "Use Format", selected my "12 Rounds.mkv" file as my original file and then matched it against the MovieDB and got this error:

Image

Of course, I noticed that it is looking for 12 Rounds.mkv.mkv which does not exist, but then it gives me an option of selecting a video I think it might be:

Image

If I add the year (12 Rounds (2009).mkv) then it immediately selects the correct movie and genre:

Image

And it does so using the expression which you said was incorrect (the one that works on the GUI but not the command line). So I still at a loss. It appears to somewhat work from the GUI, but not at all from the command line:

Code: Select all

/mount/media/Movies/Script5$_run_closure1@30bcf3c1
Post Reply