From f29a7491b940e4319fad6faf1c32ada4e7e28d0b Mon Sep 17 00:00:00 2001 From: Kevin Murray Date: Mon, 2 Jun 2014 17:23:51 +1000 Subject: [PATCH] [exif2timestream] make progess meter work serially Now, the Processed X images progress meter works when -1 is given on the command line --- exif2timestream.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/exif2timestream.py b/exif2timestream.py index 30826f0..87eae18 100644 --- a/exif2timestream.py +++ b/exif2timestream.py @@ -562,10 +562,18 @@ def main(opts): last_date = None subsec = 0 count = 0 + if n_cam_images < 100: + each = 10 + else: + each = 50 # TODO: sort out the whole subsecond clusterfuck if "-1" in opts and opts["-1"]: LOG.info("Using 1 process (What is this? Fucking 1990?)") for image in images: + count += 1 + if count % each == 0: + print("Processed {: 5d} Images".format(count), + end='\r') process_image((image, camera, ext)) else: from multiprocessing import Pool, cpu_count @@ -580,10 +588,6 @@ def main(opts): # set the function's camera-wide arguments args = zip(images, cycle([camera]), cycle([ext])) pool = Pool(threads) - if n_cam_images < 100: - each = 10 - else: - each = 50 for _ in pool.imap(process_image, args): count += 1 if count % each == 0: