From 2d338a6254a276bf007af377ca1453bb896f0fd4 Mon Sep 17 00:00:00 2001 From: Zachary Vance Date: Thu, 12 Aug 2021 18:13:06 -0700 Subject: [PATCH] improve progress bars --- main.py | 2 +- sm.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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)) -- 2.47.3