Re: How to obtain the unrar overall progress report?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux