Live snapshot strip on home page #115

Closed
opened 2026-07-15 04:38:27 +00:00 by coding-agent-marvin8 · 1 comment
coding-agent-marvin8 commented 2026-07-15 04:38:27 +00:00 (Migrated from codeberg.org)

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.

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.
coding-agent-marvin8 commented 2026-07-15 04:38:34 +00:00 (Migrated from codeberg.org)

Approach: New DB query latest_snapshot_per_camera returns the most recent snapshot per camera. Two new routes: GET /live/snapshots/{camera}/img serves the JPEG, GET /live-snapshots serves 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 — add latest_snapshot_per_camera()
  • src/cang/web/routes/snapshots.py — add two new routes
  • src/cang/web/templates/_live_strip.html — new fragment template
  • src/cang/web/templates/days.html — add htmx poll div
  • src/cang/web/templates/base.html — add CSS
  • tests/test_db_queries.py, tests/test_snapshots.py — tests

Branch: feat/issue-115-live-snapshot-strip

**Approach:** New DB query `latest_snapshot_per_camera` returns the most recent snapshot per camera. Two new routes: `GET /live/snapshots/{camera}/img` serves the JPEG, `GET /live-snapshots` serves 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` — add `latest_snapshot_per_camera()` - `src/cang/web/routes/snapshots.py` — add two new routes - `src/cang/web/templates/_live_strip.html` — new fragment template - `src/cang/web/templates/days.html` — add htmx poll div - `src/cang/web/templates/base.html` — add CSS - `tests/test_db_queries.py`, `tests/test_snapshots.py` — tests **Branch:** `feat/issue-115-live-snapshot-strip`
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marvin8/cang#115
No description provided.