mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Reduce number of Downloading prints when the installer output is redirected to a file
This commit is contained in:
parent
7689749f37
commit
9b41e0c98f
@ -228,11 +228,14 @@ class Reporter: # {{{
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
prints('Downloading', fname)
|
prints('Downloading', fname)
|
||||||
self.pb = None
|
self.pb = None
|
||||||
|
self.last_percent = 0
|
||||||
|
|
||||||
def __call__(self, blocks, block_size, total_size):
|
def __call__(self, blocks, block_size, total_size):
|
||||||
percent = (blocks*block_size)/float(total_size)
|
percent = (blocks*block_size)/float(total_size)
|
||||||
if self.pb is None:
|
if self.pb is None:
|
||||||
prints('Downloaded {0:%}'.format(percent))
|
if percent - self.last_percent > 0.05:
|
||||||
|
self.last_percent = percent
|
||||||
|
prints('Downloaded {0:%}'.format(percent))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
self.pb.update(percent)
|
self.pb.update(percent)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user