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>
4.8 KiB
4.8 KiB
Notes for AI agents working on Spotify for Fennec OS
Read first (Fennec SDK, https://gitea.bluefox.support/fennec/sdk):
docs/store-app-guide.md: what a Fennec OS store app must be (manifest, sandbox, remote, packaging, release).docs/sf-ui.md: the UI kit. Liquid Glass model, components, focus, dev tools, pitfalls.
The page engine and the controller come from Netflex TV (fennec/netflex); keep them close to it.
Layout
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 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
src/nowplaying.rs Most szól: playback state, controls, seek, lyrics, queue
src/page.rs the line-based page engine: lines (L) and chips (Ch) -> layout, focus, scroll, lazy images
src/screens/mod.rs sections of the top nav, cards, track rows, the track "+" menu, opening a card id
src/screens/home.rs Kezdőlap: recently played, playlists (+ liked), top artists/tracks, saved albums, new releases
src/screens/search.rs Keresés: embedded keyboard, songs, artists, albums, playlists, podcasts
src/screens/library.rs Könyvtár: tabs, grid, paging (artists by cursor)
src/screens/collection.rs playlist / album / liked songs / podcast: header, Lejátszás/Keverés/Mentés, track rows, paging
src/screens/artist.rs artist: header, popular tracks, albums, singles, appearances
src/screens/settings.rs Beállítások: account, Connect name, quality, normalisation, autoplay, look
src/config.rs config.toml: device id/name, bitrate, normalise, autoplay, glass
src/format.rs Hungarian texts: times, counts, dates
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 (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)
The public Web API is not used against Spotify: librespot's client id gets 429 (rate limit) on every call. Browsing goes through internal.rs.
Rules of this codebase
- 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); itsEvents reach the UI thread throughslint::invoke_from_event_loop. Blocking calls (Engine::token,Engine::lyrics, everyApimethod) only off the UI thread (task::spawn,Cx::spawn). - Playback is Soloist's (librespot is refused the audio keys). Its
playtakes one URI: a context plays from its start; a track from a list plays and the next ones are queued (Cmd::Tracks).Cx::playalso opens Most szól. Soloist must not be redistributed: it is downloaded on the TV. - Short borrows: never hold
state.borrow_mut()while callingimages.load*; a cached picture calls back at once. - Glass: new glass elements need their
glasslisted in a rootout property <[GlassRect]>, and that array added inmain.rs. Nothing Slint draws may sit under a glass pane. - Slint names: a property may not be called
focus(a function) orcover(an ImageFit value). - Texts are Hungarian.
- Testing on the developer's PC: never open windows on the primary monitor. Use
SPOTIFY_WINDOW_POSto put the window on another monitor, or run headless.
Check your change
cargo test
python3 tools/mock_server.py --port 7890 &
SPOTIFY_MOCK=1 SPOTIFY_API=http://127.0.0.1:7890/v1 SF_UI_SIZE=1600x900 \
SF_UI_KEYS="wait wait down enter wait wait" SF_UI_SNAPSHOT=/tmp/shot.png cargo run # then look at /tmp/shot.png