Notification on failure

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Notification on failure

Post by devster »

It might happen, even with non-strict, that some movies aren't matched (e.g. different year in the file compared to TheMovieDB).
Is there a way to have FileBot notify this failure?
I don't think it works with Pushover or similar, they seem to fire only on success.
Should this be something to be checked in the post-process script outside of FileBot?
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Notification on failure

Post by rednoah »

Does --def reportError=y do what you want? I think error reporting only works with email notifications, but not with other custom notifications.

Alternatively, you can do your own error reporting if the filebot call returns a non-zero exit code. That way you can attach the entire console output as well as filebot will have stopped running.
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: Notification on failure

Post by devster »

It would do exactly what I want, but as you mentioned it only does emails.
I'll use that for now, but for the sake of argument, how would the second option you mentioned work?

Code: Select all

# ... restofthescript ...
exit_code=$?
if [ $exit_code -eq 1 ]; then
    echo "Error"
    # whatever else
fi
exit $exit_code
but I'm missing how I can
rednoah wrote: 30 May 2018, 05:09 [...] That way you can attach the entire console output as well as filebot will have stopped running.
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Notification on failure

Post by rednoah »

1.
Run the amc script and redirect the console output to a file.

2.
Check the return code after running the amc script to see if it exited successfully, and if not, do your own error reporting as you see fit.

e.g.

Code: Select all

if filebot -version; then
   echo "FileBot works"
else
   echo "FileBot doesn't work"
fi
:idea: Alternatively, if you're looking for a very specific error condition, then you could check the console output for certain keywords, and then run our own error reporting commands accordingly.



If you're on Linux, then that's bash basics. If you're on Windows, then it's possible with CMD, but probably painful, so best to go with PowerShell. It should be fairly straight forward.
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: Notification on failure

Post by devster »

Does FileBot have specific exit codes for failures besides the Java codes for things like non-existing files or HTTP errors?
From ArgumentProcessor I only seem to understand that it exits 1 on any error and prints an error message depending on the class and stuff (findCause function).
Anyway, main issue is solved so I'll manage with the current solution.
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Notification on failure

Post by rednoah »

The error code indeed only indicates success or failure. The exact nature of the failure is only accessible by skimming the log.

e.g.

Code: Select all

filebot -script fn:sysinfo > stdout.txt 2> stderr.txt

if cat stderr.txt | egrep "DNS|Network|Server"; then
    echo "Some kind of network exception occurred"
fi
:idea: Please read the FAQ and How to Request Help.
Post Reply