From: Alan J. Pippin Date: Sun, 3 Feb 2013 02:40:53 +0000 (-0700) Subject: Added new eject_opts option for greater flexibility. X-Git-Url: http://git.pippins.net/embedvideo/.git/%22%22.%24thumbnail.%22/%7Blink_visit%7D?a=commitdiff_plain;h=45018d64564d7e4c97ac3f796c7cff7e4db49efd;p=rip_dvd%2F.git Added new eject_opts option for greater flexibility. Fixed auto title naming algorithm. --- diff --git a/rip_dvd b/rip_dvd index 3b846fb..8a8c2fa 100755 --- a/rip_dvd +++ b/rip_dvd @@ -48,6 +48,7 @@ typeset mkvpropedit="" typeset mkvmerge="" typeset mp4box="" typeset dvdxchap="" +typeset eject_opts="-T" typeset -i default_aid=128 typeset -i aid_override=-1 typeset -i force_onepass_mode=0 @@ -1151,11 +1152,20 @@ function make_dvd_mkv_image { echo "\n" | tee -a "$ddrescuelog" dstfile=${dstmkv%.[^.]*} typeset -i num=0 + typeset -i titles=0 for i in `/bin/ls -1 "$dstdir"/*.mkv`; do - echo -e " Moving $i -> $dstfile.$num.mkv" | tee -a "$ddrescuelog" - mv "$i" "$dstfile.$num.mkv" - ((num = num + 1 )) + ((titles = titles + 1)) done + if [[ $titles > 1 ]]; then + for i in `/bin/ls -1 "$dstdir"/*.mkv`; do + echo -e " Moving $i -> $dstfile.$num.mkv" | tee -a "$ddrescuelog" + mv "$i" "$dstfile.$num.mkv" + ((num = num + 1 )) + done + else + echo -e " Moving $dstdir/*.mkv -> $dstfile.mkv" | tee -a "$ddrescuelog" + mv "$dstdir"/*.mkv "$dstfile.mkv" + fi echo "\n" | tee -a "$ddrescuelog" fi @@ -1835,14 +1845,27 @@ if [ $mirror_mode -eq 1 ]; then if [[ "$ripper" == "makemkv" ]]; then # use makemkv to make an MKV file of the disk make_dvd_mkv_image "$tmpdir/$dvdname.mkv" "disc" "$makemkv_disc_id" - echo " Moving $tmpdir/$dvdname.mkv -> $dest/$dvdname.mkv" - mv "$tmpdir/$dvdname.mkv" "$dest/$dvdname.mkv" + # move the ripped movies into place + typeset -i num=0 + for i in `/bin/ls -1 "$tmpdir/$dvdname"*.mkv`; do + if [[ "$i" =~ .[[:digit:]].mkv ]]; then + finaldest="$dest/$dvdname.$num.mkv" + else + finaldest="$dest/$dvdname.mkv" + fi + while [[ -e "$finaldest" ]]; do + ((num = num + 1 )) + finaldest="$dest/$dvdname.$num.mkv" + done + echo " Moving $i -> $finaldest" + mv "$i" "$finaldest" + done # add this video data to the mythtv DB fill_mythvideo_metadata "$dest_filename" else # use ddrescue to make an ISO image of the disk make_dvd_iso_image "$tmpdir/$dvdname.iso" - echo " Moving $tmpdir/$dvdname.mkv -> $dest/$dvdname.mkv" + echo " Moving $tmpdir/$dvdname.iso -> $dest/$dvdname.iso" mv "$tmpdir/$dvdname.iso" "$dest/$dvdname.iso" # add this video data to the mythtv DB fill_mythvideo_metadata "$dest_filename" @@ -1850,7 +1873,7 @@ if [ $mirror_mode -eq 1 ]; then # eject the disk upon completion if [ $eject_disk -ne 0 ]; then - eject -T $dev + eject $eject_opts $dev fi date=`date` @@ -1970,7 +1993,7 @@ if [ $mirror_mode -eq 0 ]; then fi # eject the DVD disk since we are finished with it - [ $eject_disk -eq 2 ] && eject -T $dev + [ $eject_disk -eq 2 ] && eject $eject_opts $dev # encode the VOB file to a compressed file format if [ $make_final_dest_comp -eq 1 ]; then @@ -2056,7 +2079,7 @@ if [ $mirror_mode -eq 0 ]; then remove_intermediate_dvdbackup_folder # eject the DVD disk upon completion - [ $eject_disk -eq 1 ] && eject -T $dev + [ $eject_disk -eq 1 ] && eject $eject_opts $dev date=`date` echo "$date DVD rip completed" | tee -a "$logfile" diff --git a/rip_dvd.conf.dist b/rip_dvd.conf.dist index 808ee25..a9c865a 100644 --- a/rip_dvd.conf.dist +++ b/rip_dvd.conf.dist @@ -28,6 +28,9 @@ mailto=root # Setup the path to the tools needed by this ripper PATH=/etc/mythtv/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/usr/share/tovid:.:$PATH +# Specify the options to use with the eject command +eject_opts="-T" + # Use mplayer dumpstream to create the main VOB file # If set to 0, cat and other utils will be used to make it instead. # Using mplayer dumpstream is by far the best way to create the main VOB file