User:Cactus/ScriptForDvdBackup

From ArchWiki
Jump to navigation Jump to search

Requirements: Wine, libdvdcss, libdvdread

Download and install DVDShrink 3.1 from http://www.afterdawn.com/software/video_software/dvd_rippers/dvd_shrink.cfm:

$ unzip dvdshrink*.zip
$ wine dvdshrink*.exe

You also need to find dvdbackup.c and compile it

$ gcc -o dvdbackup -ldvdread dvdbackup.c

And for simplicity's sake make a batch script to have wine run DVDShrink 3.1

wine_dvdshrink
#!/bin/bash
wine "$HOME/.wine/drive/c/Program Files/DVD Shrink/DVD Shrink 3.1.exe"

Almost everything is in place just need to move some files around

$ chmod 755 dvdbackup
$ chmod 755 wine_dvdshrink
# mv dvdbackup /usr/bin/
# mv wine_dvdshrink /usr/bin/

All done now except for the actual script which does all of the work. Copy and paste this into a new file and chmod it executable. Then just run this script and follow the prompts. The first few lines define variables so you can adjust what drive you want to read, burn and where you want to store the temporary VOB files.

#!/bin/bash

# setup for reader and directories
TheDVDReader="/dev/cdroms/cdrom1"
TheRIPFolder="/mnt/extrahdd/dvd_backups/"
TheDVDBurner="/dev/cdroms/cdrom0"

# Most likely you do not need to edit the "MOVIE=" line
MOVIE=$(dvdbackup -i $TheDVDReader -I 2> /dev/null || grep "DVD-Video information" || sed -e 's/.* //g')

user_query() {
  case "$ready" in
    [nN])
      echo "Cancelled, exiting.."
      exit 0
      ;;
    *)
      ;;
  esac
}

clear
echo "################## $MOVIE #######################"
echo "Are you ready to start copying the DVD to disk [[Y/n]]?"

read ready
user_query

dvdbackup -M -i $TheDVDReader -o $TheRIPFolder

clear
echo "################## $MOVIE #######################"
echo "DVDShrink will now run under wine."
echo "Make whatever changes you need to and"
echo "save your iso as z:\$TheRIPFolder/$MOVIE.ISO"

wine_dvdshrink

clear
echo "################## $MOVIE #######################"
echo "Hit return when you are ready."
echo "All files will be deleted except for your .iso"
echo " "
echo "Also make sure to  insert a blank DVD into your writer now."

read ready
user_query

#delete temp files since now we have a .iso
rm -rf "$TheRIPFolder/$MOVIE"

growisofs -dvd-compat -Z $TheDVDBurner=$TheRIPFolder/$MOVIE.ISO

clear
echo "################## $MOVIE #######################"
echo "Would you like to delete the .iso at this time? [[Y/n]]"

read ready
user_query

rm -f "$TheRIPFolder/$MOVIE.ISO"