better faulty encoding detection

This commit is contained in:
sebastien committed 2026-09-29 08:03:47 +02:00
1 parent ec8e79bb1a
commit 2a4c5f4f7c
12 files changed
+299 -25

No files matched your search

+9
View File
@@ -554,11 +554,18 @@ def run(
client = genai.Client(api_key=api_key)
groups = group_images(images)
total_groups = len(groups)
active: dict[str, tuple[str, float]] = {}
progress_lock = Lock()
incomplete: list[Path] = []
run_started = time.monotonic()
def print_group_progress(completed: int) -> None:
print(
f"Label detection progress: {completed}/{total_groups} copy groups completed.",
flush=True,
)
def report_progress(group: str, description: str, started: float) -> None:
with progress_lock:
active[group] = (description, started)
@@ -582,6 +589,7 @@ def run(
for group_key, files in groups.items()
}
pending = set(futures)
print_group_progress(0)
while pending:
done, pending = wait(pending, timeout=PROGRESS_INTERVAL)
for future in done:
@@ -591,6 +599,7 @@ def run(
future.result()
except IncompleteCopyError as exc:
incomplete.extend(exc.images)
print_group_progress(total_groups - len(pending))
if pending:
now = time.monotonic()
with progress_lock: