SyntaxError: missing token: } in CLI not in GUI

Support for macOS users
Post Reply
river
Posts: 17
Joined: 22 Sep 2016, 07:05

SyntaxError: missing token: } in CLI not in GUI

Post by river »

I am 2 day old user of filebot and I googled and search a forum for formate I want.

Code: Select all

{n.replaceFirst(/^(?i)(The|A)\s(.+)/, /$2,$1/).space('.')}{'.'+y}{'.'+fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition|repack/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ").space('.')}{'.'+vf}{'.'+source.replaceAll('(?i)BluRay', 'Blu-ray')}{'.'+ac}{'.'+af.replace('8ch', '7.1ch').replace('7ch', '6.1ch').replace('6ch', '5.1ch').replace('3ch', '2.1ch').replace('2ch','2.0ch')}{'.'+vc}{'.'+'['+imdbid+ ']'}{'-'+group}/{n.space('.')}{'.'+y}{'.'+fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition|repack/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ").space('.')}{'.'+vf}{'.'+source.replaceAll('(?i)BluRay', 'Blu-ray')}{'.'+ac}{'.'+af.replace('8ch', '7.1ch').replace('7ch', '6.1ch').replace('6ch', '5.1ch').replace('3ch', '2.1ch').replace('2ch','2.0ch')}{'.'+vc}{'-'+group}{'.'+'CD'+pi}
above formate works in GUI perfectly but when I try to execute it use CLI I get following error.

Code: Select all

$ filebot -rename -r --db TheMovieDB --action test -non-strict --output ~/odroid/My_Book/media/movie --conflict skip --format "{n.replaceFirst(/^(?i)(The|A)\s(.+)/, /$2,$1/).space('.')}{'.'+y}{'.'+fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition|repack/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ").space('.')}{'.'+vf}{'.'+source.replaceAll('(?i)BluRay', 'Blu-ray')}{'.'+ac}{'.'+af.replace('8ch', '7.1ch').replace('7ch', '6.1ch').replace('6ch', '5.1ch').replace('3ch', '2.1ch').replace('2ch','2.0ch')}{'.'+vc}{'.'+'['+imdbid+ ']'}{'-'+group}/{n.space('.')}{'.'+y}{'.'+fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition|repack/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ").space('.')}{'.'+vf}{'.'+source.replaceAll('(?i)BluRay', 'Blu-ray')}{'.'+ac}{'.'+af.replace('8ch', '7.1ch').replace('7ch', '6.1ch').replace('6ch', '5.1ch').replace('3ch', '2.1ch').replace('2ch','2.0ch')}{'.'+vc}{'-'+group}{'.'+'CD'+pi}"  ~/odroid/My_Book/media/movie_old/\,.2004.720p.Blu-ray.DTS.5.1ch.x264.EbP.\[tt0296572\]/
SyntaxError: missing token: }
javax.script.ScriptException: SyntaxError: missing token: }
	at net.filebot.format.ExpressionFormat.compile(ExpressionFormat.java:144)
	at net.filebot.format.ExpressionFormat.<init>(ExpressionFormat.java:75)
	at net.filebot.cli.CmdlineOperations.rename(CmdlineOperations.java:97)
	at net.filebot.cli.ArgumentProcessor.runCommand(ArgumentProcessor.java:89)
	at net.filebot.cli.ArgumentProcessor.run(ArgumentProcessor.java:25)
	at net.filebot.Main.main(Main.java:124)
Failure (°_°)
After some try and error I found code due to which it fails in CLI

Code: Select all

{'.'+fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition|repack/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ").space('.')}

How can I make this work in CLI?
Last edited by river on 22 Sep 2016, 08:15, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: SyntaxError: missing token: } in CLI not in GUI

Post by rednoah »

rednoah wrote:Make sure you escape and quote your cmdline arguments correctly. I will not fix your broken cmdline call for you.
:arrow: But I will recommend loading complex arguments from a text file. ;)
:idea: Please read the FAQ and How to Request Help.
river
Posts: 17
Joined: 22 Sep 2016, 07:05

Re: SyntaxError: missing token: } in CLI not in GUI

Post by river »

Ok I have narrow it down to this point

with out
replaceAll(/[._]/, " ")

Code: Select all

~  $  filebot -rename /media/My_Book/media/movie_old -r --db TheMovieDB --action test -non-strict --conflict skip --output /media/My_Book/media/movie --format "{n.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /$2,$1/).space('.')}{'.'+y}{'.'+fn.match(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition|repack/)*.upperInitial()*.lowerTrail().sort().join(',').space('.')}"
Rename movies using [TheMovieDB]
I copied fn.match from here
viewtopic.php?t=447#p7533

This special character is difficult for me to handle please little help
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: SyntaxError: missing token: } in CLI not in GUI

Post by rednoah »

Did you just ignore my reply and then ask for more help!? :evil:

DO USE @files to pass arguments. Very easy.

DO NOT pass arguments on the command-line. Very difficult.

EDIT:

You can either do it the smart way like I recommended and avoid these problems altogether, or do it yourself anyway you want and help yourself, which will be a good learning experience in and of itself. ;)
:idea: Please read the FAQ and How to Request Help.
river
Posts: 17
Joined: 22 Sep 2016, 07:05

Re: SyntaxError: missing token: } in CLI not in GUI

Post by river »

Please do not get mad at me, I was tired and refused to gave up and in that process I chose to ignore help you provided. That is my fault and please accept my apology.
Now I was able to make it work.
Thank you for support
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: SyntaxError: missing token: } in CLI not in GUI

Post by rednoah »

No worries. I'm just saying there's an easy and there's a hard way. I can't be bothered to explain the latter cause it's complicated. :lol:

:idea: It's not just that " wasn't escaped, characters like $ will be interpreted by bash and result in very non-obvious problems.
:idea: Please read the FAQ and How to Request Help.
Post Reply