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
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
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"
# eject the disk upon completion
if [ $eject_disk -ne 0 ]; then
- eject -T $dev
+ eject $eject_opts $dev
fi
date=`date`
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
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"