dvd-sector-copy.c (report_progress): Show a throbber to help gauge speed.
[dvdrip] / dvd-sector-copy.c
index 86540e0..90efce2 100644 (file)
@@ -356,6 +356,9 @@ static struct timeval last_time;
 static double wsum, wcount;
 static struct file *file;
 
+static const char throbber[] = "|<-<|>->";
+static unsigned throbix = 0;
+
 static void report_progress(secaddr pos)
 {
   char etastr[32];
@@ -395,8 +398,9 @@ static void report_progress(secaddr pos)
   if (flags&F_ALLPROGRESS) percent = pos*100.0/limit;
   else percent = ndone*100.0/nsectors;
   print_progress
-    ("copied %.1f%% (%"PRIuSEC" of %"PRIuSEC"; %.1f %sB/s, ETA %s)",
-     percent, pos, limit,  rate, unit, etastr);
+    ("%c copied %.1f%% (%"PRIuSEC" of %"PRIuSEC"; %.1f %sB/s, ETA %s)",
+     throbber[throbix], percent, pos, limit,  rate, unit, etastr);
+  throbix++; if (!throbber[throbix]) throbix = 0;
   if (file && id_kind(file->id) == VOB) {
     append_progress(" -- %s %d %.1f%%",
                    id_part(file->id) ? "title" : "menu",
@@ -512,7 +516,7 @@ static void recovered(secaddr bad_lo, secaddr bad_hi)
   if (mapfile) {
     open_file_on_demand(mapfile, &mapfp, "bad-sector region map");
     fprintf(mapfp, "%"PRIuSEC" %"PRIuSEC"", bad_lo, bad_hi);
-    if (file)
+    if (file && id_kind(file->id) != RAW)
       fprintf(mapfp, " # %s #%d %"PRIuSEC"..%"PRIuSEC" of %"PRIuSEC" (%.1f%%)",
              id_part(file->id) ? "title" : "menu",
              id_title(file->id),
@@ -524,7 +528,6 @@ static void recovered(secaddr bad_lo, secaddr bad_hi)
   }
   if (lseek(outfd, (off_t)(bad_hi - bad_lo)*SECTORSZ, SEEK_CUR) < 0)
     bail_syserr(errno, "failed to seek past bad sectors");
-  status = 1;
 }
 
 struct recoverybuf {
@@ -934,7 +937,7 @@ static int parse_range(const char *p, unsigned f,
     { rc = -1; goto end; }
 
   if (!(f&PRF_HYPHEN)) while (ISSPACE(*p)) p++;
-  if (*p && ((f&PRF_HYPHEN) || *p != '=')) { rc = -1; goto end; }
+  if (*p && ((f&PRF_HYPHEN) || *p != '#')) { rc = -1; goto end; }
 
   rc = 0;
 end: