typeset aspect=""
typeset SCALE=""
typeset CROP=""
+typeset -i keep_isofile=0
+typeset -i keep_vobfile=0
+typeset -i keep_dvdfolder=0
typeset -i keep_intermediate_files=0
typeset -i make_final_dest_vob=0
typeset -i make_final_dest_iso=0
echo >&2 " 2) If dvdname exists in $tmpdir, it will be ripped as a DVD instead of $dev"
echo >&2 " 3) If dvdname is a full path to a DVD folder, it will be ripped as a DVD instead of $dev"
echo >&2 " 4) If dvdname is a full path to an MPG2 file, it will be ripped as a DVD instead of $dev"
+ echo >&2 " 5) If dvdname is a full path to an ISO file, it will be ripped as a DVD instead of $dev"
echo >&2 " -m Make a mirror image of the DVD and save it as a DVD ISO file"
echo >&2 " The default operation is non-mirror mode where only the main"
echo >&2 " feature title will be ripped."
if [ -d "$dvdname" ]; then
dvdpath="$dvdname"
dvdname=`basename "$dvdname"`
+ keep_dvdfolder=1
if [ -z "$dvdname" ]; then
echo "-E- Unable to extract dvdname from path: $dvdpath"
exit 1
exit 1
fi
fi
- # check to see if dvdname is a full path to an MPG2 (VOB) file
- # if it is, set dvdname and vobfile appropriately
+
+ # Check to see if dvdname is a full path to a file
if [ -f "$dvdname" ]; then
- vobfile="$dvdname"
- dvdname=`basename "$dvdname"`
- file "$vobfile" | grep -q "MPEG"
+ valid_file=0
+
+ # check to see if dvdname is a full path to an MPG2 (VOB) file
+ # if it is, set dvdname and vobfile appropriately
+ file "$dvdname" | grep -q "MPEG"
if [ $? == 0 ]; then
# It is a valid MPEG2 file, now strip the extension off our dvdname
+ vobfile="$dvdname"
+ dvdname=`basename "$dvdname"`
+ dvdname=${dvdname%.[^.]*}
+ keep_vobfile=1
+ valid_file=1
+ fi
+
+ # check to see if dvdname is a full path to an ISO file
+ # if it is, set dvdname and isofile appropriately
+ file "$dvdname" | grep -q "ISO"
+ if [ $? == 0 ]; then
+ # It is a valid ISO file, now strip the extension off our dvdname
+ isofile="$dvdname"
+ dvdname=`basename "$dvdname"`
dvdname=${dvdname%.[^.]*}
- else
+ keep_isofile=1
+ valid_file=1
+ fi
+
+ # If we didn't find a handler for the file above, complain
+ if [ $valid_file -eq 0 ]; then
echo "-E- Unsupported file type: $vobfile"
exit 1
fi
fi
}
+# remove the intermediate VOB file
function remove_intermediate_vob_file {
- # remove the intermediate VOB file
if [ $keep_intermediate_files -eq 0 ]; then
[[ -e "$tmpdir/$dvdname.VOB" ]] && rm -f "$tmpdir/$dvdname.VOB"
else
fi
}
+# remove the original DVD image
function remove_intermediate_iso_file {
- # remove the original DVD image
+ [[ $keep_isofile -eq 1 ]] && return 1
if [ $keep_intermediate_files -eq 0 ]; then
[[ -e "$isofile" ]] && rm "$isofile"
else
fi
}
+# remove the intermediate dvdbackup folder
function remove_intermediate_dvdbackup_folder {
if [ $keep_intermediate_files -eq 0 ]; then
[[ -d "$tmpdir/$dvdname" ]] && rm -rf "$tmpdir/$dvdname"
done
if [ $keep_intermediate_files -eq 0 ] && [ $make_final_dest_vob -eq 0 ]; then
- [[ -e "$vobfile" ]] && rm -f "$vobfile";
+ [[ -e "$vobfile" ]] && [[ $keep_vobfile -eq 0 ]] && rm -f "$vobfile";
[[ -e "$passlogfile" ]] && rm -f "$passlogfile";
else
echo "-> Keeping VOB file: $vobfile" | tee -a "$logfile"