--- a/borgend/ui.py Mon Jan 29 14:32:27 2018 +0000 +++ b/borgend/ui.py Wed Jan 31 00:06:54 2018 +0000 @@ -79,6 +79,29 @@ elif TB <= B: return '{0:.2f}TB'.format(B/TB) + +def progress_percentage(done, total, d): + progress='' + try: + percentage = 100*float(done)/float(total) + progress=': %d%%' % int(round(percentage)) + if 'operation_no' in d: + progress=':#%d%s' % (d['operation_no'], progress) + except: + pass + return progress + +def progress_parts(done, total, d): + progress='' + try: + progress=': %d/%d' % (int(done), int(total)) + if 'operation_no' in d: + progress=':#%d%s' % (d['operation_no'], progress) + except: + pass + return progress + + def make_title(status): def add_info(info, new): if info: @@ -125,26 +148,28 @@ if 'reason' in status.detail: this_info=status.detail['reason'] + ' ' - when_how_sched= "%s%s %s" % (this_info, status.operation, whenstr) + when_how_sched= "%s%s %s" % (this_info, status.type, whenstr) info=add_info(info, when_how_sched) elif status.state==backup.State.QUEUED: - info=add_info(info, "queued") + info=add_info(info, "queued %s" % status.type) elif status.state==backup.State.ACTIVE: # Operation running progress='' d=status.detail if 'progress_current' in d and 'progress_total' in d: - percentage = 100*float(d['progress_current'])/float(d['progress_total']) - progress=': %d%%' % int(round(percentage)) - if 'operation_no' in d: - progress='/#%d%s' % (d['operation_no'], progress) + progress=progress_percentage(d['progress_current'], + d['progress_total'], d) + elif ('progress_current_secondary' in d and + 'progress_total_secondary' in d): + progress=progress_parts(d['progress_current_secondary'], + d['progress_total_secondary'], d) elif 'original_size' in d and 'deduplicated_size' in d: progress=' %s→%s' % (humanbytes(d['original_size']), humanbytes(d['deduplicated_size'])) - howrunning = "running %s%s" % (status.operation, progress) + howrunning = "running %s%s" % (status.type, progress) info=add_info(info, howrunning) else: