dvd-sector-copy.c (report_progress): Fiddle with the averaging parameter.
[dvdrip] / dvdrip
diff --git a/dvdrip b/dvdrip
index 5c1e72b..ad7a280 100755 (executable)
--- a/dvdrip
+++ b/dvdrip
@@ -128,6 +128,13 @@ accumulate_badblocks () {
 }
 
 mkdir -p "$tmp/$tag"
+any=nil
+for i in "$tmp/$tag/dest.new" "$tmp/$tag/dest" "$tmp/$tag/dest.seen"; do
+  if [ -f "$tmp/$tag/dest.new" ]; then any=t; fi
+done
+case $any in
+  nil) printf "%s\n" "${sub+$sub/}$out.iso" >"$tmp/$tag/dest.new" ;;
+esac
 case $backup in
   t)
     if [ ! -d "$tmp/$tag/rip" ]; then
@@ -144,25 +151,16 @@ case $backup in
   nil)
     if [ ! -f "$tmp/$tag/iso" ]; then
       accumulate_badblocks
-      run_setrc "$DVD_SECTOR_COPY" -c -b"$tmp/$tag/badblocks.new" \
-               "$dev" "$tmp/$tag/iso.new"
+      run "$DVD_SECTOR_COPY" -c -b"$tmp/$tag/badblocks.new" \
+         "$dev" "$tmp/$tag/iso.new"
+      run mv "$tmp/$tag/iso.new" "$tmp/$tag/iso"
       accumulate_badblocks
-      case $rc in
-       0)
-         run mv "$tmp/$tag/iso.new" "$tmp/$tag/iso"
-         ;;
-       1)
-         run mv "$tmp/$tag/iso.new" "$tmp/$tag/iso"
-         fail "bad sectors found: check \`$tmp/$tag/iso', run again if ok"
-         ;;
-       *)
-         fail "$DVD_SECTOR_COPY: exit $rc"
-         ;;
-      esac
+      if [ -f "$tmp/$tag/badblocks" ]; then
+       fail "bad sectors found: check \`$tmp/$tag/iso', run again if ok"
+      fi
     fi
     ;;
 esac
-printf "%s\n" "${sub+$sub/}$out.iso" >"$tmp/$tag/dest.new"
 mv "$tmp/$tag/dest.new" "$tmp/$tag/dest"
 run "$DVDRIP_UPLOAD"
 case $eject in t) run eject "$dev" ;; esac