fix: resolve NameError on startup, move analyses into recordings, remap port to 8050

- web.py: Python class bodies can't close over a name they also assign;
  use a temporary alias _analyses_dir to break the self-reference
- docker-compose.yml: mount ./recordings/analyses:/recordings/analyses
  instead of a separate ./analyses volume so cache lives inside recordings;
  remove --analyses-dir flag (default now resolves correctly); remap
  external port 8080→8050 for reverse proxy
- README.md / CLAUDE.md: update Docker port references to 8050

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 08:46:49 +02:00
parent 9ba084107b
commit 77e7e4ca9e
4 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -83,7 +83,7 @@ The `output_directory` value is used as-is: a relative path like `recordings` re
Two services share a `./recordings` bind mount: Two services share a `./recordings` bind mount:
- `recorder` — runs `isr.py`; volume at `/app/recordings`; mounts `asound.conf` as `/etc/asound.conf`; maps `/dev/snd`; `ipc: host` for dsnoop shared memory; `stop_grace_period: 30s` - `recorder` — runs `isr.py`; volume at `/app/recordings`; mounts `asound.conf` as `/etc/asound.conf`; maps `/dev/snd`; `ipc: host` for dsnoop shared memory; `stop_grace_period: 30s`
- `web` — runs `web.py`; same `./recordings` read-only at `/recordings`; exposes port 8080 - `web` — runs `web.py`; same `./recordings` read-only at `/recordings`; exposes port 8080 internally (mapped to 8050 on the host)
**Sharing the soundcard with darkice (or any other ALSA app):** **Sharing the soundcard with darkice (or any other ALSA app):**
ALSA `hw:` devices are exclusive. `asound.conf` defines a `dsnoop` virtual device `shared_mic` that both processes use instead: ALSA `hw:` devices are exclusive. `asound.conf` defines a `dsnoop` virtual device `shared_mic` that both processes use instead:
+1 -1
View File
@@ -36,7 +36,7 @@ cp config.example.ini config.ini
# edit config.ini to add your sources (no path changes needed for Docker) # edit config.ini to add your sources (no path changes needed for Docker)
docker compose up -d docker compose up -d
# recorder starts immediately; web UI at http://<host>:8080 # recorder starts immediately; web UI at http://<host>:8050
docker compose logs -f # tail logs from both services docker compose logs -f # tail logs from both services
docker compose down # graceful stop (waits up to 30 s for files to close) docker compose down # graceful stop (waits up to 30 s for files to close)
``` ```
+3 -3
View File
@@ -16,8 +16,8 @@ services:
build: . build: .
volumes: volumes:
- ./recordings:/recordings:ro - ./recordings:/recordings:ro
- ./analyses:/analyses - ./recordings/analyses:/recordings/analyses
ports: ports:
- "8080:8080" - "8050:8080"
restart: unless-stopped restart: unless-stopped
command: ["python", "web.py", "--dir", "/recordings", "--analyses-dir", "/analyses"] command: ["python", "web.py", "--dir", "/recordings"]
+2 -1
View File
@@ -1656,9 +1656,10 @@ def main():
prune_orphan_analyses(analyses_dir, rec_dir) prune_orphan_analyses(analyses_dir, rec_dir)
_analyses_dir = analyses_dir # class body can't close over a name it also assigns
class Handler(_Handler): class Handler(_Handler):
recordings_dir = str(rec_dir) recordings_dir = str(rec_dir)
analyses_dir = str(analyses_dir) analyses_dir = str(_analyses_dir)
threshold = args.threshold threshold = args.threshold
min_gap = args.min_gap min_gap = args.min_gap