Skip to content

Instantly share code, notes, and snippets.

@danhigham
Last active December 31, 2015 03:09
Show Gist options
  • Save danhigham/7925803 to your computer and use it in GitHub Desktop.
Save danhigham/7925803 to your computer and use it in GitHub Desktop.
Bash script to sit in a loop and continuously rip vobs from a DVD. When it's done a disk it sends a notification email, ejects the draw and waits for another disc.
#!/usr/bin/env bash
SUBJECT="DVD is done ripping"
EMAIL="email@gmail.com"
EMAILMESSAGE="./emailmessage.txt"
while [ 1 ]
do
echo "Waiting for new disk.."
while [[ `udisks --show-info /dev/sr0 | grep -c "has media: *1"` == "0" ]]
do
blah="blah"
done
label=`udisks --show-info /dev/sr0 | grep -Po "label:\s+[^\s]+" | grep -Po "[^\s]+$"`
echo "Your DVD '$label' has finished ripping "> $EMAILMESSAGE
mount /dev/sr0 /home/pi/dvdrom
vobcopy -l -o /home/pi/storage/dvd-rips/
/usr/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
umount /dev/sr0
eject
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment