From: Zachary Vance Date: Fri, 13 Aug 2021 01:13:06 +0000 (-0700) Subject: improve progress bars X-Git-Url: https://git.za3k.com/?a=commitdiff_plain;h=2d338a6254a276bf007af377ca1453bb896f0fd4;p=mqlg.git improve progress bars --- diff --git a/main.py b/main.py index 915eea6..bb3a409 100755 --- a/main.py +++ b/main.py @@ -134,7 +134,7 @@ def do_work(file_processor, message): if lib.tqdm_avail: # A nice progress bar but read/write instead of copyfileobj slows it down a little. total_size = int(r.headers.get('content-length', 0)) - progress_bar = lib.tqdm(desc="download", total=total_size, unit='iB', unit_scale=True) + progress_bar = lib.tqdm(desc="download", total=total_size, unit='iB', unit_scale=True, leave=False) with open(input_path, 'wb') as f: for data in r.iter_content(100000): f.write(data) diff --git a/sm.py b/sm.py index b221c42..fbd5505 100644 --- a/sm.py +++ b/sm.py @@ -47,7 +47,7 @@ def extract_text(input_path, output_path, debug=False): # Extract the text from each (single-threaded) # INPUT.pdf -> INPUT.pdf.txt with lib.timer("pdftotext", logging.warning): - for pdf in lib.tqdm(pdfs, desc="pdftotext"): + for pdf in lib.tqdm(pdfs, desc="pdftotext", leave=False): input_pdf = os.path.join(td_in, pdf) output_txt = os.path.join(td_out, pdf + ".txt") #logging.info("converting {} -> {}".format(input_pdf, output_txt))