Introducing a new way to review your PRs.

Read the announcement

crmne / spotifast

Spotify, native and fast. One lightweight Rust app for your whole library, local playback, and Spotify Connect on Linux, macOS, and Windows.

View on GitHub

19 documents · Updated Nov 18, 2026

docs / radio-and-recommendations

Radio and recommendation flows

Radio, recommendations, and listening activity help a listener move from known music to the next song or artist. They connect seed content, personalised Home shelves, and friends' activity to playback and to pages for the related music.

Discovery paths

The discovery paths start from a song, playlist, album, artist, Home shelf, or listening-activity row. Each path either creates a fresh radio mix, offers a recommended track, or opens a related catalogue page.

This diagram shows how the main discovery entry points lead to playback or further exploration.

flowchart LR
    A[Song, playlist, album, or artist] --> B[Radio station]
    B --> C[Station songs]
    C --> D[Play or save as playlist]
    E[Home recommendations] --> F[Recommended tracks]
    F --> G[Play or open album]
    H[Listening activity] --> I[Friend activity row]
    I --> J[Play song]
    I --> K[Open song, artist, album, or context]

The wider discovery model is described in Content discovery and library experiences. Library, search, and release pages provide the catalogue entry points that feed these flows; see Library, search, and releases.

References: src/…/mod.rs• L304-380 src/…/home.rs• L15-60 src/…/player_bar.rs• L1089-1124

Radio stations

A radio station is a fresh Spotify mix based on one seed. The seed can be a song, playlist, album, or artist, and the station page presents the resolved songs as a playable list.

SeedStation identityMain exploration result
SongThe song's radioThe seed song starts the mix
PlaylistThe playlist's radioA mix related to the playlist
AlbumThe album's radioA mix related to the album
ArtistThe artist's radioA mix related to the artist

The station is resolved through the playback session because Spotify can change the mix each time it is requested. The page keeps the songs from the current resolution, so the visible list and the Play action describe the same mix. A song-based station puts its seed first when Spotify returns it elsewhere in the result.

The page names and illustrates the station from the seed when that information is known. It also shows the seed page for non-song seeds, the number and duration of the songs, and a short artist summary. A listener can refresh the mix without losing the current list while the new one loads, then save the shown songs to a new private playlist.

This diagram shows the station lifecycle from an entry point to a stable playable result.

sequenceDiagram
    participant L as Listener
    participant A as App
    participant S as Spotify playback session
    L->>A: Open Radio from seed
    A->>S: Resolve station
    S-->>A: Ordered track mix
    A-->>L: Show and play the resolved songs
    L->>A: Refresh or save
    A->>S: Resolve a new mix or create a playlist

References: src/model.rs• L108-175 src/…/radio.rs• L9-197 src/…/radio.rs• L20-201 src/session_reads.rs• L984-1067

Recommendation shelves

Home uses listening history and top content as entry points into personalised discovery. The Made for you shelf and top mixes present playlist-style suggestions, while Recommended for you presents a track list that can be played directly.

The recommendation flow begins with the active top-song set. The app uses available top tracks as seeds, asks Spotify for a bounded set of recommendations, and places the result in the Home shelf. If no usable seeds exist, the shelf stays empty instead of showing a permanent loading state.

Recommendation cards and rows are not isolated content. Playing a row starts the recommended song, while opening a card or track can lead to its album or another catalogue page. The Home settings can hide the Made for you and Recommended for you shelves without changing the role of the other discovery shelves.

References: src/…/home.rs• L49-60 src/…/home.rs• L327-373 src/…/home.rs• L981-985 src/app.rs• L8521-8559 src/app.rs• L8588-8597 src/settings.rs• L62-80

Listening activity

Listening activity is the social discovery path. It shows what people the listener follows recently played and gives each row enough context to play the song or open the related music.

The listener opens the panel from the player bar. The panel shares the right-side space with Queue and Lyrics, so opening it closes either of those panels and keeps the main page stable. When playback is enabled, the activity refreshes in the background while the panel is open and keeps the last good result during a failed refresh.

Each row combines a person's identity with a song, artist, and playing context. A live item is marked as playing now. The song, artist, and context act as navigation links when Spotify provides a page; a song played on its own uses its album as the useful destination. The avatar plays that song, or pauses and resumes it when it is already the current song.

The activity reader first uses Spotify's live listening feed. If that feed is not available, it uses the older buddy list, which reports recent plays but does not identify who is listening now. Missing or incomplete entries are left out rather than shown as unusable rows.

References: src/…/player_bar.rs• L1105-1124 src/app.rs• L45-46 src/app.rs• L4377-4410 src/app.rs• L13421-13449 src/…/friends.rs• L21-161 src/…/friends.rs• L207-329 src/session_reads.rs• L1250-1360 src/session_reads.rs• L1363-1496

Discovery contracts

These flows share a small set of product contracts. A station is a resolved snapshot, a recommendation is a Home suggestion seeded by listening data, and listening activity is a social view that points back into ordinary playback and catalogue pages.

FlowInputUser-facing resultDownstream path
RadioA supported Spotify seedFresh ordered song mixPlay, refresh, or save
RecommendationsTop-song seeds from HomeSuggested tracksPlay or open catalogue content
Listening activityFollowed people's recent activitySocial activity rowsPlay or open related pages

References: src/model.rs• L972-985 src/model.rs• L674-709 src/session_reads.rs• L1156-1175

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep supported radio seed kinds aligned across URI parsing, page restoration, station resolution, naming, artwork, and the page's seed link.
  • Keep the station's displayed track order aligned with the context used by its Play action and with the songs used by Save radio.
  • Keep Home top-track generation checks aligned with recommendation requests so an older Home refresh cannot replace a newer shelf.
  • Preserve the distinction between an unavailable recommendation endpoint and a temporary recommendation failure. The first hides an empty shelf; the second must not discard usable content.
  • Keep the live listening feed and buddy-list fallback consistent with the row fields used for links, play state, and timestamps.
  • Preserve right-panel exclusivity when adding or changing Queue, Lyrics, or Listening activity controls.

Important failure modes

TriggerConsequenceGuard
Playback is not enabled when radio is openedThe station cannot resolve and the page explains that radio needs playback on this computerEnable playback in Settings before requesting the station
A late radio response belongs to an older requestAn old mix could replace a newer refreshMatch the response to the station generation before accepting it
Spotify resolves no usable station songsThe radio page shows a load failure instead of an empty playable listTreat an empty station resolution as an error
Recommendations return a 403 or 404 with no usable prior resultThe recommendation shelf is omittedRepresent the result as an intentionally empty shelf
The live listening feed is unavailableCurrent listening markers are unavailable, but recent activity can still appearFall back to the buddy list and keep its older-play semantics
The activity read fails before any result existsThe panel shows an error or playback-access guidanceDo not replace an existing loaded result with a refresh error

Key files

FileWhy to read it
src/…/radio.rsCoordinates station naming, artwork, loading, refresh, response acceptance, and saving.
src/…/radio.rsShows the station as a playable discovery page and defines its user actions.
src/session_reads.rsDefines how Spotify station results and social listening activity become app-level content.
src/…/home.rsShows Home recommendation shelves and the playback or page links from their cards and rows.
src/app.rsConnects Home recommendations, station pages, listening activity refreshes, and panel actions to app state.
src/…/friends.rsDefines the social activity panel and the navigation and playback behavior of each row.
src/backend.rsBridges station, recommendation, and listening-activity requests to asynchronous Spotify work.
src/model.rsNames the radio page, radio state, Home recommendation state, and user actions that link the flows.