Parse batch number and date from upload filename for live API lookup

This commit is contained in:
proitlab committed 2026-08-05 00:49:39 +07:00
1 parent 14ebfb7779
commit f01601d1d7
3 files changed
+54 -19

No files matched your search

+6
View File
@@ -9,6 +9,7 @@
- `batch_store.py` — shared SQLite persistence + batch state machine.
- `counter_dashboard.py` — Flask dashboard on port 5000, same DB.
- `recounting_dashboard.py` — Flask recounting dashboard on port 5002, consumes live + recount APIs.
- `recounting_dashboard_upload.py` — Flask upload+recount dashboard on port 5003; uploads MP4 first, then launches `RECOUNT_CMD --source <mp4>`; START RECOUNT stays disabled until an upload completes.
## No build / test / lint
@@ -30,6 +31,9 @@ PYTHONNOUSERSITE=1 venv/bin/python counter_live_rknn_bytetrack.py
# Run dashboard
PYTHONNOUSERSITE=1 venv/bin/python counter_dashboard.py
# Run upload recounting dashboard
PYTHONNOUSERSITE=1 venv/bin/python recounting_dashboard_upload.py
```
## Key environment & install quirks
@@ -42,6 +46,8 @@ PYTHONNOUSERSITE=1 venv/bin/python counter_dashboard.py
- Two systemd units: `bytetrack-counter.service` + `bytetrack-counter-dashboard.service`.
- `counter_live.py` (TensorRT) is Jetson-only and won't work on RK3588.
- **Reset flow**: `POST /api/reset` → deletes state JSON + touches `{SHM_DIR}/.reset`. `batch_store._check_reset_signal()` watches this marker and clears in-memory state on next crossing.
- **Upload filename contract**: uploads are expected as `batch_XX_YYYYMMDD_HHmmSS.mp4` (XX = batch number, timestamp = date). `recounting_dashboard_upload.py` parses both to query the live API's `/api/day-detail/<YYYY-MM-DD>` for the recorded count.
- **`RECOUNT_CMD`** in the upload dashboard is a template with a `{path}` placeholder, e.g. `bytetrack-counter config.env --source {path}`; the uploaded file path is `shlex.quote()`d before substitution.
## Code conventions