AMC workflow using "--def exec"

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
WeAreSolipsists
Posts: 9
Joined: 03 Feb 2015, 23:46

AMC workflow using "--def exec"

Post by WeAreSolipsists »

Hi,

I'm using AMC on completed torrents, with Transmission on OSX and the transmission-postprocess script. I'd like to add an external script executed using"--def exec", and I have a question about the order in which the script gets called.

Does AMC match/process every file from the torrent before starting to run the external script on the processed files? Or is the external script run on each file as they are matched/processed? And does AMC wait for the external script to complete before moving on? Or does it just run the external script multiple times simultaneously?

I'm wanting to re-encode certain TV shows using HandbrakeCLI after they are matched/processed using AMC. If I download a whole season at once, it would be nice to let AMC do it's thing before the re-encodes start.

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

Re: AMC workflow using "--def exec"

Post by rednoah »

Does AMC match/process every file from the torrent before starting to run the external script on the processed files?
Depends on your --def exec template. It'll generate a command for each processed file, but each unique command will only be executed once.

e.g. one single call:

Code: Select all

--def exec="echo hello"
e.g. a single call for each file:

Code: Select all

--def exec="echo {fn}"
Or is the external script run on each file as they are matched/processed?
--def exec commands are called after everything has been processed successfully.

And does AMC wait for the external script to complete before moving on?
Yes, commands will be called in sequence.
:idea: Please read the FAQ and How to Request Help.
WeAreSolipsists
Posts: 9
Joined: 03 Feb 2015, 23:46

Re: AMC workflow using "--def exec"

Post by WeAreSolipsists »

Excellent - thanks for the quick and clear response.
hansooloo
Posts: 30
Joined: 06 Feb 2016, 14:58

Re: AMC workflow using "--def exec"

Post by hansooloo »

Follow up question:

If I have multiple commands I want to run, can I use multiple "--def exec" options on the same filebot.sh command line?

e.g., do chmod, chown, an rsync, an rm, and then curl (to trigger Plex update of Movies section, don't want ALL).
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC workflow using "--def exec"

Post by rednoah »

Whatever you pass in will be run on the shell, so you can do multiple commands as usual:

Code: Select all

--def exec="echo A && echo B && echo C"
Though I'd recommend making your own shell script that does all your stuff and then call that.
:idea: Please read the FAQ and How to Request Help.
shinomory
Posts: 1
Joined: 03 Nov 2016, 00:17

Re: AMC workflow using "--def exec"

Post by shinomory »

Hi, I know you just stated that unique commands are executed only once each depending on your --def exec command, but I'm finding this to not be the case.

Here's the relevant input from the log, more or less:

Code: Select all

Parameter: ut_kind = multi
Parameter: ut_dir = /home/hd24/shinomory/files/data/TV/TV.Fake.TV.Season.S02
Parameter: artwork = false
Parameter: extractfolder = /home/hd24/shinomory/torrents/extracted
Parameter: skipExtract = y
Parameter: music = n
Parameter: exec =". ~/doit.sh"
and I see at the bottom:

Code: Select all

Processed 10 files
Execute: . ~/doit.sh
Execute: . ~/doit.sh
Execute: . ~/doit.sh
Execute: . ~/doit.sh
Execute: . ~/doit.sh
Execute: . ~/doit.sh
Execute: . ~/doit.sh
Execute: . ~/doit.sh
Execute: . ~/doit.sh
Execute: . ~/doit.sh
Sure enough, the script gets called 10 times in a row. Is there something going on here I'm completely missing?
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC workflow using "--def exec"

Post by rednoah »

Thanks for the post! Before a real human comes by, please make sure your report has all the following points checked:
  • What are you trying to do achieve? What's not working? What have you tried so far?
  • Include screenshots, logs or filenames (i.e. demonstrate the issue)
  • Include basic information (i.e. sysinfo output)
:idea: Please read How to Request Help and Fix Problems, Report Bugs, Get Features
:idea: Please read the FAQ and How to Request Help.
Post Reply