Live snapshot strip on home page #115
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add a live view strip to the Cang home page (/days) showing the most recent snapshot from each configured camera. The strip auto-refreshes every 30 seconds via htmx polling. Cameras without snapshots show a placeholder.
Approach: New DB query
latest_snapshot_per_camerareturns the most recent snapshot per camera. Two new routes:GET /live/snapshots/{camera}/imgserves the JPEG,GET /live-snapshotsserves an htmx-swappable HTML fragment. The /days template polls the fragment every 30s via htmx. CSS grid with auto-fill ensures 2 cameras fill the screen, max 3 per row.Key files:
src/cang/db.py— addlatest_snapshot_per_camera()src/cang/web/routes/snapshots.py— add two new routessrc/cang/web/templates/_live_strip.html— new fragment templatesrc/cang/web/templates/days.html— add htmx poll divsrc/cang/web/templates/base.html— add CSStests/test_db_queries.py,tests/test_snapshots.py— testsBranch:
feat/issue-115-live-snapshot-strip