Speed: dhash-only rows (0.21s→6ms/file); gate near-dup+phash behind flag; fix hx UnboundLocalError; loop in single task (engine deadlock fix); photo_watch uses ingest flow

This commit is contained in:
2026-08-08 15:30:34 +10:00
parent 32978030c3
commit 5fb9358b5f
3 changed files with 87 additions and 35 deletions

View File

@@ -15,7 +15,7 @@ from prefect import flow, task
import photo_db as db
from takeout_fetch import download_archive, extract_archive, track_archive
from photo_ingest import check_duplicates, register_new_images, scan_directory
from photo_ingest import photo_ingest as ingest_flow
from apprise_helper import notify
INCOMING = Path("/mnt/data/takeout/incoming")
@@ -62,13 +62,7 @@ def handle_archive(a: Path) -> str:
@task
def process_extracted(export_dir: str, source: str) -> dict:
"""Run the ingest chain (fingerprint + dedup) on an extracted folder."""
images = scan_directory(export_dir)
if not images:
return {"total": 0}
result = check_duplicates(images)
if result["new_list"]:
register_new_images(result["new_list"], source=source)
return result
return ingest_flow(export_dir, source=source, batch_size=1000)
@flow(name="photo-watch")