Page 1 of 1

Filebot exit code

Posted: 10 Oct 2014, 15:05
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!

Re: Filebot exit code

Posted: 10 Oct 2014, 15:48
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. ;)