Dan Thurman wrote:
Patrick O'Callaghan wrote:
On Sat, 2008-09-13 at 12:29 -0700, Dan Thurman wrote:
> I am using fedora's "native" unrar for my python
> application - no dll version or whatever else is out there.
>
> I have been trying to figure out how to obtain
> unrar's overall progress report for inclusion into my
> python code but so far I have not been successful.
>
> I tried to turn off all of the comments except for
> the progress report and all I have so far is:
>
> unrar x -ierr +o- $file | sed -e 's/.*\([0-9]\+\)[%]$/\1/
>
> I have tried: -c-, -inul, and many other switches but
> none of these switches helped.
>
You need a two part solution at least. First part is to read the output with a
program which does character input rather than line input. a small C program
comes to mind, with logic of a simple state machine. In the ignore state, drop
anything but a digit. In the capture mode save digits until a non-digit, display
if the digit is a percent. That's not perfect logic, file names can include
digits followed by a percent as well, but it's a start.
Now the 2nd part, you may have to send the output to a pty to avoid buffering.
There's your hint, if the output is still buffered then you need a pty or to
modify the source code of unrar to behave better. That's my bet for best
solution, it's open source, fix it. Add a command line switch, Send the fix to
the maintainer.
--
Bill Davidsen <davidsen@xxxxxxx>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot
--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines