Set name of Show to variable

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
cheeseboy
Posts: 3
Joined: 25 Mar 2014, 01:40

Set name of Show to variable

Post by cheeseboy »

How can I store the renamed episode name (ie Archer S05E08), or any file that gets renamed as a bash variable? I'm trying to setup a notification system to setoff growl notifications on other computers, as well as make pushover notifications look nicer.

Right now I have it working with the $TR_TORRENT_NAME, but thats kind of ugly seeing the full path of all torrents, and notifications usually truncate them because of the length.

Ideally in my amc script, as well as in other custom scripts I'd be able to set it using a groovy tag (ie var={n.replaceTrailingBrackets()}) or just set it equal to the output from filebot CLI.

Anyway to do this?

Thanks.
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Set name of Show to variable

Post by rednoah »

Passing --def exec is probably the best way to chain any kind of post-processing:
--def exec=touch "{file}" Run program on newly processed files
:idea: Please read the FAQ and How to Request Help.
cheeseboy
Posts: 3
Joined: 25 Mar 2014, 01:40

Re: Set name of Show to variable

Post by cheeseboy »

Thanks for the reply. I got it working.

For anyone that comes across this looking to do something similar, here's what I did.

Because exec executes in a sub shell inheriting it's parent's environment, you can't pass a variable back to the parent (in this case your amc script) without doing something fancy. So the simplest thing to do is to crate a new script and pass ONLY FILE BINDINGS - not episode or movie ones as they won't work (http://www.filebot.net/naming.html) and call it with --def exec. ie:

Code: Select all

"exec=/home/user/path/to/script/ \"{fn}\""
Once you've done that, script away in your new file that will execute after filebot runs the amc script, and it will have access to any of the bindings you passed it via command line arguments.

Hope this helps.
Post Reply