Zeile 1: |
Zeile 1: |
− | == Installation unter Linux === | + | == Installation unter Linux == |
| + | |
| | | |
| Siehe https://www.spotify.com/de/download/linux/ | | Siehe https://www.spotify.com/de/download/linux/ |
| + | |
| + | == Betreiben auf einem monitorlosen Server == |
| + | |
| + | === Halboffizieller Spotify-Client mit XVFB === |
| + | |
| + | Wenn man spotify headless (ohne graphische Anzeige, gesteuert von einer anderen Spotify-Instanz) nutzen will, bietet sich Folgendes an: |
| + | |
| + | * Installation von Spotify auf dem Remote-Rechner |
| + | * Einwahl mit <code>ssh '''-X''' remote-rechner</code> (mit -X zur Weiterleitung des X-Desktops auf den lokalen Desktop) |
| + | * Auf dem Remote-Rechner |
| + | sudo aptitude install xvfb |
| + | spotify |
| + | * Dann wird auf dem lokalen X-Server der Login-Schirm von spotify angezeigt; hier Anmeldedaten angeben. |
| + | * Einwahl mit <code>ssh remote-rechner</code> (dieses Mal ohne -X) |
| + | * Starten von Spotify headless: |
| + | xvfb-run spotify |
| + | |
| + | Der offizielle Client hat eine komfortable GUI. Wenn man ihn aber ohne Monitor betreibt, braucht man diese nicht. Teilweise klappt es bei mehreren Geräten auch [ https://community.spotify.com/t5/Desktop-Linux/Spotify-for-Linux-My-device-is-not-shown-as-available-because-it/m-p/4830830 nicht mit der korrekten Vergabe der Geräte-ID, so dass nicht alle gleichzeitig laufenden offiziellen Clients angesprochen werden können.] Dann ist der im Nachfolgenden beschriebene [[Open Source]]-Client spotifyd die bessere Alternative. |
| + | |
| + | |
| + | |
| + | === Alternativer Client für Linux - nur Soundausgabe === |
| + | |
| + | Der [https://github.com/Spotifyd/spotifyd Spotifyd] ist ein [[Open Source]]-Client, der als so genannter Daemon auf einem Linux-System im Hintergrund werkelt. |
| + | |
| + | Konfiguriert wird er über eine übliche Linux-Konfigurationsdatei. |
| + | |
| + | == Betreiben mit einem HiDPI-Display == |
| + | |
| + | Auf einem hochauflösenden Display kann man die Anzeige mit der Kommandozeilenoption --force-device-scale-factor=1.8 skalieren. 1.8 muss man ggf. an die gewünschte Auflösung anpassen.<ref>Siehe https://community.spotify.com/t5/Desktop-Linux/Linux-client-barely-usable-on-HiDPI-displays/td-p/1067272</ref> |
| + | |
| + | == Begrenzen der Cache-Größe == |
| + | Siehe |
| + | * https://andreas.scherbaum.la/blog/archives/927-Reduce-Spotify-cache-size-under-Linux.html |
| + | |
| + | == Verschieben des Cache unter Linux == |
| + | |
| + | Die Einstellung des Speicherorts scheint beim Linux-Client nicht zu funktionieren. Abhilfe schafft ein symbolischer Link auf den Zielort. |
| + | |
| + | Siehe https://community.spotify.com/t5/Desktop-Linux/Linux-Cache-Location-not-being-respected/m-p/1266695#M4113 |
| + | |
| + | == Spotify Connect Receivers == |
| + | |
| + | === spotifyd === |
| + | |
| + | [https://github.com/Spotifyd/spotifyd Spotifyd] ist ein Daemon/Service, der aus einem Computer ein Spotify Connect Receiver macht. |
| + | Er basiert auf [[#librespot]] |
| + | |
| + | === librespot === |
| + | |
| + | [https://github.com/librespot-org Librespot] ist eine Bibliothek und ein Kommandozeilenprogramm, mit dem man einen headless Spotify Connect - Receiver starten kann. Diesen kann man mit den offiziellen Spotify-Apps steuern, wenn man einen Spotify Premium-Account hat. |
| + | |
| + | Kompiliert wird librespot z.B. so: |
| + | |
| + | cargo build --release --features "alsa-backend,pulseaudio-backend" |
| + | |
| + | Dazu müssen die Entwicklungstools für die Programmiersprache [[Rust]] installiert sein. |
| + | |
| + | Gestartet wird librespot z.B. so: |
| + | |
| + | librespot --name librespotOnMyHtpc --cache /media/data/tmp/cache --device-type tv --backend pulseaudio --initial-volume 20 |
| + | |
| | | |
| == Installation für Kodi == | | == Installation für Kodi == |
| Siehe [[XBMC#Spotify]] | | Siehe [[XBMC#Spotify]] |
| + | |
| + | == Installation für Kodi == |
| + | Siehe [[XBMC#Spotify]] |
| + | |
| + | == Spotify Clients auf der Kommandozeile == |
| + | |
| + | Siehe |
| + | * [https://github.com/Rigellute/spotify-tui spotify-tui], "graphische" Oberfläche fürs Terminal, geschrieben in [[Rust]] |
| + | * [https://lib.rs/crates/spotify_player spotify_player], ebenfalls in [[Rust]] geschrieben |
| + | * [https://github.com/hrkfdn/ncspot ncspot] |
| + | * https://github.com/pwittchen/spotify-cli-linux |
| + | * [https://community.spotify.com/t5/Desktop-Linux/Basic-controls-via-command-line/td-p/4295625 MPRIS commands auf der Kommandozeile für Spotify] (via dbus-send) |
| + | |
| + | == Weitere Spotify Clients == |
| + | |
| + | * https://github.com/KRTirtho/spotube |
| + | |
| + | == Spotify API == |
| + | |
| + | Spotify bietet eine umfangreiche API an. Um sie zu nutzen, muss man |
| + | |
| + | * [https://developer.spotify.com/documentation/general/guides/app-settings/#register-your-app seine "App registrieren", also eine ClientID erzeugen] und |
| + | * sich authorisieren. |
| + | |
| + | === Quick start === |
| + | Für die Authorisierung bietet sich als Einsteigervariante der [https://developer.spotify.com/documentation/general/guides/authorization-guide/#implicit-grant-flow Implicit Grant Flow] an. |
| + | |
| + | Der implicit grant flow kann im Browser nachgestellt werden. In die Adresszeile wird zunächst Folgendes eingegeben: |
| + | https://accounts.spotify.com/authorize?client_id=CLIENTID&response_type=token&redirect_uri=https%3A%2F%2Fpia2016.de%2Fcodicatipps%2F&scope=user-read-playback-state&state=helloworld |
| + | |
| + | Man wird auf die angegebene redirect_uri weitergeleitet. In der Adresszeile gibt es einen Teil der mit <code>access_token=</code> anfängt. Der so angegebene Token (bis zum kaufmännischen '&' ) ist der Bearer-Token, mit dem man dann Abfragen starten kann. |
| + | |
| + | Abfragen des Usernamens: |
| + | curl -v -H "Authorization: Bearer $TOKEN" https://api.spotify.com/v1/me |
| + | |
| + | Abfragen der vorhandenen Geräte:<ref>Siehe https://developer.spotify.com/documentation/web-api/reference/player/get-a-users-available-devices/</ref> |
| + | |
| + | curl -v -H "Authorization: Bearer $TOKEN" https://api.spotify.com/v1/me/player/devices |
| + | |
| + | === Webserver-App === |
| + | |
| + | Siehe |
| + | * https://developer.spotify.com/documentation/web-api/quick-start/ |
| + | |
| + | === Spotify mit Python === |
| + | |
| + | Siehe |
| + | * https://spotipy.readthedocs.io/en/2.16.1/ |
| + | |
| + | === Spotify mit Java === |
| + | |
| + | Siehe |
| + | * https://github.com/librespot-org/librespot-java |
| + | |
| + | === Spotify mit Rust === |
| + | |
| + | Siehe |
| + | * https://docs.rs/rspotify/latest/rspotify/ |
| + | |
| + | == Weiterführendes == |
| + | |
| + | Siehe [[Audio]] |
| + | |
| + | Es gibt eine [https://community.spotify.com/t5/Live-Ideas/Be-able-to-cast-lyrics-with-Chromecast/idi-p/5975441 Spotify-Idee zum Übertragen von Lyrics auf Chromecast], für die man stimmen kann. |
| | | |
| ----- | | ----- |