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})