add streaming and mobile-app instructions

This commit is contained in:
2026-05-18 12:27:39 +02:00
parent ee6e7b806f
commit 0e40a23828
12 changed files with 726 additions and 3 deletions
+8
View File
@@ -0,0 +1,8 @@
FROM alpine:3.20
RUN apk add --no-cache ffmpeg
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
+36
View File
@@ -0,0 +1,36 @@
#!/bin/sh
set -e
FIFO=/audio/stream.fifo
ICECAST_HOST=${ICECAST_HOST:-icecast}
ICECAST_PORT=${ICECAST_PORT:-8000}
ICECAST_PASSWORD=${ICECAST_SOURCE_PASSWORD:-groove_source}
MOUNT=${ICECAST_MOUNT:-/stream.flac}
until [ -p "$FIFO" ]; do
echo "[stream-relay] Waiting for $FIFO..."
sleep 2
done
# Open FIFO with O_RDWR so Mopidy's GStreamer filesink never blocks on open().
# A write-only open blocks until a reader exists; by holding the FIFO open
# O_RDWR here, the write side can proceed immediately at any time.
exec 5<>"$FIFO"
echo "[stream-relay] FIFO open. Encoding PCM → FLAC → icecast://${ICECAST_HOST}:${ICECAST_PORT}${MOUNT}"
ICECAST_URL="icecast://source:${ICECAST_PASSWORD}@${ICECAST_HOST}:${ICECAST_PORT}${MOUNT}"
while true; do
ffmpeg -nostdin \
-f s16le -ar 48000 -ac 2 \
-i "$FIFO" \
-vn \
-c:a flac \
-compression_level 0 \
-f flac \
-content_type audio/flac \
"$ICECAST_URL" 2>&1 || true
echo "[stream-relay] ffmpeg exited — reconnecting in 3s..."
sleep 3
done