1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-30 15:14:14 +01:00

svtplay_dl.output: prettier progressbar generation

This commit is contained in:
Olof Johansson 2013-04-19 17:38:37 +02:00
parent 5ef5e850e4
commit ae8fda8963

View File

@ -114,13 +114,7 @@ def progressbar(total, pos, msg=""):
"""
width = 50 # TODO hardcoded progressbar width
rel_pos = int(float(pos)/total*width)
bar = str()
# FIXME ugly generation of bar
for _ in range(0, rel_pos):
bar += "="
for _ in range(rel_pos, width):
bar += "."
bar = ''.join(["=" * rel_pos, "." * (width - rel_pos)])
# Determine how many digits in total (base 10)
digits_total = len(str(total))