I followed http://www.ubuntuforums.org/showthread.php?t=133642 posted by wargames and was able to successfully copy several of my purchased DVD's. I automated the process and wrote a script. So, here is my attempt to make copying a DVD a bit easier. Copy the below text to a new file and name it something like "mydvdbackups.sh" or whatever suits you. Make the new file executable with "chmod a+x filename.sh". I always had problems with dvdbackup until I ran everything as root, then I had no problems copying DVD's. So, it might be a good idea to run this script as root (sudo).
As far as I know, dvdbackup does not do any shrinking. So, a copy of a dual layer DVD movie will need to be burned to a blank dual layer DVD.
#!/bin/bash # # MyDVDBackup script v 0.1 by ardchoille # # you must install dvdbackup from the repository # in order to be able to use this script # # this script copies a dvd movie using dvdbackup # then makes an image of the dvd movie # and, finally, burns the image to a blank dvd # # check to see if this script is being run as root startstring=`date +%c` datadir=/home/mydvdbackup imgdir=/home/mydvdimg if [ $UID -ne 0 ];then echo "You do not have admin privileges to run this script." exit 1 fi # # check for the dvd project folder if [ ! -d $datadir ];then echo "DVD project directory does not exist, creating " $datadir mkdir $datadir fi # # check for the dvd image folder if [ ! -d $imgdir ];then echo "DVD image directory does not exist, creating " $imgdir mkdir $imgdir fi # # get devices dvdreader=`zenity --entry --text="Enter your DVD reader device (ex. /dev/hdc):" --width=300 --title="DVD reader device"` dvdburner=`zenity --entry --text="Enter your DVD burner device (ex. /dev/hdd):" --width=300 --title="DVD burner device"` # # copy the dvd to the data directory dvdbackup -M -i$dvdreader -o$datadir/ # # get the name of the dvd dvdname=`ls $datadir` # # create the AUDIO_TS directory if it doesn't exist if [ ! -d $datadir/$dvdname/AUDIO_TS ];then mkdir $datadir/$dvdname/AUDIO_TS fi # # create the dvd image mkisofs -dvd-video -o $imgdir/$dvdname.img $datadir/$dvdname/ # # go to the directory containing the image cd $imgdir # # burn the image to a blank dvd growisofs -dvd-compat -speed=2 -Z $dvdburner=$dvdname.img stopstring=`date +%c` # # print information about the project echo "MyDVDBackup is complete." echo "MyDVDBackup began: "$startstring echo "MyDVDBackup finished: "$stopstring echo "The DVD movie "$dvdname" has been been copied to the DVD in "$dvdburner echo "The DVD image is located in "$imgdir exit
The only change that I can see anyone needing to make is the 13th line, which reads datadir=/home/mydvdbackup, and change that to where you want the dvd project to be placed.
Todo:
1) I'd like to be able to ask the user if he/she wants to continue with the next step in the process but I don't know how to do that in bash. You can see this in the above three TODO lines.
2) Add additional features.
3) Clean up the code if possible. I tried to comment as best I could without adding too much to the script.
The above script isn't perfect, but it works on my machines. Anyone have any advice to make this script better?
