Filebot exit code

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
yotamoo
Posts: 1
Joined: 10 Oct 2014, 14:01

Filebot exit code

Post by yotamoo »

Hi there,
I am running this little script, invoked by Deluge upon download completion:

Code: Select all

#!/bin/bash
TORRENT_ID=$1
TORRENT_NAME=$2
TORRENT_PATH=$3
LOG_FILE="${HOME}/deluge-postprocess.log"

filebot -script fn:amc --output "$HOME/Videos" --log-file amc.log --action move --conflict override -non-strict --def artwork=n subtitles=en,he "ut_dir=$TORRENT_PATH/$TORRENT_NAME" "ut_kind=multi" "ut_title=#$TORRENT_NAME" &>> "${LOG_FILE}"

rm -frv "/$TORRENT_PATH/$TORRENT_NAME" &>> "${LOG_FILE}"
As you can see, after Filebot renames and moves the movie/tvshow file, I delete the leftover files. Problem is, sometimes Filebot does not recognize TORRENT_NAME, and so it does not move it and I end up deleting it.

I tried retrieving ?$ - Filebot's exit code - but it is always 0. How can I tell if Filebot succeeded in renaming or not?

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

Re: Filebot exit code

Post by rednoah »

Error code works:

Code: Select all

$ filebot -script "g:die('thats why')"
thats why
Failure (°_°)
$ echo $?
255
If $TORRENT_NAME is not defined and you somehow pass in a bad path then I don't know what happens. It should fail, but maybe it "succeeds" at not doing anything. In any case, if $TORRENT_NAME might be bad, then check that in the bash script beforehand. ;)
:idea: Please read the FAQ and How to Request Help.
Post Reply