simplify and adjust download progress indicator (#1519)
This commit is contained in:
@@ -293,17 +293,13 @@ class TerminalOutput(NullOutput):
|
|||||||
print("\r", self.shorten(CHAR_SUCCESS + path), sep="")
|
print("\r", self.shorten(CHAR_SUCCESS + path), sep="")
|
||||||
|
|
||||||
def progress(self, bytes_total, bytes_downloaded, bytes_per_second):
|
def progress(self, bytes_total, bytes_downloaded, bytes_per_second):
|
||||||
|
bdl = util.format_value(bytes_downloaded)
|
||||||
|
bps = util.format_value(bytes_per_second)
|
||||||
if bytes_total is None:
|
if bytes_total is None:
|
||||||
print("\r {:>7}B {:>7}B/s \r".format(
|
print("\r{:>7}B {:>7}B/s ".format(bdl, bps), end="")
|
||||||
util.format_value(bytes_downloaded),
|
|
||||||
util.format_value(bytes_per_second),
|
|
||||||
), end="")
|
|
||||||
else:
|
else:
|
||||||
print("\r{:>3}% {:>7}B {:>7}B/s \r".format(
|
print("\r{:>3}% {:>7}B {:>7}B/s ".format(
|
||||||
bytes_downloaded * 100 // bytes_total,
|
bytes_downloaded * 100 // bytes_total, bdl, bps), end="")
|
||||||
util.format_value(bytes_downloaded),
|
|
||||||
util.format_value(bytes_per_second),
|
|
||||||
), end="")
|
|
||||||
|
|
||||||
|
|
||||||
class ColorOutput(TerminalOutput):
|
class ColorOutput(TerminalOutput):
|
||||||
|
|||||||
Reference in New Issue
Block a user