feat: For You — radio, album suggestions, rediscover, more-from-library
Completes the remaining For You sections by porting two Qobuz API
endpoints down into qbz-core and adding the local "forgotten
favorites" approximation.
Backend ports (qbz-models + qbz-qobuz + qbz-core):
- /album/suggest -> AlbumSuggestResponse, QobuzClient::get_album_suggest,
QbzCore::get_album_suggest.
- /radio/artist + /radio/album -> RadioResponse, get_radio_artist /
get_radio_album on the client + core. (Faithful ports of the legacy
src-tauri/api/client.rs methods — same paths, params, shapes.)
For You sections:
- Radio Stations — album-seeded radio tiles (recent + favorite
albums, deduped, capped 12), rendered with RadioCard; click starts
a real Qobuz album radio.
- More From Your Library — /album/suggest seeded from the most recent
played album (else first favorite).
- Rediscover Your Library — favorite albums not in the local
play-history (approximation of Tauri's reco-DB forgotten
favorites).
- Spotlight's RADIO card + the artist "radio" action now create a
real Qobuz artist radio (playback::play_artist_radio /
play_album_radio build a queue from the radio track list and play).
Section order now matches Tauri: Qobuz Mixes, Release Watch, Radio
Stations, Recently Played Tracks/Albums, Your Top Artists, More From
Your Library, Rediscover, Artists to Follow, Spotlight.
Still backend-blocked: the Qobuz mix detail views (DailyQ/WeeklyQ/etc.)
and the smart radio_engine (the Qobuz radio used here is the simpler
/radio/* endpoint, not the local pool builder).
cc
This commit is contained in:
12 files changed
+457
-14
No files matched your search
@@ -883,6 +883,62 @@ impl QobuzClient {
|
||||
})
|
||||
}
|
||||
|
||||
/// Albums similar to a seed album (`/album/suggest`). Ported from
|
||||
/// the legacy api client.
|
||||
pub async fn get_album_suggest(&self, album_id: &str) -> Result<AlbumSuggestResponse> {
|
||||
let url = endpoints::build_url(paths::ALBUM_SUGGEST);
|
||||
let http_response = self
|
||||
.http
|
||||
.get(&url)
|
||||
.headers(self.api_headers().await?)
|
||||
.query(&[("album_id", album_id)])
|
||||
.send()
|
||||
.await?;
|
||||
let status = http_response.status();
|
||||
if !status.is_success() {
|
||||
return Err(ApiError::ApiResponse(format!(
|
||||
"get_album_suggest({album_id}) status {status}"
|
||||
)));
|
||||
}
|
||||
let response: Value = http_response.json().await?;
|
||||
Ok(serde_json::from_value(response)?)
|
||||
}
|
||||
|
||||
/// Qobuz radio for an artist (`/radio/artist`) — a generated track
|
||||
/// list. Ported from the legacy api client.
|
||||
pub async fn get_radio_artist(&self, artist_id: &str) -> Result<RadioResponse> {
|
||||
self.get_radio(paths::RADIO_ARTIST, "artist_id", artist_id).await
|
||||
}
|
||||
|
||||
/// Qobuz radio for a track (`/radio/track`).
|
||||
pub async fn get_radio_track(&self, track_id: &str) -> Result<RadioResponse> {
|
||||
self.get_radio(paths::RADIO_TRACK, "track_id", track_id).await
|
||||
}
|
||||
|
||||
/// Qobuz radio for an album (`/radio/album`).
|
||||
pub async fn get_radio_album(&self, album_id: &str) -> Result<RadioResponse> {
|
||||
self.get_radio(paths::RADIO_ALBUM, "album_id", album_id).await
|
||||
}
|
||||
|
||||
async fn get_radio(&self, path: &str, key: &str, id: &str) -> Result<RadioResponse> {
|
||||
let url = endpoints::build_url(path);
|
||||
let http_response = self
|
||||
.http
|
||||
.get(&url)
|
||||
.headers(self.authenticated_headers().await?)
|
||||
.query(&[(key, id)])
|
||||
.send()
|
||||
.await?;
|
||||
let status = http_response.status();
|
||||
if !status.is_success() {
|
||||
return Err(ApiError::ApiResponse(format!(
|
||||
"get_radio({path}, {id}) status {status}"
|
||||
)));
|
||||
}
|
||||
let response: Value = http_response.json().await?;
|
||||
Ok(serde_json::from_value(response)?)
|
||||
}
|
||||
|
||||
/// Get list of genres
|
||||
pub async fn get_genres(&self, parent_id: Option<u64>) -> Result<Vec<GenreInfo>> {
|
||||
let url = endpoints::build_url(paths::GENRE_LIST);
|
||||
|
||||
@@ -20,6 +20,12 @@ pub mod paths {
|
||||
pub const ALBUM_GET: &str = "/album/get";
|
||||
pub const ALBUM_SEARCH: &str = "/album/search";
|
||||
pub const ALBUM_GET_FEATURED: &str = "/album/getFeatured";
|
||||
pub const ALBUM_SUGGEST: &str = "/album/suggest";
|
||||
|
||||
// Radio (generated track lists)
|
||||
pub const RADIO_ALBUM: &str = "/radio/album";
|
||||
pub const RADIO_ARTIST: &str = "/radio/artist";
|
||||
pub const RADIO_TRACK: &str = "/radio/track";
|
||||
|
||||
// Artist
|
||||
pub const ARTIST_GET: &str = "/artist/get";
|
||||
|
||||
Reference in new issue
Block a user