Add vehicle whitelist and per-plate passage statistics

Whitelist: plates added to /whitelist are silently ignored on
detection — no clip, no frames, no DB entry. Manageable via
/whitelist page or from the event detail page per-event.

Stats: /stats shows all known plates ranked by passage count,
with first/last seen dates and one-click whitelist toggle.

Navigation links added to the index header.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
perco
2026-06-02 22:33:53 +02:00
co-authored by Claude Sonnet 4.6
parent bd890f111e
commit ea58a860b8
7 changed files with 289 additions and 0 deletions
+6
View File
@@ -255,6 +255,12 @@ def _process_clip(event_id: str, event_dir: str, clip_path: str, camera_name: st
snapshot_path = os.path.join(SNAPSHOTS_DIR, snapshot_file)
cv2.imwrite(snapshot_path, best_frame, [cv2.IMWRITE_JPEG_QUALITY, 90])
from database import is_whitelisted
if plate and is_whitelisted(plate):
log.info(f"Skipped (whitelist): {plate} — event {event_id[:8]}")
shutil.rmtree(event_dir, ignore_errors=True)
return None
hex_color, color_name = _vehicle_color(best_frame, plate_bbox)
insert_event(
event_id, camera_name, int(time.time()),