[Pkg-opt-media-team] Bug#589112: cdparanoia: add an option to not suppress progress bar when stderr is redirected

Frank Heckenbach f.heckenbach at fh-soft.de
Wed Jul 14 23:19:14 UTC 2010


Package: cdparanoia
Version: 3.10.2+debian-9
Severity: wishlist

*** Please type your report below this line ***

The output of cdparanoia includes some "boilerplate" lines (ripping
from ... to, outputting to ...) and the progress bar. To me only the
progress bar is interesting because it contains info, e.g. about
scratches and other problems, so I'd like to see the bar after it's
done.

When I run cdparanoia for a number of tracks, usually a whole CD
(and I call it individually for each track, sending its output to
oggenc directly), the output from the first few tracks will be
scrolled away already at the end.

Normally, I'd just redirect it to a file, or view it with "less", or
grep out the uninteresting lines. But cdparanoia prevents this,
since it suppresses the progress bar when stderr is redirected
(i.e., not a terminal). Also the option "-q" doesn't help, since it
suppressed both the progress bar and the other lines.

It would probably be possible to work around it with an expect
script or so, allocating a pseudo terminal, but that seems quite
messy.

In contrast, adding an option to cdparanoia to show the progress bar
even if stderr is redirected is quite simple. The patch below
(tested) does this. I've implemented it so that it can be combined
with "-q", in which case only the progress bar is shown (which is
what I prefer), or without "-q", so everything appears (what others
might want to redirect/page the whole output).

--- cdparanoia-3.10.2+debian/main.c	2008-09-11 23:11:02.000000000 +0200
+++ cdparanoia-3.10.2+debian/main.c	2010-07-12 22:10:07.000000000 +0200
@@ -213,6 +213,8 @@
 "  -q --quiet                      : quiet operation\n"
 "  -e --stderr-progress            : force output of progress information to\n"
 "                                    stderr (for wrapper scripts)\n"
+"  -E --progress                   : force output of progress bar even if\n"
+"                                    stderr is not a terminal\n"
 "  -l --log-summary [<file>]       : save result summary to file, default\n"
 "                                    filename cdparanoia.log\n"
 "  -L --log-debug   [<file>]       : save detailed device autosense and\n"
@@ -338,6 +340,7 @@
 long callbegin;
 long callend;
 long callscript=0;
+long force_progress_bar=0;
 
 static char *callback_strings[16]={"wrote",
                                    "finished",
@@ -404,13 +407,13 @@
     }
   }
 
-  if(!quiet){
+  if(force_progress_bar || !quiet){
     long test;
     osector=inpos;
     sector=inpos/CD_FRAMEWORDS;
     
     if(printit==-1){
-      if(isatty(STDERR_FILENO)){
+      if(force_progress_bar || isatty(STDERR_FILENO)){
 	printit=1;
       }else{
 	printit=0;
@@ -604,10 +607,11 @@
     memset(dispcache,' ',graph);
 }
 
-const char *optstring = "escCn:o:O:d:g:k:S:prRwafvqVQhZz::YXWBi:Tt:l::L::A";
+const char *optstring = "eEscCn:o:O:d:g:k:S:prRwafvqVQhZz::YXWBi:Tt:l::L::A";
 
 struct option options [] = {
 	{"stderr-progress",no_argument,NULL,'e'},
+	{"progress",no_argument,NULL,'E'},
 	{"search-for-drive",no_argument,NULL,'s'},
 	{"force-cdrom-little-endian",no_argument,NULL,'c'},
 	{"force-cdrom-big-endian",no_argument,NULL,'C'},
@@ -783,6 +787,9 @@
       callscript=1;
       fprintf(stderr,"Sending all callbacks to stderr for wrapper script\n");
       break;
+    case 'E':
+      force_progress_bar=1;
+      break;
     case 'V':
       fprintf(stderr,VERSION);
       fprintf(stderr,"\n");





More information about the Pkg-opt-media-team mailing list