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