feat: auto feature detection with filename prefixes on export

Detects QR codes (QR_), barcodes (BC_), faces (FACE_/GROUP_),
and panoramas (PANO_) per photo using OpenCV — no new dependencies.
Opt-in checkboxes in the rename tab; prefixes prepend to filename.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-23 12:50:34 +00:00
parent 433fd93a36
commit 1aded7ff0d
3 changed files with 347 additions and 0 deletions
+7
View File
@@ -124,6 +124,7 @@ class ExportRequest(BaseModel):
text_watermark: dict = Field(default_factory=dict)
image_watermark_path: str = ""
image_watermark_settings: dict = Field(default_factory=dict)
feature_detectors: List[str] = Field(default_factory=list)
@app.get("/")
@@ -400,6 +401,7 @@ def _run_export_job(job_id: str, req: ExportRequest):
buf = io.BytesIO()
used_names: set = set()
detectors = set(req.feature_detectors)
with zipfile.ZipFile(buf, "w", zipfile.ZIP_DEFLATED) as zf:
for i, path in enumerate(export_paths):
exif = get_exif_info(path)
@@ -407,6 +409,11 @@ def _run_export_job(job_id: str, req: ExportRequest):
path, req.rename_mode, req.rename_prefix,
i + 1, exif, path in fav_set, req.fav_prefix,
)
if detectors:
from processor import detect_features
feat_prefix = "".join(detect_features(path, detectors))
if feat_prefix:
new_name = feat_prefix + new_name
# Deduplicate filenames
base, ext = os.path.splitext(new_name)
candidate, n = new_name, 1