#!/bin/sh # Maps environment variables onto lgtv-audiocap-receiver.py's flags, since # that's how Unraid (and most container UIs) expose configuration — nobody # wants to hand-edit a CLI in the "extra parameters" box. set -eu args="--port ${PORT:-5004} --bind ${BIND:-0.0.0.0}" args="$args --output ${OUTPUT:-aplay} --device ${DEVICE:-hw:Loopback,0,0}" args="$args --rate ${RATE:-48000} --channels ${CHANNELS:-2}" args="$args --latency-ms ${LATENCY_MS:-80} --prebuffer-ms ${PREBUFFER_MS:-60}" args="$args --max-gap ${MAX_GAP:-200} --reset-after ${RESET_AFTER:-5.0}" args="$args --stats ${STATS:-30}" [ -n "${MULTICAST:-}" ] && args="$args --multicast $MULTICAST" [ -n "${IFACE:-}" ] && args="$args --iface $IFACE" [ "${FILL_SILENCE:-1}" = "0" ] && args="$args --no-fill-silence" # Anything passed on the "docker run" command line (or Unraid's "Extra # Parameters") is appended last, so it can override an env-derived flag — # and so plain `--help` works instead of silently starting the daemon. echo "lgtv-audiocap-receiver.py $args $*" # shellcheck disable=SC2086 exec python3 /usr/local/bin/lgtv-audiocap-receiver.py $args "$@"