dvdrip: Prepare the `dest' file early, so that it can be edited.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 19 Feb 2022 19:06:25 +0000 (19:06 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 19 Feb 2022 19:06:25 +0000 (19:06 +0000)
dvdrip

diff --git a/dvdrip b/dvdrip
index 5c1e72b..250e642 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
@@ -162,7 +169,6 @@ case $backup in
     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