mirror of
https://github.com/bkerler/edl.git
synced 2024-11-14 19:14:58 -05:00
Merge pull request #167 from humdogm/master
A few quality of life visual changes
This commit is contained in:
commit
62dc36ab53
2 changed files with 17 additions and 8 deletions
|
@ -173,17 +173,23 @@ class firehose(metaclass=LogBase):
|
|||
tdiff=t0-self.progtime
|
||||
datasize=(pos-self.progpos)/1024/1024
|
||||
throughput=(((datasize)/(tdiff)))
|
||||
print_progress(prog, 100, prefix='Progress:',
|
||||
suffix=prefix+' (Sector %d of %d) %0.2f MB/s' %
|
||||
(pos // self.cfg.SECTOR_SIZE_IN_BYTES,
|
||||
total // self.cfg.SECTOR_SIZE_IN_BYTES,
|
||||
throughput), bar_length=50)
|
||||
max_pos_len = len(str(total // self.cfg.SECTOR_SIZE_IN_BYTES))
|
||||
print_progress(prog, 100,
|
||||
prefix='Progress:',
|
||||
suffix=prefix+' (Sector {} of {}) {:0.2f} MB/s'.format(
|
||||
'{0:>{1}d}'.format(pos // self.cfg.SECTOR_SIZE_IN_BYTES, max_pos_len),
|
||||
total // self.cfg.SECTOR_SIZE_IN_BYTES,
|
||||
throughput),
|
||||
bar_length=50)
|
||||
self.prog = prog
|
||||
self.progpos = pos
|
||||
self.progtime = t0
|
||||
else:
|
||||
if display:
|
||||
print_progress(100, 100, prefix='Progress:', suffix='Complete', bar_length=50)
|
||||
print_progress(100, 100,
|
||||
prefix='Progress:',
|
||||
suffix=prefix+' Complete (Sector {0} of {0})'.format(total // self.cfg.SECTOR_SIZE_IN_BYTES),
|
||||
bar_length=50)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
|
|
@ -575,12 +575,15 @@ def print_progress(iteration, total, prefix='', suffix='', decimals=1, bar_lengt
|
|||
decimals - Optional : positive number of decimals in percent complete (Int)
|
||||
bar_length - Optional : character length of bar (Int)
|
||||
"""
|
||||
str_format = "{0:." + str(decimals) + "f}"
|
||||
str_format = "{:>5." + str(decimals) + "f}"
|
||||
percents = str_format.format(100 * (iteration / float(total)))
|
||||
filled_length = int(round(bar_length * iteration / float(total)))
|
||||
bar = '█' * filled_length + '-' * (bar_length - filled_length)
|
||||
|
||||
sys.stdout.write('\r%s |%s| %s%s %s' % (prefix, bar, percents, '%', suffix))
|
||||
progstring = '\r%s |%s| %s%s %s' % (prefix, bar, percents, '%', suffix)
|
||||
cols, _ = shutil.get_terminal_size()
|
||||
progstring += " " * (cols - len(progstring) - 1)
|
||||
sys.stdout.write(progstring)
|
||||
|
||||
if iteration == total:
|
||||
sys.stdout.write('\n')
|
||||
|
|
Loading…
Reference in a new issue