All about user-defined episode / movie / file name format expressions
-
nzdreamer55
- Posts: 168
- Joined: 20 Jul 2012, 23:25
Post
by nzdreamer55 »
Hi everyone,
I am trying to get the CLI of filebot on a linux setup to move the beginning word (The,A, An) to the rear of the title. I copied from this
viewtopic.php?f=5&t=211
Code: Select all
filebot -script fn:amc "/home/linux/mnt/Film.Pool/T/Test/" --def "movieFormat=/home/linux/mnt/Film.Pool/{n =~ /^(?i)[a-z]/ ? n[0] : '#'}/{n.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /$2, $1/)} ({y}){' '+[vf]}/{n.upperInitial()} {' '+[vf]}{'.'+[vc]}{'.'+[ac]}{'.'+[af]}{'.'+[source]}{'.'+[group]}..."
but for some reason it deletes the file name leaving only a comma.
Any help is appreciated.
-
rednoah
- The Source
- Posts: 23935
- Joined: 16 Nov 2011, 08:59
- Location: Taipei
-
Contact:
Post
by rednoah »
The format you think you are passing in is not the format you are actually passing in.
Hint: shell resolves your $variables before filebot is called
-
nzdreamer55
- Posts: 168
- Joined: 20 Jul 2012, 23:25
Post
by nzdreamer55 »
Thanks Rednoah. I am confused by your hint.
So this is where it does not work I think.
{n.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /$2, $1/)}
and I am not sure why. Can you explain your hint to me? I think it has to do with the shell and the $2, $1.
Thank you very much.
-
nzdreamer55
- Posts: 168
- Joined: 20 Jul 2012, 23:25
Post
by nzdreamer55 »
Thanks for the link. So from that reading I suspect that the $ (variables) need to be escaped. Am I getting warm?
So would this
{n.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /$2, $1/)}
need to be changed to
{n.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /\$2, \$1/)}