From f95d0312d13f205bbdc5e30312095c0133f44b36 Mon Sep 17 00:00:00 2001 From: "Alan J. Pippin" Date: Tue, 31 Jan 2012 22:31:51 -0700 Subject: [PATCH] Tweaked makemkv rip logic to only copy back the largest created mkv file --- rip_dvd | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/rip_dvd b/rip_dvd index af108dd..0035a2d 100755 --- a/rip_dvd +++ b/rip_dvd @@ -1164,14 +1164,23 @@ function make_dvd_mkv_image { fatal_and_exit "-E- Unhandled makemkv error" fi - # Move the created MKV file into place - dstfile=${dstmkv%.[^.]*} - typeset -i num=0 - for i in `/bin/ls -1 "$dstdir"/*.mkv`; do - echo -e "\n Moving $i -> $dstfile.$num.mkv" | tee -a "$ddrescuelog" - mv "$i" "$dstfile.$num.mkv" - ((num = num + 1 )) - done + # Move the largest created MKV file into place + # There might be multiple ones, so just grab the largest one + largest_mkv_file=`/bin/ls -rS "$dstdir"/*.mkv | head -1` + echo -e "\n Moving largest mkv file $largest_mkv_file -> $dstmkv\n" | tee -a "$ddrescuelog" + mv "$largest_mkv_file" "$dstmkv" + + # Move all of the created MKV file into place + #echo "\n" | tee -a "$ddrescuelog" + #dstfile=${dstmkv%.[^.]*} + #typeset -i num=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 )) + #done + #echo "\n" | tee -a "$ddrescuelog" + if [ $? != 0 ]; then fatal_and_exit "-E- Unhandled mv error" fi -- 2.34.1