Skip duplicate check for July archive
Browse files110 unmodified lines111112113114115116220 unmodified lines337338339340341342343344345346347348349350351352353354355356357358359110 unmodified linesDUPLICATE_HASH_SIZE = 16DUPLICATE_HASH_DISTANCE = 24DUPLICATE_COLOR_DISTANCE = 24DEFAULT_RETURN_SCALE = 1DEFAULT_BATCH_SIZE = 1DEFAULT_UI_BATCH_SIZE = 1220 unmodified lineslog(f"Deleted img/{path.relative_to(IMAGE_DIR)}")if HAS_DATA_MOUNT:for folder in IMAGE_DIR.glob("????-??-??"):fingerprints = []for path in folder.glob("*.epng"):with Image.open(BytesIO(stored_bytes(path))) as image:fingerprints.append(image_fingerprint(image))for path in folder.glob("*.png"):with Image.open(path) as image:fingerprint = image_fingerprint(image)duplicate = any((fingerprint[0] ^ known[0]).bit_count()<= DUPLICATE_HASH_DISTANCEand sum(abs(left - right)for left, right in zip(fingerprint[1], known[1]))<= DUPLICATE_COLOR_DISTANCEfor known in fingerprints)if not duplicate:save_named_image(image, path.with_suffix(".epng"))path.unlink()110 unmodified lines111112113114115116117220 unmodified lines338339340341342343344345346347348349350351352353354355356357358359360361362363364365366110 unmodified linesDUPLICATE_HASH_SIZE = 16DUPLICATE_HASH_DISTANCE = 24DUPLICATE_COLOR_DISTANCE = 24DUPLICATE_CHECK_EXCLUDED_FOLDERS = {"2026-07-30"}DEFAULT_RETURN_SCALE = 1DEFAULT_BATCH_SIZE = 1DEFAULT_UI_BATCH_SIZE = 1220 unmodified lineslog(f"Deleted img/{path.relative_to(IMAGE_DIR)}")if HAS_DATA_MOUNT:for folder in IMAGE_DIR.glob("????-??-??"):check_duplicates = (folder.name not in DUPLICATE_CHECK_EXCLUDED_FOLDERS)fingerprints = []if check_duplicates:for path in folder.glob("*.epng"):with Image.open(BytesIO(stored_bytes(path))) as image:fingerprints.append(image_fingerprint(image))for path in folder.glob("*.png"):with Image.open(path) as image:duplicate = Falseif check_duplicates:fingerprint = image_fingerprint(image)duplicate = any((fingerprint[0] ^ known[0]).bit_count()<= DUPLICATE_HASH_DISTANCEand sum(abs(left - right)for left, right in zip(fingerprint[1], known[1]))<= DUPLICATE_COLOR_DISTANCEfor known in fingerprints)if not duplicate:save_named_image(image, path.with_suffix(".epng"))path.unlink()
app.py+20-13