I have a lot of DVDs (Movies) that I want to save as an .iso preferably using dd
. To speed up the process I have two drives.
I'd like to set up a script (pure bash or bash + AppleScript combination) that runs on insert. macOS allows to configure a script in Settings › CDs & DVDs › On insert…
The process should look like this:
- Insert DVD in one of the two drives
- Script starts and checks which drive triggered the command (hardest part for me)
- Opens a Terminal window and runs the actual script
A rough draft of what my idea is:
#!/bin/bash
diskutil umountDisk /dev/THEDRIVE
echo -n `date "+%Y-%m-%d - %H:%M:%S -> Starting with DISCTITLE"` >> iso.log
dd if=/dev/THEDRIVE | pv -s DRIVESIZE | dd of=/myfolder/DISCTITLE.iso
echo -n `Finished DISCTITLE, took TIME. Ejecting.`
drutil tray eject -drive DRIVENUMBER
- Close the Terminal window after ejecting
UnmountDisk for dd
, write to log, copy with status using pv
, write to log again and eject the disc after finishing.
What I don't know is how I get the part with the two drives right. And set up the script so that it handles it right.
drutil status
tells size and device. mount
tells the name. But I have, of course, always both drives present.
How could I use e.g. awk
or sed
to get device/mountpoint, disc title, size and drivenumber (to eject the right one) of the current disc?
dd
with VLC. I thought about the copy protection too, but my first attempt did just work.dd
bypasses the problem by nature?