DVDBackupExpress (v0.7)

DVDBackupExpress is a script to automate the process of backing up an entire DVD-Video disc (minus the data content that may be on there). The script will convert the DVD into a *.iso file.

Requirements:

  • dvdbackup
  • Linux
  • libdvdcss
  • mkisofs

Code:

#!/bin/bash
DEVICEPATH="/dev/sr0"
BACKUPPATH="${HOME}/Desktop"
TMP="${TMPDIR}"
LOG="${HOME}/.DVDBackupExpress.log"

##Write Date & Time to Log File
echo "-------------------------------------" > "${LOG}"
echo "`date +%B %d, %Y`" >> "${LOG}"
echo "-------------------------------------" >> "${LOG}"

echo "DVDBackupExpress"
echo "Scripted by Blake Johnson"
echo "http://www.blakeanthonyjohnson.com/"
echo



echo -n "Getting DVD Information... "

label=`dvdbackup -I -i "${DEVICEPATH}" | grep DVD-Video` >> "${LOG}" 2>&1
if [ $? == 0 ]
then
	echo -n -e "33[1;32mOK!"
	echo -e "33[0m"
	label=${label:43}
else
	echo -n -e "33[1;31mFailed!"
	echo -e "33[0m"
	##echo "Unable to get DVD information."
	echo "Press any key to exit."
	read
	exit
fi

echo "The title detected was: "${label}""
echo
echo "If you would like to change the title of your DVD image, please do so now.  Otherwise, leave it blank."
echo -n "New Title: "
read title

if [ -z $title  ]
then
	title=${label}
fi

echo
echo "The DVD image will be labeled "${title}.iso" and will be placed in "${BACKUPPATH}/"."
echo
echo "Press any key to continue, or get out and try again."
echo "If you continue, the next two steps may take a while to complete, which is normal."
read
echo
echo -n "Decrypting DVD-Video to "${TMP}/${label}/"... "

dvdbackup -M -v 9 -i "${DEVICEPATH}" -o "${TMP}" >> "${LOG}" 2>&1
if [ $? == 0 ]
then
	echo -e -n "33[1;32mOK!"
	echo -e "33[0m"
else
	echo -e -n "33[1;31mFailed!"
	echo -e "33[0m"
	##echo "An error occured while decrypting."
	echo "Press any key to exit."
	read
	exit
fi

echo -n "Creating DVD image from "${TMP}/${label}/"... "
mkisofs -dvd-video -V "${label}" -o "${BACKUPPATH}/${title}.iso" "${TMP}/${label}/" >> "${LOG}" 2>&1
if [ $? == 0 ]
then
	echo -n -e "33[1;32mOK!"
	echo -e "33[0m"
else
	echo -n -e "33[1;31mFailed!"
	echo -e "33[0m"
	##echo "An error occured while creating a DVD image."
	echo "Press any key to exit."
	read
	exit
fi

echo -n "Removing temporary files from "${TMP}/${label}/"... "
rm -R "${TMP}/${label}/" >> "${LOG}" 2>&1
if [ $? == 0 ]
then
	echo -n -e "33[1;32mOK!"
	echo -e "33[0m"
else
	echo -n -e "33[1;31mFailed!"
	echo -e "33[0m"
	##echo "An error occured while removing temporary files."
	echo "Press any key to exit."
	read
	exit
fi
echo
echo "All Finished."
read
rm "${LOG}"
exit 0

Leave a Reply

Your email address will not be published.