feat(reco): redesign Recommendations tab — artist/album-centric + LB playlists
Reworks the 4th Discover tab per owner feedback (the track-heavy v1 surfaced already-heard artists). Verified against three sources that Last.fm has NO recommendations API (getRecommendedArtists removed; web is PJAX HTML behind the website cookie, which the API session key cannot reach) — so recommendations are replicated from the documented similarity recipe, and ListenBrainz provides the genuinely clean personalized feeds. New lineup (each row paints progressively as its builder resolves): - Recommended Artists (Last.fm artist.getSimilar seeded by last-month top, minus the heard set; "Similar to X, Y" subtitle on the artist card). - Recommended Albums (Last.fm artist.getTopAlbums minus your scrobbled albums). - Fresh Releases (ListenBrainz, from artists you follow). - Weekly Exploration + Weekly Jams (ListenBrainz curated playlists, by source_patch). - Deep-cut albums from artists you know (Qobuz catalog, not heard in-app). - Cold-start fallback: Qobuz editorial top albums + artists. The "not heard" filter is now ARTIST-level (the v1 bug derived artists from unheard TRACKS) and compares against the LOCAL reco history + a light Last.fm/LB top-set, not a full history sweep. Album validation (UPC -> fuzzy text) added. qbz-integrations gains Last.fm get_artist_top_albums/get_user_top_albums and ListenBrainz get_created_for_playlists/get_playlist_tracks/get_fresh_releases. NOTE: the Cloudflare proxy was switched to allow ALL Last.fm read methods (anything with ".get"), so future reads need NO proxy redeploy — but the live proxy must be redeployed ONCE with this change or all Last.fm reads keep 400ing. cargo check -p qbz green. cc
This commit is contained in:
16 files changed
+1452
-653
No files matched your search
@@ -80,6 +80,17 @@ export component ArtistCard inherits Rectangle {
|
||||
overflow: elide;
|
||||
}
|
||||
|
||||
// Optional "Similar to X, Y" line (external-reco "Recommended Artists").
|
||||
// Empty for every other usage (search / Top Artists / To Follow) -> hidden.
|
||||
if root.artist.subtitle != "": Text {
|
||||
text: root.artist.subtitle;
|
||||
width: 128px;
|
||||
color: Theme.text-muted;
|
||||
font-size: 11px;
|
||||
horizontal-alignment: center;
|
||||
overflow: elide;
|
||||
}
|
||||
|
||||
// Rectangular Follow / Following chip (ADR-008 — no pills). See
|
||||
// `follow-mode`: "auto" shows it only when not yet following,
|
||||
// "toggle" always shows it (and reflects the state), "none" hides it.
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
// Discover > Recommendations — the 4th tab.
|
||||
//
|
||||
// External-recommendations engine (Last.fm + ListenBrainz -> Qobuz) carousels,
|
||||
// plus the Qobuz-editorial cold-start fallback. Mirrors ForYouView: hardcoded
|
||||
// arms, each with its own `length > 0` self-hide gate, reusing the shared
|
||||
// Carousel / SlimCarousel / ArtistCarousel components. Data lives in
|
||||
// ExternalRecoState (populated by crate::external_reco). At runtime exactly one
|
||||
// regime is non-empty: personalized (C1-C4) OR editorial fallback.
|
||||
// External-recommendations engine (Last.fm + ListenBrainz -> Qobuz). Artist /
|
||||
// album / track carousels, each with a `length > 0` self-hide gate; the
|
||||
// controller paints each row the moment its builder resolves (progressive).
|
||||
// Data lives in ExternalRecoState (crate::external_reco). Reuses the shared
|
||||
// Carousel / ArtistCarousel / SlimCarousel components.
|
||||
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Typography } from "../foundation/typography.slint";
|
||||
@@ -22,23 +21,24 @@ export component ExternalRecoView inherits VerticalLayout {
|
||||
callback play-track(string);
|
||||
|
||||
property <bool> any-content:
|
||||
ExternalRecoState.similar-artists.length > 0
|
||||
|| ExternalRecoState.similar-tracks.length > 0
|
||||
|| ExternalRecoState.rediscover-tracks.length > 0
|
||||
|| ExternalRecoState.deep-cut-tracks.length > 0
|
||||
ExternalRecoState.rec-artists.length > 0
|
||||
|| ExternalRecoState.rec-albums.albums.length > 0
|
||||
|| ExternalRecoState.fresh-releases.albums.length > 0
|
||||
|| ExternalRecoState.weekly-exploration.length > 0
|
||||
|| ExternalRecoState.weekly-jams.length > 0
|
||||
|| ExternalRecoState.deep-cut-albums.albums.length > 0
|
||||
|| ExternalRecoState.top-albums.albums.length > 0
|
||||
|| ExternalRecoState.top-artists.length > 0;
|
||||
|
||||
spacing: 40px;
|
||||
alignment: start;
|
||||
|
||||
// Skeleton while the first load is in flight and nothing has painted yet.
|
||||
if ExternalRecoState.loading && !root.any-content: HomeSkeleton { }
|
||||
|
||||
// C1 — Similar artists you haven't heard (artist carousel).
|
||||
if ExternalRecoState.similar-artists.length > 0: ArtistCarousel {
|
||||
title: @tr("Similar artists you haven't heard");
|
||||
artists: ExternalRecoState.similar-artists;
|
||||
// Recommended Artists (Last.fm similar, not heard) — with "Similar to…".
|
||||
if ExternalRecoState.rec-artists.length > 0: ArtistCarousel {
|
||||
title: @tr("Recommended Artists");
|
||||
artists: ExternalRecoState.rec-artists;
|
||||
artist-clicked(id) => {
|
||||
root.open-artist(id);
|
||||
}
|
||||
@@ -47,34 +47,58 @@ export component ExternalRecoView inherits VerticalLayout {
|
||||
}
|
||||
}
|
||||
|
||||
// C2 — Similar tracks you haven't heard (track slim carousel).
|
||||
if ExternalRecoState.similar-tracks.length > 0: SlimCarousel {
|
||||
title: @tr("Similar tracks you haven't heard");
|
||||
items: ExternalRecoState.similar-tracks;
|
||||
// Recommended Albums (Last.fm artist top-albums, not scrobbled).
|
||||
if ExternalRecoState.rec-albums.albums.length > 0: Carousel {
|
||||
section: ExternalRecoState.rec-albums;
|
||||
album-clicked(id) => {
|
||||
root.open-album(id);
|
||||
}
|
||||
media-action(kind, id, action) => {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
|
||||
// Fresh Releases (ListenBrainz, from artists you follow).
|
||||
if ExternalRecoState.fresh-releases.albums.length > 0: Carousel {
|
||||
section: ExternalRecoState.fresh-releases;
|
||||
album-clicked(id) => {
|
||||
root.open-album(id);
|
||||
}
|
||||
media-action(kind, id, action) => {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
|
||||
// Weekly Exploration (ListenBrainz discovery playlist).
|
||||
if ExternalRecoState.weekly-exploration.length > 0: SlimCarousel {
|
||||
title: @tr("Weekly Exploration");
|
||||
items: ExternalRecoState.weekly-exploration;
|
||||
item-clicked(id) => {
|
||||
root.play-track(id);
|
||||
}
|
||||
}
|
||||
|
||||
// C3 — Listened but not recently (re-discovery track carousel).
|
||||
if ExternalRecoState.rediscover-tracks.length > 0: SlimCarousel {
|
||||
title: @tr("Listened, but not lately");
|
||||
items: ExternalRecoState.rediscover-tracks;
|
||||
// Weekly Jams (ListenBrainz familiar playlist).
|
||||
if ExternalRecoState.weekly-jams.length > 0: SlimCarousel {
|
||||
title: @tr("Weekly Jams");
|
||||
items: ExternalRecoState.weekly-jams;
|
||||
item-clicked(id) => {
|
||||
root.play-track(id);
|
||||
}
|
||||
}
|
||||
|
||||
// C4 — From artists you know but not scrobbled (deep cuts).
|
||||
if ExternalRecoState.deep-cut-tracks.length > 0: SlimCarousel {
|
||||
title: @tr("Deep cuts from artists you know");
|
||||
items: ExternalRecoState.deep-cut-tracks;
|
||||
item-clicked(id) => {
|
||||
root.play-track(id);
|
||||
// Deep cuts from artists you know (Qobuz catalog albums).
|
||||
if ExternalRecoState.deep-cut-albums.albums.length > 0: Carousel {
|
||||
section: ExternalRecoState.deep-cut-albums;
|
||||
album-clicked(id) => {
|
||||
root.open-album(id);
|
||||
}
|
||||
media-action(kind, id, action) => {
|
||||
root.media-action(kind, id, action);
|
||||
}
|
||||
}
|
||||
|
||||
// Cold-start fallback — Qobuz editorial top albums (album carousel).
|
||||
// Cold-start fallback — Qobuz editorial top albums.
|
||||
if ExternalRecoState.top-albums.albums.length > 0: Carousel {
|
||||
section: ExternalRecoState.top-albums;
|
||||
album-clicked(id) => {
|
||||
@@ -85,7 +109,7 @@ export component ExternalRecoView inherits VerticalLayout {
|
||||
}
|
||||
}
|
||||
|
||||
// Cold-start fallback — Qobuz editorial top artists (artist carousel).
|
||||
// Cold-start fallback — Qobuz editorial top artists.
|
||||
if ExternalRecoState.top-artists.length > 0: ArtistCarousel {
|
||||
title: @tr("Popular artists on Qobuz");
|
||||
artists: ExternalRecoState.top-artists;
|
||||
@@ -97,7 +121,7 @@ export component ExternalRecoView inherits VerticalLayout {
|
||||
}
|
||||
}
|
||||
|
||||
// Empty state: nothing loaded and not loading (no source, no editorial).
|
||||
// Empty state.
|
||||
if !root.any-content && !ExternalRecoState.loading: VerticalLayout {
|
||||
spacing: 8px;
|
||||
Text {
|
||||
|
||||
Reference in new issue
Block a user