-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a0e0d3
commit 9c4bf88
Showing
2 changed files
with
22 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,34 @@ | ||
import tqdm | ||
import sys | ||
import string | ||
import os | ||
|
||
logp = sys.argv[1] | ||
logcsv = sys.argv[2] | ||
|
||
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))) | ||
if 'Folders: ' in line and ' Files: ' in line: | ||
total = float(line.split()[3].strip()) | ||
break | ||
with tqdm.tqdm(total=total) as pbar: | ||
progress = 0 | ||
prev_len = 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: | ||
|
||
pbar.update(prog - progress) | ||
progress = prog | ||
break | ||
with open(logcsv, 'r') as logc: | ||
if len(logc.readlines()) > prev_len: | ||
logc.seek(0) | ||
prev_len = len(logc.readlines()) | ||
logc.seek(0) | ||
else: | ||
continue | ||
for line in logc: | ||
if 'collated_' in line: | ||
prog = len(line.split('"')[-2].split(',')) | ||
else: | ||
prog = 1 | ||
pbar.update(prog - progress) | ||
progress = prog | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters