+
+ # check to see if we have a dvdpath to rip from instead of $dev
+ if [ -z "$dvdpath" ]; then
+ # load the CSS codes in the DVD drive
+ lsdvd $dev >> "$logfile"
+ if [ $? != 0 ]; then
+ fatal_and_exit "-E- lsdvd $dev failed"
+ fi
+
+ # read the DVD, ignoring/skipping CRC errors
+ ddrescue -n -b 2048 $dev "$isofile" "$ddrescuelog"
+ if [ $? != 0 ]; then
+ fatal_and_exit "-E- ddrescue -n -b 2048 $dev \"$isofile\" failed"
+ fi
+ cat "$ddrescuelog" >> "$logfile"
+ else
+ # rip from a path instead
+ make_dvd_iso_image_from_folder "$dvdpath" "$isofile"
+ if [ ! -s "$isofile" ]; then
+ fatal_and_exit "-E- Unable to make an iso image from the DVD folder: $dvdpath"
+ fi
+ fi
+}
+
+function make_dvd_iso_image_from_folder {
+
+ src="$1"
+ dst="$2"
+
+ echo "-> Creating ISO image of DVD video: $src -> $dst" | tee -a "$logfile"
+
+ # make an iso image out of our directory
+ echo " mkisofs -dvd-video \"$src\" 2>> \"$dumplog\" | dd of=\"$dst\" obs=32k seek=0 > /dev/null 2>> $dumplog" >> "$logfile"
+ mkisofs -dvd-video "$src" 2>> "$dumplog" | dd of="$dst" obs=32k seek=0 > /dev/null 2>> "$dumplog"