diff options
author | Davide Cavalca <davide@cavalca.name> | 2022-02-22 01:48:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 01:48:25 +0100 |
commit | d02f59586ec33a7cb0e48dfe44b33b849883caad (patch) | |
tree | 925d62820d8db80bb2468a9a925e4c1c356edfc8 /samloader/main.py | |
parent | add error when device or model is invalid (checkupdate) (diff) | |
download | samloader-d02f59586ec33a7cb0e48dfe44b33b849883caad.tar samloader-d02f59586ec33a7cb0e48dfe44b33b849883caad.tar.gz samloader-d02f59586ec33a7cb0e48dfe44b33b849883caad.tar.bz2 samloader-d02f59586ec33a7cb0e48dfe44b33b849883caad.tar.lz samloader-d02f59586ec33a7cb0e48dfe44b33b849883caad.tar.xz samloader-d02f59586ec33a7cb0e48dfe44b33b849883caad.tar.zst samloader-d02f59586ec33a7cb0e48dfe44b33b849883caad.zip |
Diffstat (limited to 'samloader/main.py')
-rw-r--r-- | samloader/main.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/samloader/main.py b/samloader/main.py index 57210dc..48c9a82 100644 --- a/samloader/main.py +++ b/samloader/main.py @@ -5,7 +5,7 @@ import argparse import os import base64 import xml.etree.ElementTree as ET -from clint.textui import progress +from tqdm import tqdm from . import request from . import crypt @@ -46,11 +46,12 @@ def main(): r = client.downloadfile(path+filename, dloffset) if args.show_md5 and "Content-MD5" in r.headers: print("MD5:", base64.b64decode(r.headers["Content-MD5"]).hex()) - # TODO: use own progress bar instead of clint - for chunk in progress.bar(r.iter_content(chunk_size=0x10000), expected_size=((size-dloffset)/0x10000)+1): + pbar = tqdm(total=size, initial=dloffset, unit="B", unit_scale=True) + for chunk in r.iter_content(chunk_size=0x10000): if chunk: fd.write(chunk) fd.flush() + pbar.update(0x10000) fd.close() if args.do_decrypt: # decrypt the file if needed dec = out.replace(".enc4", "").replace(".enc2", "") # TODO: use a better way of doing this |