Some checks failed
release / release (push) Failing after 13s
The public Web API answers librespot's client id with 429 on every call (and the old keymaster token endpoint with 403), so every page failed. Browsing now goes through the same librespot session as playback: metadata, /playlist/v2 (rootlist and lists), /collection/v2 (liked songs, saved albums, followed artists and podcasts; save and like too), recently played, the search context, and a Connect command for the queue. - Home: recently played albums/playlists/artists, your playlists, your artists, saved albums, podcasts (no top lists or new releases there). - Search finds songs; artists and albums come from them. - Playlists without a picture get Spotify's mosaic cover. - The queue panel is gone (the internal API does not show the queue). - The Web API client stays for the mock server only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
4.4 KiB
Markdown
62 lines
4.4 KiB
Markdown
# 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 librespot: session, Spotify Connect (Spirc), sign-in (zeroconf + pairing code), player; Cmd in, Event out
|
|
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 (QR code + Spotify app), 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)`; 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.
|
|
- **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).
|
|
- **Texts are Hungarian.**
|
|
- **Testing on the developer's PC:** never open windows on the primary monitor. Use `SPOTIFY_WINDOW_POS` to put the window on another monitor, or run headless.
|
|
|
|
## Check your change
|
|
|
|
```sh
|
|
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
|
|
```
|