views:

153

answers:

2

I am currently encoding a lot of home videos converted from VHS tapes using Handbrake. I am using Ubuntu 64bit dual core machine and usually queue a lot of these videos. My question is how can I use shell scripting to keep checking on the handbrake process and send me an email when Handbrake finishes encoding a video file.

One idea was to look at the handbrake log but the standard log level does not provide much information, does anyone have any other ideas?

+2  A: 

Use handbrake's CLI client in a shell script and have it email you at the end.

Something like this:

#/bin/sh
handbrake -i /dev/mydev -o myfile > out.txt
handbrake -i /dev/mydev2 -o myfile2 >> out.txt
handbrake -i /dev/mydev3 -o myfile3 >> out.txt
mail -s "done with handbrake" [email protected] < out.txt
Stu Thompson
+1  A: 

Alternatively, if you want things to remain flexible, you don't even need to write a script. You can simply write the commands mentioned in Stu Thompson's answer directly on the command line. Just remember to separate them with the symbol '&&'.

Say:

handbrake -i /dev/mydev -o myfile > out.txt && handbrake -i /dev/mydev2 -o myfile2 >> out.txt && handbrake -i /dev/mydev3 -o myfile3 >> out.txt && mail -s "done with handbrake" [email protected] < out.txt

This gives you the flexibility to invoke your app any way you like instead of being stuck with whatever you wrote in the script.

By the way, as you can figure out yourself, issuing any two commands separated by '&&' on the command line means: run the first command and if it completes successfully, run the second command.

Frederick