From ce9994a95447ab1df4a1577ca79d8a68f418446d Mon Sep 17 00:00:00 2001 From: Jonathan Chan Date: Thu, 15 Jun 2023 16:15:27 +1000 Subject: [PATCH] Detect duplicate and sequential Spotteron uploads --- coastsnap/spotteron_batch_download.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/coastsnap/spotteron_batch_download.py b/coastsnap/spotteron_batch_download.py index 17e7cb9..2a8681f 100644 --- a/coastsnap/spotteron_batch_download.py +++ b/coastsnap/spotteron_batch_download.py @@ -161,10 +161,16 @@ class Spotteron: if not images: logger.info("No images returned. Check correct root_id is supplied") + break - for img in images: - + for index, img in enumerate(images): + if img.exists(output_folder) and overwrite == False: + + if img.output_filename == images[index-1].output_filename: # Check for sequential duplicate images + logger.info(f"Duplicate Spotteron upload: {img.output_filename}") + continue + logger.info("Existing images found. Stopping getting images") break else: