From ecd90f08f4f17a76d3540020ebd2f710ac634b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20G=C3=BChne?= Date: Tue, 7 Apr 2026 08:55:14 +0200 Subject: [PATCH] Feature: AAC-Support und Bitrate auf Radiomaximum angepasst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Busch-Radio iNet 8216 U unterstützt max. 192 kbps und die Formate MP3, AAC und OGG. Neue Konfigurationsoptionen: - stream_format: mp3 (Standard) oder aac - bitrate: 96/128/160/192 kbps (max. des Radios) Default auf 160 kbps MP3 geändert (war 320 kbps – über Radio-Maximum). Stream-URL im Log zeigt jetzt die echte HA-IP statt Platzhalter. Co-Authored-By: Claude Sonnet 4.6 --- busch_radio_spotify/config.yaml | 10 ++++++---- busch_radio_spotify/run.sh | 24 ++++++++++++++++++------ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/busch_radio_spotify/config.yaml b/busch_radio_spotify/config.yaml index 7eddac1..3e5e506 100644 --- a/busch_radio_spotify/config.yaml +++ b/busch_radio_spotify/config.yaml @@ -5,7 +5,7 @@ slug: busch_radio_spotify description: > Streamt Spotify-Musik als Internet-Radio-Stream für das Busch-Jäger Unterputz-Internetradio. Das Add-on erzeugt ein virtuelles Spotify Connect-Gerät (via librespot) und stellt das Audio - als MP3-Stream über Icecast bereit. + als MP3- oder AAC-Stream über Icecast bereit. url: "https://gitea.bitfire.work/retr0/Busch-Radio-Spotify" arch: - aarch64 @@ -22,14 +22,16 @@ host_network: true # ---- Konfigurationsoptionen ---- options: device_name: "Busch-Radio" - bitrate: 320 + bitrate: 160 + stream_format: "mp3" stream_port: 8000 - stream_mount: "/stream.mp3" + stream_mount: "/stream" icecast_password: "busch-radio-geheim" schema: device_name: str - bitrate: "list(96|160|320)" + bitrate: "list(96|128|160|192)" + stream_format: "list(mp3|aac)" stream_port: port stream_mount: str icecast_password: str diff --git a/busch_radio_spotify/run.sh b/busch_radio_spotify/run.sh index fb37ef9..e04f67d 100644 --- a/busch_radio_spotify/run.sh +++ b/busch_radio_spotify/run.sh @@ -15,15 +15,28 @@ set -u # ── Konfiguration lesen ─────────────────────────────────────────────────────── DEVICE_NAME=$(bashio::config 'device_name') BITRATE=$(bashio::config 'bitrate') +STREAM_FORMAT=$(bashio::config 'stream_format') STREAM_PORT=$(bashio::config 'stream_port') STREAM_MOUNT=$(bashio::config 'stream_mount') ICECAST_PASSWORD=$(bashio::config 'icecast_password') +# ── Format-spezifische Einstellungen ────────────────────────────────────────── +if [ "${STREAM_FORMAT}" = "aac" ]; then + FFMPEG_CODEC="aac" + FFMPEG_FORMAT="adts" + ICECAST_MIME="audio/aac" +else + FFMPEG_CODEC="libmp3lame" + FFMPEG_FORMAT="mp3" + ICECAST_MIME="audio/mpeg" +fi + bashio::log.info "╔══════════════════════════════════════════════╗" -bashio::log.info "║ Busch-Radio Spotify Bridge v1.0.0 ║" +bashio::log.info "║ Busch-Radio Spotify Bridge v1.0.9 ║" bashio::log.info "╚══════════════════════════════════════════════╝" bashio::log.info "Gerätename : ${DEVICE_NAME}" bashio::log.info "Bitrate : ${BITRATE} kbps" +bashio::log.info "Format : ${STREAM_FORMAT}" bashio::log.info "Stream-Port : ${STREAM_PORT}" bashio::log.info "Stream-Pfad : ${STREAM_MOUNT}" @@ -88,7 +101,7 @@ cat > /tmp/busch-radio/icecast.xml <Busch-Radio Spotify Bridge Spotify via Home Assistant ${BITRATE} - audio/mpeg + ${ICECAST_MIME} 1 @@ -199,7 +212,7 @@ ICECAST_SOURCE_URL="icecast://source:${ICECAST_PASSWORD}@localhost:${STREAM_PORT # ── Stream-URL ausgeben ─────────────────────────────────────────────────────── bashio::log.info "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" bashio::log.info "Stream-URL für das Busch-Jäger Radio:" -bashio::log.info " http://:${STREAM_PORT}${STREAM_MOUNT}" +bashio::log.info " http://${HA_IP}:${STREAM_PORT}${STREAM_MOUNT}" bashio::log.info "" bashio::log.info "Icecast-Statusseite:" bashio::log.info " http://:${STREAM_PORT}" @@ -239,10 +252,9 @@ while true; do -loglevel warning \ -f s16le -ar 44100 -ac 2 \ -i pipe:0 \ - -codec:a libmp3lame \ + -codec:a "${FFMPEG_CODEC}" \ -b:a "${BITRATE}k" \ - -q:a 2 \ - -f mp3 \ + -f "${FFMPEG_FORMAT}" \ "${ICECAST_SOURCE_URL}" \ || true