Release v1.1.0: Spotify Soloist als Empfänger, librespot als Rückfall

- soloist_api_key gesetzt (amd64/aarch64) → Spotify Soloist, sonst librespot
- Soloist wird zur Laufzeit von Spotify geladen und alle 12 h aktualisiert (Builds laufen nach 90 Tagen ab)
- Audio über PipeWire-Senke busch_radio → pw-record → bestehende Icecast-Pipeline
- amd64/aarch64 auf Debian-Basis (glibc für Soloist), 32-Bit bleibt Alpine
- Build-Fix: librespot auf Commit 99b6088 gepinnt, Browse-to-Patch an neuen Code angepasst
- README, DOCS und CHANGELOG überarbeitet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CGNdWh2jLNNb3tb9v1WEuK
This commit is contained in:
Niklas GühneandClaude Opus 5.5 committed 2026-11-04 15:26:50 +01:00
1 parent 95aac1d809
commit 99c910f488
10 files changed
+384 -96

No files matched your search

+51 -13
View File
@@ -16,12 +16,20 @@ Das **Busch-Jäger Unterputz-Internetradio** kann nur Internetradio-Streams absp
## Lösung ## Lösung
Dieses Home Assistant Add-on erstellt ein virtuelles Spotify Connect-Gerät ([librespot](https://github.com/librespot-org/librespot)) und stellt das Audio als MP3- oder AAC-Stream über Icecast bereit. Dieses Home Assistant Add-on erstellt ein virtuelles Spotify Connect-Gerät und stellt das Audio als MP3- oder AAC-Stream über Icecast bereit.
Als Spotify-Empfänger dient ab Version 1.1.0 **[Spotify Soloist](https://developer.spotify.com)**, Spotifys offizieller Client für Linux.
Ohne Soloist-API-Key (und auf 32-Bit-Geräten) läuft weiterhin **[librespot](https://github.com/librespot-org/librespot)** als Rückfall.
> **Warum Soloist?** Spotify verweigert librespot seit 2025/26 bei vielen Konten die Audio-Schlüssel.
> Im Log erscheint dann bei jedem Titel `error audio key 0 1` und es bleibt still
> ([librespot #1649](https://github.com/librespot-org/librespot/issues/1649)). Mit Soloist tritt das nicht auf.
### Funktionsweise ### Funktionsweise
``` ```
Spotify-App → [Spotify Connect] → librespot → PCM → ffmpeg → Icecast2 → HTTP-Stream → Busch-Jäger Radio Spotify-App → [Spotify Connect] → Soloist → PipeWire → pw-record ─┐
librespot (Rückfall) ───────────┴→ PCM → ffmpeg → Icecast → Busch-Jäger Radio
``` ```
--- ---
@@ -31,7 +39,9 @@ Spotify-App → [Spotify Connect] → librespot → PCM → ffmpeg → Icecast2
| Anforderung | Details | | Anforderung | Details |
|---|---| |---|---|
| Home Assistant | OS, Supervised oder Container | | Home Assistant | OS, Supervised oder Container |
| Spotify Premium | Pflicht für Spotify Connect | | Spotify Premium | Pflicht für Spotify Connect und für den Soloist-API-Key |
| Architektur | Soloist: amd64 oder aarch64 (z. B. Raspberry Pi 4/5 mit 64-Bit-OS); 32-Bit nur librespot |
| Internet | Soloist wird beim Start von Spotify geladen und alle 12 h aktualisiert |
| Busch-Jäger Radio | Muss benutzerdefinierte Stream-URLs unterstützen | | Busch-Jäger Radio | Muss benutzerdefinierte Stream-URLs unterstützen |
--- ---
@@ -55,9 +65,23 @@ stream_format: "mp3" # mp3 oder aac
stream_port: 8000 # HTTP-Port des Streams stream_port: 8000 # HTTP-Port des Streams
stream_mount: "/stream" # URL-Pfad stream_mount: "/stream" # URL-Pfad
icecast_password: "geheim" # Icecast-Passwort (bitte ändern) icecast_password: "geheim" # Icecast-Passwort (bitte ändern)
soloist_api_key: "" # Soloist-API-Key (leer = librespot)
``` ```
### 3. Add-on starten & Spotify autorisieren ### 3a. Mit Soloist (empfohlen)
1. Im [Spotify-for-Developers-Dashboard](https://developer.spotify.com/dashboard) mit dem **Premium-Konto** anmelden
2. Im Bereich **Soloist API Key** einen Schlüssel erzeugen
3. Schlüssel in `soloist_api_key` eintragen, speichern, Add-on (neu) starten
4. Im Log steht `Empfänger : soloist`
5. Spotify-App öffnen (Handy **im selben Netz** wie Home Assistant) und **„Busch-Radio"** als Gerät wählen.
Beim ersten Mal meldet sich Soloist dabei mit deinem Konto an, danach bleibt die Anmeldung gespeichert.
Der Schlüssel ist persönlich: nicht weitergeben, nicht in Logs oder Issues posten.
Mit der Nutzung von Soloist gelten die Nutzungsbedingungen von Spotify. Soloist ist **nicht** im Add-on enthalten
(Spotify erlaubt keine Weitergabe), sondern wird beim Start direkt von Spotify geladen.
### 3b. Mit librespot (Rückfall, ohne API-Key)
Beim **ersten Start** erscheint im Log: Beim **ersten Start** erscheint im Log:
@@ -120,7 +144,7 @@ Dann unter **Einstellungen → Integrationen → Busch-Radio Spotify Bridge** ei
| URL | Funktion | | URL | Funktion |
|---|---| |---|---|
| `http://<ha-ip>:5589` | Einrichtungs-Assistent (OAuth) | | `http://<ha-ip>:5589` | Einrichtungs-Assistent (OAuth, nur librespot) |
| `http://<ha-ip>:8000/stream` | Stream-URL für das Radio | | `http://<ha-ip>:8000/stream` | Stream-URL für das Radio |
| `http://<ha-ip>:8000` | Icecast-Statusseite | | `http://<ha-ip>:8000` | Icecast-Statusseite |
@@ -132,23 +156,29 @@ Dann unter **Einstellungen → Integrationen → Busch-Radio Spotify Bridge** ei
| Komponente | Funktion | | Komponente | Funktion |
|---|---| |---|---|
| [librespot](https://github.com/librespot-org/librespot) main | Spotify Connect Client (PCM-Ausgabe via Pipe) | | Spotify Soloist | Offizieller Spotify Connect Client, spielt in eine PipeWire-Senke (amd64/aarch64) |
| [PipeWire](https://pipewire.org) + WirePlumber | Virtuelle Senke `busch_radio`, `pw-record` greift sie als PCM ab |
| [librespot](https://github.com/librespot-org/librespot) main | Rückfall: Spotify Connect Client (PCM-Ausgabe via Pipe) |
| [ffmpeg](https://ffmpeg.org) | PCM → MP3/AAC Transkodierung | | [ffmpeg](https://ffmpeg.org) | PCM → MP3/AAC Transkodierung |
| [Icecast](https://icecast.org) | HTTP-Stream-Server | | [Icecast](https://icecast.org) | HTTP-Stream-Server |
### Signalfluss ### Signalfluss
``` ```
Spotify CDN → librespot (dekodiert, PCM auf stdout) Soloist: Spotify → Soloist → PipeWire-Senke "busch_radio" → pw-record (PCM auf stdout)
librespot: Spotify → librespot (dekodiert, PCM auf stdout)
→ silence-injector (hält Stream bei Pause aufrecht) → silence-injector (hält Stream bei Pause aufrecht)
→ ffmpeg -re (Echtzeit-Encoding → MP3/AAC) → ffmpeg (Encoding → MP3/AAC; bei librespot mit -re für Echtzeit)
→ Icecast (HTTP-Stream) → Icecast (HTTP-Stream)
→ Busch-Jäger Radio → Busch-Jäger Radio
``` ```
### Hinweise zum Build ### Hinweise zum Build
- librespot wird aus dem Quellcode kompiliert (Rust, ~10–15 Min.) - amd64/aarch64 nutzen ein Debian-Basisimage (Soloist braucht glibc ≥ 2.38), 32-Bit bleibt Alpine
- librespot wird aus dem Quellcode kompiliert (Rust, ~10–15 Min.), statisch gelinkt – läuft auf beiden Basisimages
- Soloist liegt in `/data/soloist/bin`; Builds laufen nach 90 Tagen ab, das Add-on lädt rechtzeitig neue
und wechselt, sobald gerade nichts spielt
- Der OAuth-Callback-Server bindet an `0.0.0.0` statt `127.0.0.1`, damit der Browser-Login aus dem Heimnetz funktioniert - Der OAuth-Callback-Server bindet an `0.0.0.0` statt `127.0.0.1`, damit der Browser-Login aus dem Heimnetz funktioniert
- Credentials werden in `/data/librespot-cache/` persistent gespeichert - Credentials werden in `/data/librespot-cache/` persistent gespeichert
@@ -158,7 +188,10 @@ Spotify CDN → librespot (dekodiert, PCM auf stdout)
| Problem | Lösung | | Problem | Lösung |
|---|---| |---|---|
| „Busch-Radio" erscheint nicht in Spotify | Einrichtungs-Seite öffnen: `http://<ha-ip>:5589` | | Jeder Titel wird übersprungen, Log zeigt `error audio key 0 1` | Spotify verweigert librespot für dieses Konto → Soloist-API-Key eintragen (ab 1.1.0) |
| „Busch-Radio" erscheint nicht in Spotify (Soloist) | Handy im selben Netz wie HA? Im Log `Empfänger : soloist` und `Soloist wird gestartet` prüfen |
| `Soloist konnte nicht geladen werden` | Internetzugang von HA prüfen; das Add-on fällt solange auf librespot zurück |
| „Busch-Radio" erscheint nicht in Spotify (librespot) | Einrichtungs-Seite öffnen: `http://<ha-ip>:5589` |
| Stream nicht erreichbar | Icecast-Status prüfen: `http://<ha-ip>:8000` | | Stream nicht erreichbar | Icecast-Status prüfen: `http://<ha-ip>:8000` |
| Stream bricht bei Pause ab | Auf Version 1.0.11+ aktualisieren | | Stream bricht bei Pause ab | Auf Version 1.0.11+ aktualisieren |
| Songs wechseln zu schnell | Auf Version 1.0.10+ aktualisieren | | Songs wechseln zu schnell | Auf Version 1.0.10+ aktualisieren |
@@ -172,12 +205,15 @@ Spotify CDN → librespot (dekodiert, PCM auf stdout)
``` ```
busch-radio-spotify/ busch-radio-spotify/
├── busch_radio_spotify/ # Home Assistant Add-on ├── busch_radio_spotify/ # Home Assistant Add-on
│ ├── Dockerfile # Multi-Stage Build (Rust + Alpine) │ ├── Dockerfile # Multi-Stage Build (Rust → Debian bzw. Alpine)
│ ├── config.yaml # Add-on Manifest & Optionen │ ├── config.yaml # Add-on Manifest & Optionen
│ ├── build.yaml # Multi-Arch Konfiguration │ ├── build.yaml # Multi-Arch Konfiguration
│ ├── DOCS.md # Add-on Dokumentation (in HA angezeigt) │ ├── DOCS.md # Add-on Dokumentation (in HA angezeigt)
│ ├── run.sh # Startup-Script │ ├── run.sh # Startup-Script
│ ├── oauth_helper.py # OAuth-Einrichtungs-Assistent (Port 5589) │ ├── oauth_helper.py # OAuth-Einrichtungs-Assistent (Port 5589, librespot)
│ ├── soloist-fetch.sh # Lädt/aktualisiert Spotify Soloist
│ ├── pipewire/ # PipeWire-Senke für Soloist
│ ├── wireplumber/ # WirePlumber ohne Hardware/D-Bus
│ ├── icon.png # Add-on Icon (Store) │ ├── icon.png # Add-on Icon (Store)
│ └── logo.png # Add-on Logo (Detailseite) │ └── logo.png # Add-on Logo (Detailseite)
├── custom_components/ # Optionale HA Integration ├── custom_components/ # Optionale HA Integration
@@ -195,7 +231,9 @@ busch-radio-spotify/
## Rechtliche Hinweise ## Rechtliche Hinweise
- Dieses Projekt nutzt **librespot**, eine Open-Source-Reimplementierung des Spotify-Clients - **Spotify Soloist** ist Software von Spotify; sie wird nicht mit diesem Projekt verteilt, sondern direkt von Spotify geladen.
Dieses Projekt ist nicht mit Spotify verbunden.
- Als Rückfall nutzt das Projekt **librespot**, eine Open-Source-Reimplementierung des Spotify-Clients
- Audio wird **nicht gespeichert** – ausschließlich live gestreamt - Audio wird **nicht gespeichert** – ausschließlich live gestreamt
- Ausschließlich für den **privaten Heimgebrauch** gedacht - Ausschließlich für den **privaten Heimgebrauch** gedacht
- **Spotify Premium** ist für Spotify Connect erforderlich - **Spotify Premium** ist für Spotify Connect erforderlich
+13
View File
@@ -1,5 +1,18 @@
# Änderungsprotokoll # Änderungsprotokoll
## 1.1.0
- **Spotify Soloist** als neuer Empfänger: Spotifys offizieller Linux-Client ersetzt librespot, sobald
`soloist_api_key` gesetzt ist. Behebt „jeder Titel wird übersprungen“ (`error audio key 0 1`), weil Spotify
librespot bei vielen Konten keine Audio-Schlüssel mehr gibt
- Soloist wird beim Start von Spotify geladen (nicht im Image enthalten) und automatisch aktualisiert
(Builds laufen nach 90 Tagen ab); Audio läuft über eine PipeWire-Senke in die bestehende Icecast-Pipeline
- **librespot bleibt Rückfall**: ohne API-Key, auf 32-Bit-Geräten und wenn Soloist nicht geladen werden kann
- amd64/aarch64 nutzen jetzt ein Debian-Basisimage (Soloist braucht glibc); librespot statisch gelinkt
- **Build-Fix**: librespot hat die OAuth-Ausgabe umgebaut, der alte Patch griff nicht mehr und Neuinstallationen
brachen ab. librespot ist jetzt auf einen festen Commit (0.8.0, `99b6088`) gepinnt
- Dokumentation und README überarbeitet
## 1.0.11 ## 1.0.11
- **Pause-Fix**: Stream reißt bei Spotify-Pause nicht mehr ab – ein Silence-Injektor hält die Icecast-Verbindung aufrecht - **Pause-Fix**: Stream reißt bei Spotify-Pause nicht mehr ab – ein Silence-Injektor hält die Icecast-Verbindung aufrecht
+35 -35
View File
@@ -2,39 +2,37 @@
Streamt Spotify-Musik als Internetradio-Stream für das Busch-Jäger Unterputz-Internetradio. Streamt Spotify-Musik als Internetradio-Stream für das Busch-Jäger Unterputz-Internetradio.
Ein virtuelles Spotify Connect-Gerät (librespot) nimmt Audio entgegen und stellt es per Icecast als HTTP-Stream bereit. Ein virtuelles Spotify Connect-Gerät nimmt Audio entgegen und stellt es per Icecast als HTTP-Stream bereit.
Empfänger ist **Spotify Soloist** (Spotifys offizieller Client); ohne API-Key oder auf 32-Bit-Geräten **librespot**.
``` ```
Spotify-App → librespot → ffmpeg → Icecast → Busch-Jäger Radio Spotify-App → Soloist / librespot → ffmpeg → Icecast → Busch-Jäger Radio
``` ```
--- ---
## Erste Einrichtung ## Erste Einrichtung mit Soloist (empfohlen)
### 1. Add-on konfigurieren und starten 1. Im [Spotify-for-Developers-Dashboard](https://developer.spotify.com/dashboard) mit dem **Premium-Konto** anmelden,
im Bereich **Soloist API Key** einen Schlüssel erzeugen.
2. Schlüssel in `soloist_api_key` eintragen, speichern und das Add-on starten.
Im Log steht dann `Empfänger : soloist`. Beim ersten Start lädt das Add-on Soloist von Spotify (ca. 14 MB).
3. Stream-URL im Radio eintragen: `http://<homeassistant-ip>:8000/stream`
4. In der Spotify-App (Handy **im selben Netz** wie Home Assistant) **„Busch-Radio"** als Gerät wählen.
Beim ersten Mal meldet sich Soloist dabei mit deinem Konto an; die Anmeldung bleibt gespeichert.
Passe die Optionen an (siehe unten) und starte das Add-on. Der Schlüssel ist persönlich – nicht weitergeben und nicht in Logs posten. Es gelten die Nutzungsbedingungen von Spotify.
Soloist ist nicht im Add-on enthalten, sondern wird direkt von Spotify geladen. Builds laufen nach 90 Tagen ab;
das Add-on prüft alle 12 Stunden auf neue und wechselt, sobald gerade nichts spielt.
### 2. Spotify autorisieren (einmalig) ## Erste Einrichtung mit librespot (ohne API-Key)
Öffne den Einrichtungs-Assistenten im Browser: 1. `soloist_api_key` leer lassen und das Add-on starten.
2. Einrichtungs-Assistent öffnen: `http://<homeassistant-ip>:5589` – er führt durch die Spotify-Anmeldung (einmalig).
3. Stream-URL im Radio eintragen und **„Busch-Radio"** in der Spotify-App wählen.
``` > Spotify verweigert librespot bei manchen Konten die Audio-Schlüssel. Dann wird jeder Titel übersprungen und
http://<homeassistant-ip>:5589 > im Log steht `error audio key 0 1`. In dem Fall hilft nur der Wechsel auf Soloist.
```
Der Assistent führt dich Schritt für Schritt durch die Anmeldung. Die Credentials werden dauerhaft gespeichert – dieser Schritt ist nur beim ersten Start nötig.
### 3. Stream-URL im Radio eintragen
```
http://<homeassistant-ip>:8000/stream
```
### 4. Musik abspielen
Wähle in der Spotify-App **„Busch-Radio"** (oder deinen konfigurierten Gerätenamen) als Abspielgerät aus.
--- ---
@@ -48,6 +46,7 @@ Wähle in der Spotify-App **„Busch-Radio"** (oder deinen konfigurierten Gerät
| `stream_port` | `8000` | HTTP-Port des Icecast-Streams | | `stream_port` | `8000` | HTTP-Port des Icecast-Streams |
| `stream_mount` | `/stream` | URL-Pfad des Streams | | `stream_mount` | `/stream` | URL-Pfad des Streams |
| `icecast_password` | – | Internes Icecast-Passwort (bitte ändern) | | `icecast_password` | – | Internes Icecast-Passwort (bitte ändern) |
| `soloist_api_key` | leer | Soloist-API-Key; leer = librespot. Nur amd64/aarch64 |
--- ---
@@ -55,35 +54,36 @@ Wähle in der Spotify-App **„Busch-Radio"** (oder deinen konfigurierten Gerät
| URL | Funktion | | URL | Funktion |
|---|---| |---|---|
| `http://<ha-ip>:5589` | Einrichtungs-Assistent (OAuth) |
| `http://<ha-ip>:8000/stream` | Stream-URL für das Radio | | `http://<ha-ip>:8000/stream` | Stream-URL für das Radio |
| `http://<ha-ip>:8000` | Icecast-Statusseite | | `http://<ha-ip>:8000` | Icecast-Statusseite |
| `http://<ha-ip>:5589` | Einrichtungs-Assistent (nur librespot) |
--- ---
## Fehlerbehebung ## Fehlerbehebung
**Jeder Titel wird übersprungen, Log: `error audio key 0 1`**
→ Spotify verweigert librespot für dieses Konto. Soloist-API-Key eintragen (siehe oben).
**„Busch-Radio" erscheint nicht in der Spotify-App** **„Busch-Radio" erscheint nicht in der Spotify-App**
→ Spotify-Autorisierung noch nicht abgeschlossen. Einrichtungs-Seite öffnen: `http://<ha-ip>:5589` → Soloist: Handy im selben WLAN wie Home Assistant? Im Log nach `Soloist wird gestartet` schauen.
→ librespot: Spotify-Autorisierung abschließen unter `http://<ha-ip>:5589`.
**`Soloist konnte nicht geladen werden – Rückfall auf librespot`**
→ Home Assistant erreicht Spotifys Server nicht (Internet/DNS prüfen). Nach Neustart wird es erneut versucht.
**Stream nicht erreichbar** **Stream nicht erreichbar**
→ Icecast-Statusseite prüfen: `http://<ha-ip>:8000` → Icecast-Statusseite prüfen: `http://<ha-ip>:8000` (Port 8000 muss im Netzwerk erreichbar sein)
→ Port 8000 muss im Netzwerk erreichbar sein (`host_network: true` ist aktiviert)
**Stream bricht bei Pause ab** **Neu anmelden**
→ Add-on auf Version 1.0.11 oder neuer aktualisieren → Soloist: Add-on stoppen → Ordner `/data/soloist/data` löschen → starten → Gerät in der App erneut wählen
→ librespot: Add-on stoppen → `/data/librespot-cache/credentials.json` löschen → starten → Einrichtungs-Seite öffnen
**Songs wechseln zu schnell / keine Steuerung vom Handy**
→ Add-on auf Version 1.0.10 oder neuer aktualisieren
**Neu autorisieren**
→ Add-on stoppen → Datei `/data/librespot-cache/credentials.json` löschen → Add-on starten → Einrichtungs-Seite öffnen
--- ---
## Technische Hinweise ## Technische Hinweise
- amd64/aarch64 laufen auf Debian (Soloist braucht glibc), 32-Bit auf Alpine (nur librespot)
- librespot wird beim Build aus dem Quellcode kompiliert (Rust) – der erste Build dauert ca. 10–15 Minuten - librespot wird beim Build aus dem Quellcode kompiliert (Rust) – der erste Build dauert ca. 10–15 Minuten
- Der OAuth-Callback-Server bindet an `0.0.0.0`, damit er aus dem Heimnetz erreichbar ist
- Audio wird nicht gespeichert – ausschließlich live gestreamt - Audio wird nicht gespeichert – ausschließlich live gestreamt
- Spotify Premium ist für Spotify Connect erforderlich - Spotify Premium ist für Spotify Connect erforderlich
+35 -21
View File
@@ -12,7 +12,8 @@ RUN apk add --no-cache \
openssl-libs-static \ openssl-libs-static \
git git
# Librespot vom aktuellen main-Branch klonen, patchen und kompilieren. # Librespot auf festem Commit des dev-Branchs (2026-10-21) bauen, patchen und kompilieren.
# Fest gepinnt, weil Umbauten upstream sonst die Patches unbemerkt brechen (passiert im Nov. 2026).
# #
# v0.7.0 hat Kompatibilitätsprobleme mit Spotifys aktuellem Backend: # v0.7.0 hat Kompatibilitätsprobleme mit Spotifys aktuellem Backend:
# Spotify liefert keine Audio-Datei-IDs mehr → alle Tracks "not available". # Spotify liefert keine Audio-Datei-IDs mehr → alle Tracks "not available".
@@ -22,12 +23,13 @@ RUN apk add --no-cache \
# 1. println! → eprintln! für "Browse to:"-URL (stdout geht sonst in ffmpeg-Pipe) # 1. println! → eprintln! für "Browse to:"-URL (stdout geht sonst in ffmpeg-Pipe)
# 2. OAuth-Callback-Server auf 0.0.0.0 binden (statt nur 127.0.0.1) # 2. OAuth-Callback-Server auf 0.0.0.0 binden (statt nur 127.0.0.1)
# 3. Deutsche Erfolgs-Meldung nach OAuth # 3. Deutsche Erfolgs-Meldung nach OAuth
RUN git clone --depth 1 \ ARG LIBRESPOT_COMMIT=99b6088bf3ea028f90192676ac1a337fa4b2ed12
https://github.com/librespot-org/librespot.git /build && \ RUN git init -q /build && cd /build && \
cd /build && \ git remote add origin https://github.com/librespot-org/librespot.git && \
git fetch -q --depth 1 origin "${LIBRESPOT_COMMIT}" && git checkout -q FETCH_HEAD && \
# Patch 1: "Browse to:"-URL auf stderr statt stdout. # Patch 1: "Browse to:"-URL auf stderr statt stdout.
sed -i \ sed -i \
-e 's/println!("Browse to: {auth_url}")/eprintln!("Browse to: {auth_url}")/' \ -e 's/println!("Browse to: /eprintln!("Browse to: /g' \
-e 's/println!("Provide redirect URL")/eprintln!("Provide redirect URL")/' \ -e 's/println!("Provide redirect URL")/eprintln!("Provide redirect URL")/' \
oauth/src/lib.rs && \ oauth/src/lib.rs && \
grep -n "eprintln.*Browse to" oauth/src/lib.rs || { echo "FEHLER: println→eprintln Patch fehlgeschlagen!"; exit 1; } && \ grep -n "eprintln.*Browse to" oauth/src/lib.rs || { echo "FEHLER: println→eprintln Patch fehlgeschlagen!"; exit 1; } && \
@@ -37,7 +39,8 @@ RUN git clone --depth 1 \
-e 's/Go back to your terminal :)/Autorisierung erfolgreich! Du kannst diesen Tab schliessen./' \ -e 's/Go back to your terminal :)/Autorisierung erfolgreich! Du kannst diesen Tab schliessen./' \
oauth/src/lib.rs && \ oauth/src/lib.rs && \
grep -n "UNSPECIFIED" oauth/src/lib.rs || { echo "FEHLER: TcpListener-Patch fehlgeschlagen!"; exit 1; } && \ grep -n "UNSPECIFIED" oauth/src/lib.rs || { echo "FEHLER: TcpListener-Patch fehlgeschlagen!"; exit 1; } && \
cargo build \ # OpenSSL statisch: das musl-Binary muss auch im Debian-Image laufen (kein musl-libssl dort)
OPENSSL_STATIC=1 cargo build \
--release \ --release \
--no-default-features \ --no-default-features \
--features "native-tls" && \ --features "native-tls" && \
@@ -45,32 +48,43 @@ RUN git clone --depth 1 \
cp target/release/librespot /install/bin/librespot cp target/release/librespot /install/bin/librespot
# ============================================================ # ============================================================
# Runtime stage: HA-Basis-Image + ffmpeg + icecast # Runtime stage: HA-Basis-Image + ffmpeg + icecast (+ PipeWire für Soloist)
# ============================================================ # ============================================================
# amd64/aarch64: Debian (glibc) – Spotify Soloist braucht glibc ≥ 2.38.
# armhf/armv7: Alpine – für 32-Bit gibt es kein Soloist, dort nur librespot.
# Das librespot-Binary aus dem musl-Build ist statisch gelinkt und läuft auf beiden.
# Soloist selbst steckt NICHT im Image (Spotify erlaubt keine Weitergabe),
# es wird beim Start von Spotify geladen (siehe soloist-fetch.sh).
FROM ${BUILD_FROM} FROM ${BUILD_FROM}
SHELL ["/bin/bash", "-o", "pipefail", "-c"] SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Abhängigkeiten installieren RUN if command -v apk >/dev/null; then \
# icecast liegt in Alpine's Community-Repository apk add --no-cache bash jq curl python3 ffmpeg \
RUN apk add --no-cache \ && { apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community icecast \
bash \ || apk add --no-cache icecast; }; \
jq \ else \
curl \ apt-get update \
python3 \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ffmpeg \ jq curl python3 ffmpeg icecast2 \
&& apk add --no-cache \ pipewire pipewire-bin wireplumber libpipewire-0.3-modules libspa-0.2-modules \
--repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \ libpulse0 libatomic1 \
icecast \ && apt-get clean && rm -rf /var/lib/apt/lists/*; \
|| apk add --no-cache icecast fi
# Librespot-Binary aus dem Build-Stage übernehmen # Librespot-Binary aus dem Build-Stage übernehmen
COPY --from=librespot-builder /install/bin/librespot /usr/local/bin/librespot COPY --from=librespot-builder /install/bin/librespot /usr/local/bin/librespot
RUN chmod +x /usr/local/bin/librespot RUN chmod +x /usr/local/bin/librespot && librespot --version
# PipeWire im Container: virtuelle Senke, die ffmpeg abgreift (nur Soloist)
ENV XDG_RUNTIME_DIR="/run/pipewire"
COPY pipewire/ /etc/pipewire/pipewire.conf.d/
COPY wireplumber/ /etc/wireplumber/wireplumber.conf.d/
# Add-on Dateien kopieren # Add-on Dateien kopieren
COPY run.sh /run.sh COPY run.sh /run.sh
COPY oauth_helper.py /oauth_helper.py COPY oauth_helper.py /oauth_helper.py
RUN chmod a+x /run.sh /oauth_helper.py COPY soloist-fetch.sh /usr/local/bin/soloist-fetch
RUN chmod a+x /run.sh /oauth_helper.py /usr/local/bin/soloist-fetch
CMD ["/run.sh"] CMD ["/run.sh"]
+3 -4
View File
@@ -1,9 +1,8 @@
--- ---
# Multi-Architektur Build-Konfiguration für das HA Add-on. # Multi-Architektur Build-Konfiguration für das HA Add-on.
# Jede Architektur bekommt das passende Alpine-basierte HA-Basisimage. # amd64/aarch64 auf Debian (glibc, für Spotify Soloist), 32-Bit bleibt Alpine (nur librespot).
build_from: build_from:
aarch64: ghcr.io/home-assistant/aarch64-base:latest aarch64: ghcr.io/hassio-addons/debian-base:9.5.0
amd64: ghcr.io/home-assistant/amd64-base:latest amd64: ghcr.io/hassio-addons/debian-base:9.5.0
armhf: ghcr.io/home-assistant/armhf-base:latest armhf: ghcr.io/home-assistant/armhf-base:latest
armv7: ghcr.io/home-assistant/armv7-base:latest armv7: ghcr.io/home-assistant/armv7-base:latest
+6 -3
View File
@@ -1,11 +1,11 @@
--- ---
name: "Busch-Radio Spotify Bridge" name: "Busch-Radio Spotify Bridge"
version: "1.0.11" version: "1.1.0"
slug: busch_radio_spotify slug: busch_radio_spotify
description: > description: >
Streamt Spotify-Musik als Internet-Radio-Stream für das Busch-Jäger Unterputz-Internetradio. 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 Das Add-on erzeugt ein virtuelles Spotify Connect-Gerät (Spotify Soloist, Rückfall librespot)
als MP3- oder AAC-Stream über Icecast bereit. und stellt das Audio als MP3- oder AAC-Stream über Icecast bereit.
url: "https://gitea.bitfire.work/retr0/Busch-Radio-Spotify" url: "https://gitea.bitfire.work/retr0/Busch-Radio-Spotify"
arch: arch:
- aarch64 - aarch64
@@ -27,6 +27,7 @@ options:
stream_port: 8000 stream_port: 8000
stream_mount: "/stream" stream_mount: "/stream"
icecast_password: "busch-radio-geheim" icecast_password: "busch-radio-geheim"
soloist_api_key: ""
schema: schema:
device_name: str device_name: str
@@ -35,6 +36,8 @@ schema:
stream_port: port stream_port: port
stream_mount: str stream_mount: str
icecast_password: str icecast_password: str
# Leer → librespot. Gesetzt (nur amd64/aarch64) → Spotify Soloist.
soloist_api_key: password?
# ---- UI ---- # ---- UI ----
panel_icon: mdi:radio panel_icon: mdi:radio
@@ -0,0 +1,25 @@
# PipeWire im Add-on: eine virtuelle Senke "busch_radio". Soloist spielt dort
# hinein, pw-record greift den Monitor ab und reicht rohes PCM an ffmpeg weiter.
context.properties = {
default.clock.rate = 44100
default.clock.allowed-rates = [ 44100 ]
# Kein D-Bus/rtkit im Container
support.dbus = false
module.rt = false
}
context.objects = [
{ factory = adapter
args = {
factory.name = support.null-audio-sink
node.name = busch_radio
node.description = "Busch-Radio Stream"
media.class = Audio/Sink
audio.position = [ FL FR ]
audio.rate = 44100
# Senke treibt den Graphen auch ohne Hardware-Takt
node.driver = true
priority.session = 2000
}
}
]
+133 -20
View File
@@ -1,11 +1,13 @@
#!/usr/bin/with-contenv bashio #!/command/with-contenv bashio
# ============================================================================== # ==============================================================================
# Busch-Radio Spotify Bridge – Startup-Script # Busch-Radio Spotify Bridge – Startup-Script
# #
# Startet: # Startet:
# 1. Icecast2 – HTTP-Stream-Server # 1. Icecast2 – HTTP-Stream-Server
# 2. OAuth-Hilfe – Einrichtungs-Assistent auf Port 5589 # 2. Spotify-Empfänger, je nach Modus:
# 3. librespot – Virtueller Spotify Connect-Empfänger (PCM auf stdout) # soloist – Spotifys offizieller Client → PipeWire-Senke → pw-record (PCM auf stdout)
# librespot – Rückfall ohne API-Key bzw. auf 32-Bit (PCM auf stdout),
# dazu OAuth-Einrichtungs-Assistent auf Port 5589
# 4. Silence-Injektor– Fügt Stille ein wenn Spotify pausiert (hält Stream aufrecht) # 4. Silence-Injektor– Fügt Stille ein wenn Spotify pausiert (hält Stream aufrecht)
# 5. ffmpeg – Kodiert PCM → MP3/AAC und schickt es als Icecast-Quelle # 5. ffmpeg – Kodiert PCM → MP3/AAC und schickt es als Icecast-Quelle
# #
@@ -21,6 +23,23 @@ STREAM_FORMAT=$(bashio::config 'stream_format')
STREAM_PORT=$(bashio::config 'stream_port') STREAM_PORT=$(bashio::config 'stream_port')
STREAM_MOUNT=$(bashio::config 'stream_mount') STREAM_MOUNT=$(bashio::config 'stream_mount')
ICECAST_PASSWORD=$(bashio::config 'icecast_password') ICECAST_PASSWORD=$(bashio::config 'icecast_password')
SOLOIST_API_KEY=$(bashio::config 'soloist_api_key' '')
# ── Modus wählen: Soloist (mit API-Key, nur 64-Bit) oder librespot ───────────
# librespot bekommt seit 2025/26 bei vielen Konten keine Audio-Schlüssel mehr
# ("error audio key 0 1"); Soloist ist Spotifys offizieller Ersatz.
MODUS="librespot"
if [ -n "${SOLOIST_API_KEY}" ]; then
case "$(uname -m)" in
x86_64|aarch64)
if soloist-fetch; [ $? -ne 1 ] || [ -x /data/soloist/bin/soloist ]; then
MODUS="soloist"
else
bashio::log.warning "Soloist konnte nicht geladen werden – Rückfall auf librespot."
fi ;;
*) bashio::log.warning "Soloist gibt es nicht für $(uname -m) – verwende librespot." ;;
esac
fi
# ── Format-spezifische Einstellungen ────────────────────────────────────────── # ── Format-spezifische Einstellungen ──────────────────────────────────────────
if [ "${STREAM_FORMAT}" = "aac" ]; then if [ "${STREAM_FORMAT}" = "aac" ]; then
@@ -34,9 +53,10 @@ else
fi fi
bashio::log.info "╔══════════════════════════════════════════════╗" bashio::log.info "╔══════════════════════════════════════════════╗"
bashio::log.info "║ Busch-Radio Spotify Bridge v1.0.11 ║" bashio::log.info "║ Busch-Radio Spotify Bridge v1.1.0 ║"
bashio::log.info "╚══════════════════════════════════════════════╝" bashio::log.info "╚══════════════════════════════════════════════╝"
bashio::log.info "Gerätename : ${DEVICE_NAME}" bashio::log.info "Gerätename : ${DEVICE_NAME}"
bashio::log.info "Empfänger : ${MODUS}"
bashio::log.info "Bitrate : ${BITRATE} kbps" bashio::log.info "Bitrate : ${BITRATE} kbps"
bashio::log.info "Format : ${STREAM_FORMAT}" bashio::log.info "Format : ${STREAM_FORMAT}"
bashio::log.info "Stream-Port : ${STREAM_PORT}" bashio::log.info "Stream-Port : ${STREAM_PORT}"
@@ -44,8 +64,10 @@ bashio::log.info "Stream-Pfad : ${STREAM_MOUNT}"
# ── Verzeichnisse anlegen + Berechtigungen für nobody-User setzen ──────────── # ── Verzeichnisse anlegen + Berechtigungen für nobody-User setzen ────────────
# Icecast läuft im Container als root, wechselt aber via changeowner zu nobody. # Icecast läuft im Container als root, wechselt aber via changeowner zu nobody.
# Debian hat keine Gruppe "nobody", sondern "nogroup".
NOBODY_GROUP=$(getent group nobody >/dev/null && echo nobody || echo nogroup)
mkdir -p /var/log/icecast /run/icecast /tmp/busch-radio mkdir -p /var/log/icecast /run/icecast /tmp/busch-radio
chown -R nobody:nobody /var/log/icecast /run/icecast /tmp/busch-radio chown -R "nobody:${NOBODY_GROUP}" /var/log/icecast /run/icecast /tmp/busch-radio
# ── Icecast-Webroot ermitteln ───────────────────────────────────────────────── # ── Icecast-Webroot ermitteln ─────────────────────────────────────────────────
# Alpine und Debian legen Icecast in unterschiedliche Pfade # Alpine und Debian legen Icecast in unterschiedliche Pfade
@@ -129,7 +151,7 @@ cat > /tmp/busch-radio/icecast.xml <<ICECAST_EOF
<!-- Icecast wechselt nach dem Start zu nobody – verhindert den root-Fehler --> <!-- Icecast wechselt nach dem Start zu nobody – verhindert den root-Fehler -->
<changeowner> <changeowner>
<user>nobody</user> <user>nobody</user>
<group>nobody</group> <group>${NOBODY_GROUP}</group>
</changeowner> </changeowner>
</security> </security>
</icecast> </icecast>
@@ -137,7 +159,9 @@ ICECAST_EOF
# ── Icecast starten ─────────────────────────────────────────────────────────── # ── Icecast starten ───────────────────────────────────────────────────────────
bashio::log.info "Icecast wird gestartet (Port: ${STREAM_PORT})..." bashio::log.info "Icecast wird gestartet (Port: ${STREAM_PORT})..."
icecast -c /tmp/busch-radio/icecast.xml & # Alpine: icecast, Debian: icecast2
ICECAST_BIN=$(command -v icecast || command -v icecast2)
"${ICECAST_BIN}" -c /tmp/busch-radio/icecast.xml &
ICECAST_PID=$! ICECAST_PID=$!
# Kurz warten bis Icecast hochgefahren ist # Kurz warten bis Icecast hochgefahren ist
@@ -163,15 +187,17 @@ if [ -z "${HA_IP}" ]; then
HA_IP="<homeassistant-ip>" HA_IP="<homeassistant-ip>"
fi fi
# ── OAuth-Hilfsserver starten ───────────────────────────────────────────────── OAUTH_HELPER_PID=""
# Stellt unter http://<ha-ip>:5589 einen Einrichtungs-Assistenten bereit, if [ "${MODUS}" = "librespot" ]; then
# der den Spotify-OAuth-Prozess Schritt für Schritt erklärt. # ── OAuth-Hilfsserver starten ─────────────────────────────────────────────────
python3 /oauth_helper.py "${HA_IP}" & # Stellt unter http://<ha-ip>:5589 einen Einrichtungs-Assistenten bereit,
OAUTH_HELPER_PID=$! # der den Spotify-OAuth-Prozess Schritt für Schritt erklärt.
bashio::log.info "OAuth-Hilfsseite: http://${HA_IP}:5589" python3 /oauth_helper.py "${HA_IP}" &
OAUTH_HELPER_PID=$!
bashio::log.info "OAuth-Hilfsseite: http://${HA_IP}:5589"
# ── Librespot-Argumente zusammenstellen ─────────────────────────────────────── # ── Librespot-Argumente zusammenstellen ───────────────────────────────────────
LIBRESPOT_ARGS=( LIBRESPOT_ARGS=(
"--name" "${DEVICE_NAME}" "--name" "${DEVICE_NAME}"
"--bitrate" "${BITRATE}" "--bitrate" "${BITRATE}"
"--backend" "pipe" "--backend" "pipe"
@@ -181,12 +207,12 @@ LIBRESPOT_ARGS=(
"--disable-discovery" "--disable-discovery"
"--enable-oauth" "--enable-oauth"
"--system-cache" "${CREDENTIAL_CACHE}" "--system-cache" "${CREDENTIAL_CACHE}"
) )
# Prüfen ob bereits Credentials gecacht sind # Prüfen ob bereits Credentials gecacht sind
if [ -f "${CREDENTIAL_CACHE}/credentials.json" ]; then if [ -f "${CREDENTIAL_CACHE}/credentials.json" ]; then
bashio::log.info "Gespeicherte Credentials gefunden – Direktstart." bashio::log.info "Gespeicherte Credentials gefunden – Direktstart."
else else
bashio::log.info "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" bashio::log.info "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
bashio::log.info "ERSTER START – Spotify-Autorisierung erforderlich!" bashio::log.info "ERSTER START – Spotify-Autorisierung erforderlich!"
bashio::log.info "" bashio::log.info ""
@@ -195,6 +221,8 @@ else
bashio::log.info "" bashio::log.info ""
bashio::log.info "Der Assistent führt dich durch die Anmeldung." bashio::log.info "Der Assistent führt dich durch die Anmeldung."
bashio::log.info "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" bashio::log.info "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
fi
fi fi
# ── Icecast-Source-URL ──────────────────────────────────────────────────────── # ── Icecast-Source-URL ────────────────────────────────────────────────────────
@@ -209,12 +237,17 @@ bashio::log.info "Icecast-Statusseite:"
bashio::log.info " http://${HA_IP}:${STREAM_PORT}" bashio::log.info " http://${HA_IP}:${STREAM_PORT}"
bashio::log.info "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" bashio::log.info "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
bashio::log.info "Wähle '${DEVICE_NAME}' in der Spotify-App als Abspielgerät." bashio::log.info "Wähle '${DEVICE_NAME}' in der Spotify-App als Abspielgerät."
if [ "${MODUS}" = "soloist" ]; then
bashio::log.info "Beim ersten Mal meldet sich Soloist dabei mit deinem Konto an"
bashio::log.info "(Handy im selben Netz wie Home Assistant)."
fi
bashio::log.info "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" bashio::log.info "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# ── Aufräumen bei SIGTERM ───────────────────────────────────────────────────── # ── Aufräumen bei SIGTERM ─────────────────────────────────────────────────────
cleanup() { cleanup() {
bashio::log.info "Add-on wird beendet..." bashio::log.info "Add-on wird beendet..."
kill "${ICECAST_PID}" "${OAUTH_HELPER_PID}" 2>/dev/null || true kill "${ICECAST_PID}" ${OAUTH_HELPER_PID} ${SOLOIST_LOOP_PID:-} ${UPDATER_PID:-} \
${WIREPLUMBER_PID:-} ${PIPEWIRE_PID:-} 2>/dev/null || true
exit 0 exit 0
} }
trap cleanup SIGTERM SIGINT trap cleanup SIGTERM SIGINT
@@ -260,6 +293,86 @@ while True:
RESTART_DELAY=5 RESTART_DELAY=5
ATTEMPT=0 ATTEMPT=0
# ══ Modus Soloist ═════════════════════════════════════════════════════════════
# Soloist → PipeWire-Senke "busch_radio" → pw-record (raw PCM) → Injektor → ffmpeg → Icecast
if [ "${MODUS}" = "soloist" ]; then
SOLOIST_BIN="/data/soloist/bin/soloist"
SOLOIST_DATA="/data/soloist/data"
mkdir -p /data/soloist/cache "${SOLOIST_DATA}" "${XDG_RUNTIME_DIR}"
chmod 0700 "${SOLOIST_DATA}" "${XDG_RUNTIME_DIR}"
bashio::log.info "PipeWire wird gestartet..."
pipewire &
PIPEWIRE_PID=$!
for _ in $(seq 1 50); do [ -S "${XDG_RUNTIME_DIR}/pipewire-0" ] && break; sleep 0.2; done
wireplumber --profile main-embedded &
WIREPLUMBER_PID=$!
# Soloist in eigener Schleife: Absturz oder abgelaufener Build → neu laden und neu starten.
(
while true; do
if [ -x "${SOLOIST_BIN}.new" ]; then
bashio::log.info "Wechsle auf neuen Soloist-Build"
mv -f "${SOLOIST_BIN}.new" "${SOLOIST_BIN}"
mv -f /data/soloist/bin/.etag.new /data/soloist/bin/.etag 2>/dev/null || true
fi
soloist-fetch || true
bashio::log.info "Soloist wird gestartet..."
"${SOLOIST_BIN}" \
--device-name "${DEVICE_NAME}" \
--api-key "${SOLOIST_API_KEY}" \
--data-dir "${SOLOIST_DATA}" \
--cache-dir /data/soloist/cache \
--cache-size 200 \
--initial-volume 100 \
--ws 127.0.0.1:0 \
--pipewire-device busch_radio &
echo $! > /tmp/busch-radio/soloist.pid
wait $! || true
bashio::log.warning "Soloist beendet. Neustart in ${RESTART_DELAY}s..."
sleep "${RESTART_DELAY}"
done
) &
SOLOIST_LOOP_PID=$!
# Builds laufen nach 90 Tagen ab: alle 12 h neuen Build vormerken und
# Soloist neu starten, sobald gerade nichts läuft.
(
while true; do
sleep 43200
soloist-fetch --stage; [ $? -eq 2 ] || continue
while [ "$("${SOLOIST_BIN}" ctl --data-dir "${SOLOIST_DATA}" now --json 2>/dev/null \
| jq -r '.status // empty' 2>/dev/null)" = "playing" ]; do
sleep 60
done
kill "$(cat /tmp/busch-radio/soloist.pid 2>/dev/null)" 2>/dev/null || true
done
) &
UPDATER_PID=$!
while true; do
ATTEMPT=$((ATTEMPT + 1))
bashio::log.info "Stream-Pipeline-Start (Versuch ${ATTEMPT})..."
pw-record --target busch_radio -P '{ stream.capture.sink = true }' \
--rate 44100 --channels 2 --format s16 --raw - \
| python3 -c "${SILENCE_INJECTOR}" \
| ffmpeg \
-hide_banner \
-loglevel warning \
-f s16le -ar 44100 -ac 2 \
-i pipe:0 \
-codec:a "${FFMPEG_CODEC}" \
-b:a "${BITRATE}k" \
-f "${FFMPEG_FORMAT}" \
"${ICECAST_SOURCE_URL}" \
|| true
bashio::log.warning "Stream-Pipeline beendet. Neustart in ${RESTART_DELAY}s..."
sleep "${RESTART_DELAY}"
done
fi
# ══ Modus librespot (Rückfall) ═══════════════════════════════════════════════
while true; do while true; do
ATTEMPT=$((ATTEMPT + 1)) ATTEMPT=$((ATTEMPT + 1))
bashio::log.info "Pipeline-Start (Versuch ${ATTEMPT})..." bashio::log.info "Pipeline-Start (Versuch ${ATTEMPT})..."
+68
View File
@@ -0,0 +1,68 @@
#!/command/with-contenv bashio
# ==============================================================================
# Lädt den offiziellen Spotify-Soloist-Build für diese Architektur.
#
# Spotify erlaubt keine Weitergabe von Soloist, deshalb steckt es nicht im Image,
# sondern wird von Spotifys CDN geholt und in /data/soloist/bin abgelegt.
# Builds laufen 90 Tage nach Veröffentlichung ab; über das ETag des Archivs
# wird ein neuerer Build erkannt.
#
# Aufruf: soloist-fetch [--stage]
# --stage neuen Build als soloist.new ablegen (wird beim nächsten Start übernommen)
# Exit: 0 = aktuell, 1 = Fehler, 2 = neuer Build installiert/abgelegt
# ==============================================================================
set -u
BIN_DIR="/data/soloist/bin"
ZIEL="soloist"; ETAG_DATEI=".etag"
if [ "${1:-}" = "--stage" ]; then ZIEL="soloist.new"; ETAG_DATEI=".etag.new"; fi
case "$(uname -m)" in
aarch64) ARCH="arm64" ;;
x86_64) ARCH="x86_64" ;;
*) bashio::log.error "Soloist gibt es nicht für $(uname -m)"; exit 1 ;;
esac
URL="https://soloist-builds.spotifycdn.com/soloist_release_${ARCH}.tar.gz"
mkdir -p "${BIN_DIR}"
etag() { tr -d '\r' | awk -F': ' 'tolower($1)=="etag" {print $2}' | tail -n 1; }
REMOTE=$(curl -sfIL --max-time 30 "${URL}" | etag) || true
if [ -z "${REMOTE}" ]; then
bashio::log.warning "Spotify-CDN nicht erreichbar (${URL})"
exit 1
fi
KENNUNG="${ARCH} ${REMOTE}"
if [ -x "${BIN_DIR}/${ZIEL}" ] && [ "$(cat "${BIN_DIR}/${ETAG_DATEI}" 2>/dev/null)" = "${KENNUNG}" ]; then
exit 0
fi
# Beim Vormerken: installierter Build ist schon der neueste → nichts tun
if [ "${ZIEL}" = "soloist.new" ] && [ "$(cat "${BIN_DIR}/.etag" 2>/dev/null)" = "${KENNUNG}" ]; then
exit 0
fi
bashio::log.info "Lade Spotify Soloist (${ARCH})..."
TMP=$(mktemp -d "${BIN_DIR}/.download.XXXXXX")
trap 'rm -rf "${TMP}"' EXIT
if ! curl -sfL --max-time 600 -D "${TMP}/headers" -o "${TMP}/soloist.tar.gz" "${URL}"; then
bashio::log.error "Download fehlgeschlagen: ${URL}"
exit 1
fi
KENNUNG="${ARCH} $(etag < "${TMP}/headers")"
if ! tar -xzf "${TMP}/soloist.tar.gz" -C "${TMP}" soloist; then
bashio::log.error "Archiv enthält kein soloist-Programm"
exit 1
fi
chmod 0755 "${TMP}/soloist"
if ! VERSION=$("${TMP}/soloist" --version 2>&1); then
bashio::log.error "Geladener Soloist-Build startet nicht (abgelaufen?): ${VERSION}"
exit 1
fi
mv -f "${TMP}/soloist" "${BIN_DIR}/${ZIEL}"
echo "${KENNUNG}" > "${BIN_DIR}/${ETAG_DATEI}"
if [ "${ZIEL}" = "soloist" ]; then rm -f "${BIN_DIR}/soloist.new" "${BIN_DIR}/.etag.new"; fi
bashio::log.info "Soloist bereit: ${VERSION//$'\n'/, }"
exit 2
@@ -0,0 +1,15 @@
# WirePlumber verbindet nur Soloist mit der virtuellen Senke.
# Keine Hardware, kein D-Bus, keine Benutzersitzung im Container.
override.context.modules = [
{ name = libpipewire-module-protocol-native }
{ name = libpipewire-module-metadata }
]
wireplumber.profiles = {
main-embedded = {
hardware.audio = disabled
hardware.bluetooth = disabled
hardware.video-capture = disabled
support.dbus = disabled
}
}