Files
Busch-Radio-Spotify/busch_radio_spotify/soloist-fetch.sh
T
Niklas GühneandClaude Opus 5.5 99c910f488 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
2026-11-04 15:26:50 +01:00

69 lines
2.6 KiB
Bash

#!/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