r128x icon indicating copy to clipboard operation
r128x copied to clipboard

Not possible to pipe output to file

Open Arve opened this issue 8 years ago • 5 comments

Since the tool is printing progress as it is analyzing, you can't pipe the output from r128x-cli to a file, thus output like:

r128x *.m4a > logfile.txt

… will produce output looking like the attached screenshot - full of progress data, and every once in a while, a line with the actual output.

image

Arve avatar May 26 '17 19:05 Arve

This can probably be solved by printing the progress indicator on stderr instead of stdout.

Unfortunately, changing

printf("%3d%% \n\033[F\033[J", (int)(ratio));

into

fprintf(stderr, "%3d%% \n\033[F\033[J", (int)(ratio));

does not print any progress on the terminal.

Still searching.

audionuma avatar May 27 '17 08:05 audionuma

How about adding --no-progress as a command line argument, so that it doesn't print anything on stdout except the header and then the completed result? That would solve the issue for anyone wanting to run this on large batches of files, while preserving the progress indicator for those merely wanting to check a single folder/file.

Arve avatar May 28 '17 13:05 Arve

Hello, here's a test that sends progress on stderr, therefore allowing redirection of output to text file without garbage. (See branch https://github.com/audionuma/r128x/tree/progress-on-stderr ) Here's a binary : https://www.dropbox.com/s/c3cque7875jmpbg/r128x-cli-test-progress.zip?dl=0 Let me know if it does solve your issue and doesn't behave badly.

audionuma avatar May 30 '17 13:05 audionuma

Thank you - it solves my issue quite nicely (but the --no-progress solution I proposed is probably cleaner from a UNIX standpoint, in case someone runs this in scripts, and redirects stderr to a log somewhere.

Arve avatar May 31 '17 13:05 Arve