[Yum-devel] URLGrabber: help on progress indicator
Zdenek Pavlas
zpavlas at redhat.com
Tue Oct 2 08:58:26 UTC 2012
> f = grabber.urlopen()
urlopen() looks like a win for small files, but the actual
implementation downloads to a tempfile and reopens it.
Avoid it if you can, and use urlgrab() instead.
> I dont know the total size. I can only estimate it after the first
> file has been downloaded as they are all the same.
You don't have to specify size in most cases, as urlgrabber
parses the Content-Length header, and passes that to the
TextMeter.start() method. If it does not work, server probably
uses Transfer-encoding: chunked (usually because file is generated
dynamically, so even the server has no size hint).
> I was thinking of wrapping TextMeter and filter and change the values
If all files are the same, just stat the 1st file, and when
retrieving others, pass a "size" option to urlgrab/urlopen.
> there is a MultiFileMeter which I cant seem to able to use.
That's for parallel downloading, to be used as 'multi_progress_obj' option.
More information about the Yum-devel
mailing list