From 65015d4f2ef5c45e5289eb527862b55604c14957 Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Wed, 28 Mar 2018 09:17:36 +1100 Subject: [PATCH] Add progress bar --- scripts/pdf_unlock.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/pdf_unlock.py b/scripts/pdf_unlock.py index 4d9d9e7..9f77fb0 100644 --- a/scripts/pdf_unlock.py +++ b/scripts/pdf_unlock.py @@ -39,10 +39,10 @@ __email__ = "d.howe@wrl.unsw.edu.au" import os import glob +import shutil import argparse import subprocess -import shutil - +from tqdm import tqdm def pdf_unlock(pdf_file, overwrite=False): # Create suffix for unlocked pdfs @@ -101,7 +101,10 @@ def main(): pdf_files = glob.glob(glob_str, recursive=args.recursive) - for pdf_file in pdf_files: + pbar = tqdm(pdf_files) + for pdf_file in pbar: + pdf_file_shortname = os.path.split(pdf_file)[1] + pbar.set_description('Processing {}'.format(pdf_file_shortname)) pdf_unlock(pdf_file, overwrite=args.overwrite)