projects
/
rip_dvd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8dce69d
)
Added ability to deal with iso files given via the -n option
author
Alan J. Pippin
<ajp@pippins.net>
Wed, 20 May 2009 22:14:53 +0000
(16:14 -0600)
committer
Alan J. Pippin
<ajp@pippins.net>
Wed, 20 May 2009 22:14:53 +0000
(16:14 -0600)
rip_dvd
patch
|
blob
|
history
diff --git
a/rip_dvd
b/rip_dvd
index 9a6d47110ddd90d66c24633d998114f3f3f8d6bc..c47fd59772b2c7521e2c15b37950a3e97ee45807 100755
(executable)
--- a/
rip_dvd
+++ b/
rip_dvd
@@
-48,6
+48,9
@@
typeset dvdpath=""
typeset aspect=""
typeset SCALE=""
typeset CROP=""
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
typeset -i keep_intermediate_files=0
typeset -i make_final_dest_vob=0
typeset -i make_final_dest_iso=0
@@
-98,6
+101,7
@@
function usage() {
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 " 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."
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."
@@
-201,6
+205,7
@@
else
if [ -d "$dvdname" ]; then
dvdpath="$dvdname"
dvdname=`basename "$dvdname"`
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
if [ -z "$dvdname" ]; then
echo "-E- Unable to extract dvdname from path: $dvdpath"
exit 1
@@
-210,16
+215,37
@@
else
exit 1
fi
fi
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
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
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%.[^.]*}
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
echo "-E- Unsupported file type: $vobfile"
exit 1
fi
@@
-763,8
+789,8
@@
function fill_mythvideo_metadata {
fi
}
fi
}
+# remove the intermediate VOB file
function remove_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
if [ $keep_intermediate_files -eq 0 ]; then
[[ -e "$tmpdir/$dvdname.VOB" ]] && rm -f "$tmpdir/$dvdname.VOB"
else
@@
-772,8
+798,9
@@
function remove_intermediate_vob_file {
fi
}
fi
}
+# remove the original DVD image
function remove_intermediate_iso_file {
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
if [ $keep_intermediate_files -eq 0 ]; then
[[ -e "$isofile" ]] && rm "$isofile"
else
@@
-781,6
+808,7
@@
function remove_intermediate_iso_file {
fi
}
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"
function remove_intermediate_dvdbackup_folder {
if [ $keep_intermediate_files -eq 0 ]; then
[[ -d "$tmpdir/$dvdname" ]] && rm -rf "$tmpdir/$dvdname"
@@
-982,7
+1010,7
@@
if [ $mirror_mode -eq 0 ]; then
done
if [ $keep_intermediate_files -eq 0 ] && [ $make_final_dest_vob -eq 0 ]; then
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"
[[ -e "$passlogfile" ]] && rm -f "$passlogfile";
else
echo "-> Keeping VOB file: $vobfile" | tee -a "$logfile"