Skip to content

Commit

Permalink
lightweight progress tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
davedavemckay committed Oct 28, 2024
1 parent 8d02c66 commit 8123cc0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions csd3-side/scripts/backup_progress.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import tqdm
import sys
import string

logp = sys.argv[1]

total = 0

with open(logp, 'r') as logf:
for line in logf:
if 'Folders: ' in line and '; Files: ' in line:
total = float(line.split()[3].strip().translate(str.maketrans('', '', string.punctuation)))
break
with tqdm.tqdm(total=total) as pbar:
progress = 0
while True:
with open(logp, 'r') as logf:
for line in logf:
if 'Folders: ' in line and '; Files: ' in line:
prog = float(line.split()[1].strip().translate(str.maketrans('', '', string.punctuation)))
if prog > progress:
progress = prog
pbar.update(progress)

0 comments on commit 8123cc0

Please sign in to comment.