+
+ # 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" 1
+ fi
+}
+
+function make_dvd_iso_image_from_folder {
+
+ src="$1"
+ dst="$2"
+ handle_error=$3
+
+ 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"
+
+ # set the audio languages from the iso if it exists and is non-zero in size
+ if [ -s "$dst" ]; then
+ get_feature_title "$dst"
+ get_audio_id_from_iso "$dst"
+ fi
+
+ # make sure we were able to create the iso image from the folder given to us
+ if [ ! -s "$dst" ] && [ $handle_error -eq 1 ]; then
+ echo "-> Unable to make an iso image from the DVD folder: $dvdpath"
+ echo " Falling back to mplayer to create a main feature VOB from the folder instead: $dvdpath"
+ # remove the bad iso file
+ [[ -e "$dst" ]] && rm -f "$dst"
+ # get the feature title from the DVD folder
+ get_feature_title "$dvdpath"
+ # create our main VOB file from the ISO
+ create_main_vob_with_mplayer "$dvdpath"
+ # get our audio id from the VOB file
+ get_audio_id_from_vob "$vobfile"