d807cd2c23
5b — audio source switching:
AudioSourceCfg list + audio_filter_target в InstanceCfg
CommandDispatcher._audio_set → ZMQ astreamselect@as map <index>
REST: GET /audio/{inst}, POST /audio/{inst}/set
MQTT: cuda_grid/cmd/<inst>/audio/set <source_name>
5c — intercom ducking:
music_volume_target / intercom_volume_target / music_ducked_volume в InstanceCfg
CommandDispatcher._intercom_set → 2× ZMQ volume@music/@intercom commands
REST: POST /intercom/{inst}/start (music↓ + intercom↑) + /end (restore)
MQTT: cuda_grid/cmd/<inst>/intercom/start|end
6 — dynamic overlays (charts/chats):
dynamic_overlays.py: ChartCfg/ChatCfg + DynamicRenderer
PIL rendering: line chart + scrolling text list
Async loops пишут PNG в icon_dir + invalidate filter cache via reload_icon ZMQ
MQTT subscriptions для real data (charts: numeric topic, chats: text topic)
Demo: chart sine wave если data_topic=null
Wired в __main__.py + mqtt_loop dispatch
+ ZMQ client asyncio.Lock — REQ socket strict send/recv pattern требует
serialize requests (overlay/audio/intercom concurrent ломали "Operation
cannot be accomplished in current state")
+ Pillow в Dockerfile (для PIL render)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
41 lines
1.0 KiB
Docker
41 lines
1.0 KiB
Docker
# cuda-grid-controller — Python sidecar для vf_cuda_grid filter.
|
|
|
|
FROM python:3.11-slim AS base
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1
|
|
|
|
WORKDIR /app
|
|
|
|
# ffmpeg для snapshot endpoint — нужен basic CPU build (RTSP read + PNG output).
|
|
# Размер: ~120 MB additional (ffmpeg + libs); приемлемо для controller image.
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ffmpeg \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install deps первым layer — пересборка только при изменении pyproject.toml
|
|
COPY pyproject.toml ./
|
|
RUN pip install --no-cache-dir \
|
|
fastapi \
|
|
"uvicorn[standard]" \
|
|
pydantic \
|
|
pydantic-settings \
|
|
aiomqtt \
|
|
pyzmq \
|
|
pyyaml \
|
|
structlog \
|
|
typer \
|
|
sse-starlette \
|
|
pillow
|
|
|
|
# Source code
|
|
COPY cuda_grid_controller ./cuda_grid_controller
|
|
COPY examples ./examples
|
|
|
|
RUN pip install --no-cache-dir -e .
|
|
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["cuda-grid-controller"]
|
|
CMD ["--config", "/app/controller.yaml"]
|