diff --git a/busch_radio_spotify/config.yaml b/busch_radio_spotify/config.yaml index 837a194..bfc0998 100644 --- a/busch_radio_spotify/config.yaml +++ b/busch_radio_spotify/config.yaml @@ -1,6 +1,6 @@ --- name: "Busch-Radio Spotify Bridge" -version: "1.0.3" +version: "1.0.4" slug: busch_radio_spotify description: > Streamt Spotify-Musik als Internet-Radio-Stream für das Busch-Jäger Unterputz-Internetradio. @@ -42,3 +42,4 @@ panel_title: "Busch-Radio" map: - config:rw - share:rw + - data:rw diff --git a/busch_radio_spotify/run.sh b/busch_radio_spotify/run.sh index ec5f631..6955b07 100644 --- a/busch_radio_spotify/run.sh +++ b/busch_radio_spotify/run.sh @@ -134,19 +134,39 @@ if ! kill -0 "${ICECAST_PID}" 2>/dev/null; then fi bashio::log.info "Icecast läuft (PID: ${ICECAST_PID})" +# ── Credential-Cache-Verzeichnis ───────────────────────────────────────────── +# Credentials werden in /data gespeichert (persistentes Add-on Verzeichnis). +CREDENTIAL_CACHE="/data/librespot-cache" +mkdir -p "${CREDENTIAL_CACHE}" + # ── Librespot-Argumente zusammenstellen ─────────────────────────────────────── -# Hinweis: librespot 0.7+ unterstützt keine Passwort-Authentifizierung mehr. -# Das Gerät wird automatisch via Zeroconf/mDNS im lokalen Netz gefunden. -# Die Spotify-App zeigt es als verfügbares Abspielgerät an. +# Zeroconf/mDNS funktioniert nicht zuverlässig in Containern, da Port 5353 +# vom Host (systemd-resolved/avahi) bereits belegt ist. +# Stattdessen: OAuth-Authentifizierung. Das Gerät registriert sich bei +# Spotifys Servern und erscheint in der App ohne lokales mDNS. LIBRESPOT_ARGS=( "--name" "${DEVICE_NAME}" "--bitrate" "${BITRATE}" "--backend" "pipe" "--disable-audio-cache" "--initial-volume" "100" + "--disable-discovery" + "--enable-oauth" + "--system-cache" "${CREDENTIAL_CACHE}" ) -bashio::log.info "Authentifizierung: Zeroconf/mDNS (automatische Erkennung im Netz)" +# Prüfen ob bereits Credentials gecacht sind +if [ -f "${CREDENTIAL_CACHE}/credentials.json" ]; then + bashio::log.info "Gespeicherte Credentials gefunden – Direktstart." +else + bashio::log.info "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + bashio::log.info "ERSTER START – Spotify-Autorisierung erforderlich!" + bashio::log.info "" + bashio::log.info "librespot gibt gleich eine URL aus. Öffne diese" + bashio::log.info "im Browser und melde dich mit deinem Spotify-Konto an." + bashio::log.info "Danach startet das Add-on automatisch durch." + bashio::log.info "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +fi # ── Icecast-Source-URL ──────────────────────────────────────────────────────── ICECAST_SOURCE_URL="icecast://source:${ICECAST_PASSWORD}@localhost:${STREAM_PORT}${STREAM_MOUNT}"