AMC script - send email on conflict or error

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
despian
Posts: 15
Joined: 05 Oct 2016, 01:47

AMC script - send email on conflict or error

Post by despian »

I'm running the AMC script and use the the option "--conflict skip". I also use the email option to send notifications when files are processed.

My problem is that an email is only sent when files are successfully processed. Is there a configuration option to send emails when something is skipped or the process failed for some other reason?
User avatar
rednoah
The Source
Posts: 23924
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC script - send email on conflict or error

Post by rednoah »

rednoah wrote:--def reportError=y Report errors via email
That might help you report errors, but it probably won't report ignored files.

You can check the exit code of the amc script then send your own emails though. The amc script will return with exit code 0 only if at least one file has been processed successfully.
:idea: Please read the FAQ and How to Request Help.
despian
Posts: 15
Joined: 05 Oct 2016, 01:47

Re: AMC script - send email on conflict or error

Post by despian »

Great, thank you.
despian
Posts: 15
Joined: 05 Oct 2016, 01:47

Re: AMC script - send email on conflict or error

Post by despian »

I wrote a little script to send an email when amc doesn't return 0 but on testing it seems that defining "reportError=y" actually does send a message when the script exits without processing any files. However, the message simply contains:
Finished without processing any files
Would it be possible to have the message contain a few more details? E.g. The path/s that was/were passed to the script.
User avatar
rednoah
The Source
Posts: 23924
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC script - send email on conflict or error

Post by rednoah »

The output does contain all the information you seek. You just happen to be looking at the last line of the output. You can capture the whole output and then grep the lines you want.
:idea: Please read the FAQ and How to Request Help.
despian
Posts: 15
Joined: 05 Oct 2016, 01:47

Re: AMC script - send email on conflict or error

Post by despian »

I think maybe you misunderstood what I meant. I was saying the the default functionality of the amc script already sends an email if no files were processed, but the email doesn't contain any details just a message saying "Finished without processing any files".

I think this commit demonstrates what I meant when I asked if it was possible to include the path/s that was/were passed to the script in the email message:

https://github.com/despian/scripts/comm ... 0f1c99a648

I also noticed that a mail was not sent at all if an invalid path is passed to the script so I added a line to do that.

I'm using this forked version of the amc script on my setup now and it is working the way I wanted it to. If I were to submit a pull request for these changes would you consider merging them with the upstream version of amc?
User avatar
rednoah
The Source
Posts: 23924
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC script - send email on conflict or error

Post by rednoah »

I'm not particularly interested in any changes in email reporting. Doing it inside the script itself was never a good idea, and it only exists because sending email via Windows CMD is an even worse idea. :lol:

On Linux, I'd to it properly:

Code: Select all

filebot -script fn:sysinfo 2>&1 | mail -s "this is the subject" "to@address"
:idea: Please read the FAQ and How to Request Help.
Post Reply