0.2.0: play through Spotify Soloist
All checks were successful
release / release (push) Successful in 10m37s

Spotify refuses librespot the audio keys ("error audio key 0 1",
librespot #1649), so nothing played. Playback now goes through Spotify
Soloist, Spotify's own headless Linux player:

- The TV downloads it from Spotify (redistribution is not allowed), keeps
  it fresh (builds expire after 90 days), runs and restarts it, and drives
  it over its local WebSocket API; its events feed Most szól.
- It needs the user's own Soloist API key: the key screen shows a QR code
  to a small page on the TV where the phone pastes it (or type it on the
  TV); asked once after sign-in, also in Settings. Then the TV is picked
  once in the phone's Spotify app (pairing); home shows that step.
- Soloist is the Connect device; librespot only signs in (pairing code)
  and browses. Its player, Connect and zeroconf are gone, and with them
  GStreamer.
- A track from a list plays and the next ones are queued (Soloist's play
  takes one URI). The queue panel is back (Soloist reports the queue).
- Settings: the player's state and key instead of quality/normalisation/
  autoplay (Soloist decides those).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Tamas Csikel
2026-11-03 21:50:44 +01:00
parent 5a76e56fe1
commit 7fd7e242a7
24 changed files with 1274 additions and 1268 deletions

View File

@@ -11,7 +11,9 @@ The page engine and the controller come from Netflex TV (`fennec/netflex`); keep
```
app.toml store manifest (id support.bluefox.spotify; permissions network, gpu, audio)
src/main.rs window, glass layer (lists every exported [GlassRect]), images, controller
src/spotify.rs librespot: session, Spotify Connect (Spirc), sign-in (zeroconf + pairing code), player; Cmd in, Event out
src/spotify.rs the engine: librespot session (pairing-code sign-in, browsing), Cmd in (playback -> Soloist), Event out
src/soloist.rs Spotify Soloist: download/update, run, restart, its WebSocket API -> Events
src/keyserver.rs the local web page where the phone pastes the Soloist key (QR code on the key screen)
src/api.rs the objects pages use, and Api: Internal (normal) or Web (Web API, only with SPOTIFY_MOCK)
src/internal.rs Spotify's internal endpoints via the session: metadata, playlists, /collection/v2, recently played, search, queue command
src/app.rs Controller: screen stack, keys, input/picker/toast, backdrop, sign-in screen, engine events, avatar
@@ -30,7 +32,7 @@ src/task.rs blocking work on a thread, result on the UI thread
ui/app.slint root: screen fades, one FocusScope -> Rust `key`, glass exports
ui/page.slint LinePage: draws the lines Rust lays out (nav, now playing capsule, avatar, keyboard)
ui/nowplaying.slint the now playing screen and its lyrics panel
ui/signin.slint ConnectScreen (QR code + Spotify app), InputScreen, MessageScreen
ui/signin.slint ConnectScreen (pairing code), KeyScreen (Soloist key), InputScreen, MessageScreen
ui/icons.slint SpIcon: shuffle, repeat, heart, lyrics, queue, devices (+ sf-ui's icons)
tools/mock_server.py stand-in Web API with made-up data (with SPOTIFY_MOCK=1: no librespot)
```
@@ -44,7 +46,7 @@ The public Web API is not used against Spotify: librespot's client id gets 429 (
- **Rust owns state and focus.** Slint only draws. Every key goes to `Controller::key`, except while an on-screen keyboard has the focus.
- **Engine thread:** librespot runs on its own tokio runtime. Talk to it with `Engine::send(Cmd)`; its `Event`s reach the UI thread through `slint::invoke_from_event_loop`. Blocking calls (`Engine::token`, `Engine::lyrics`, every `Api` method) only off the UI thread (`task::spawn`, `Cx::spawn`).
- **Playback is Spirc's:** play a context (`Cmd::Context`) whenever possible, so next/previous, shuffle and the phone's view work. `Cx::play` also opens Most szól.
- **Playback is Soloist's** (librespot is refused the audio keys). Its `play` takes one URI: a context plays from its start; a track from a list plays and the next ones are queued (`Cmd::Tracks`). `Cx::play` also opens Most szól. Soloist must not be redistributed: it is downloaded on the TV.
- **Short borrows:** never hold `state.borrow_mut()` while calling `images.load*`; a cached picture calls back at once.
- **Glass:** new glass elements need their `glass` listed in a root `out property <[GlassRect]>`, and that array added in `main.rs`. Nothing Slint draws may sit under a glass pane.
- **Slint names:** a property may not be called `focus` (a function) or `cover` (an ImageFit value).