From 96f4ab2eb93d697967cfc063dc93e51e36e8174d Mon Sep 17 00:00:00 2001 From: profitroll Date: Tue, 14 Feb 2023 14:32:20 +0100 Subject: [PATCH] Added raise for incorrect geo exif --- modules/hasher.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/hasher.py b/modules/hasher.py index 6045bb3..b74d7a8 100644 --- a/modules/hasher.py +++ b/modules/hasher.py @@ -45,10 +45,13 @@ async def get_duplicates(hash: str, album: str) -> list: duplicates = [] cache = get_duplicates_cache(album) for image_name in cache.keys(): - distance = spatial.distance.hamming( - hash_hex_to_hash_array(cache[image_name][1]), - hash_hex_to_hash_array(hash) - ) + try: + distance = spatial.distance.hamming( + hash_hex_to_hash_array(cache[image_name][1]), + hash_hex_to_hash_array(hash) + ) + except ValueError: + continue print("{0:<30} {1}".format(image_name, distance), flush=True) if distance <= 0.25: duplicates.append({"id": cache[image_name][0], "filename": image_name, "difference": distance})