Sleep timer (queue footer): tokio monotonic deadline + 1Hz countdown that fires core().pause() at expiry; presets + custom minutes via a popover. Stop after this song: 4 QbzCore passthroughs + playback consume-before-advance seam and the load-bearing gapless-prefetch gate, plus the queue marker/menu so the Queue persists when playback halts. qbz-log crate: TeeLogger wrapping env_logger (stderr + 5000-line ring + ~/.local/share/qbz/logs/qbz.log) with write-time secret redaction (regex + live-secret registry) and a diagnostics bundle builder. Dev panel logs: in-app viewer that shows content the moment it opens, advanced controls behind a discreet [+], "Copy all" as the sole footer button, a copy button on the upload URL, and a redacted public paste upload. Diagnostics: qbz-app::diagnostics (extracted, src-tauri untouched) feeding a 7-section panel with the live active output device + sample rate/format (pactl) and a complete redacted report for the upload. Report an Issue: wires the header menu item to a 1:1 Tauri modal that opens the GitHub bug-report template. Appearance persistence: 6 toggles that were live-only now persist via ui_prefs + handler arm + startup seed (window-title-show, show-volume-steppers, sidebar-playlist-collage, local-library-track-artwork, in-app-toasts, theme-filter). Recommendations cache (per-tab only): TTL select 24/36/48/72h + Refresh now in ExternalRecoView; no change to the other Discover tabs. Bump workspace version 0.1.0 -> 1.2.15 so app_version is correct in the diagnostics report and the QConnect About string. i18n es/de/fr/pt for all new strings. cc
239 lines
9.3 KiB
Plaintext
239 lines
9.3 KiB
Plaintext
// Discover > Recommendations — the 4th tab.
|
|
//
|
|
// 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).
|
|
// Slow rows (the Weekly ListenBrainz playlists) carry a per-row `pending-*`
|
|
// flag so they show their own skeleton while still loading instead of silently
|
|
// missing while the fast rows are already painted. 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";
|
|
import { ExternalRecoState, ExternalRecoActions } from "../state.slint";
|
|
import { Carousel } from "Carousel.slint";
|
|
import { SlimCarousel } from "SlimCarousel.slint";
|
|
import { ArtistCarousel } from "ArtistCarousel.slint";
|
|
import { HomeSkeleton, SkeletonCarouselRow, SkeletonSlimRow } from "HomeSkeleton.slint";
|
|
import { QbzSelect } from "../primitives/QbzSelect.slint";
|
|
import { SecondaryButton } from "../primitives/SecondaryButton.slint";
|
|
|
|
export component ExternalRecoView inherits VerticalLayout {
|
|
callback open-album(string);
|
|
callback open-artist(string);
|
|
callback media-action(string, string, string);
|
|
callback play-track(string);
|
|
|
|
property <bool> any-content:
|
|
ExternalRecoState.rec-artists-common.length > 0
|
|
|| ExternalRecoState.rec-artists-recent.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;
|
|
|
|
// True while ANY row is still resolving — drives whether the initial
|
|
// full-page skeleton or the per-row skeletons are showing.
|
|
property <bool> any-pending:
|
|
ExternalRecoState.pending-rec-artists-common
|
|
|| ExternalRecoState.pending-rec-artists-recent
|
|
|| ExternalRecoState.pending-rec-albums
|
|
|| ExternalRecoState.pending-fresh-releases
|
|
|| ExternalRecoState.pending-weekly-exploration
|
|
|| ExternalRecoState.pending-weekly-jams
|
|
|| ExternalRecoState.pending-deep-cut-albums
|
|
|| ExternalRecoState.pending-top-albums
|
|
|| ExternalRecoState.pending-top-artists;
|
|
|
|
spacing: 40px;
|
|
alignment: start;
|
|
|
|
// Cache-window controls — pick how long the built recommendations are served
|
|
// from cache before a rebuild, and force an immediate rebuild ("Refresh now").
|
|
HorizontalLayout {
|
|
alignment: end;
|
|
spacing: 8px;
|
|
Text {
|
|
text: @tr("Cache window");
|
|
color: Theme.text-muted;
|
|
font-size: 13px;
|
|
vertical-alignment: center;
|
|
}
|
|
QbzSelect {
|
|
sm: true;
|
|
menu-width: 140px;
|
|
options: [@tr("24 hours"), @tr("36 hours"), @tr("48 hours"), @tr("72 hours")];
|
|
current-index: ExternalRecoState.cache-ttl-index;
|
|
selected(i) => {
|
|
ExternalRecoActions.set-cache-ttl(i);
|
|
}
|
|
}
|
|
SecondaryButton {
|
|
label: @tr("Refresh now");
|
|
clicked => {
|
|
ExternalRecoActions.refresh-now();
|
|
}
|
|
}
|
|
}
|
|
|
|
// Initial full-page skeleton — only until the per-row pending flags are set
|
|
// (or content arrives), after which the individual row skeletons take over.
|
|
if ExternalRecoState.loading && !root.any-content && !root.any-pending: HomeSkeleton { }
|
|
|
|
// More like the artists you love (COMMON taste — overall top).
|
|
if ExternalRecoState.rec-artists-common.length > 0: ArtistCarousel {
|
|
title: @tr("More like the artists you love");
|
|
artists: ExternalRecoState.rec-artists-common;
|
|
card-height: 256px;
|
|
artist-clicked(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if ExternalRecoState.rec-artists-common.length == 0 && ExternalRecoState.pending-rec-artists-common: SkeletonCarouselRow {
|
|
card-size: 180px;
|
|
}
|
|
|
|
// Based on what you've been into lately (RECENT taste — 1-month top).
|
|
if ExternalRecoState.rec-artists-recent.length > 0: ArtistCarousel {
|
|
title: @tr("Based on what you've been into lately");
|
|
artists: ExternalRecoState.rec-artists-recent;
|
|
card-height: 256px;
|
|
artist-clicked(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if ExternalRecoState.rec-artists-recent.length == 0 && ExternalRecoState.pending-rec-artists-recent: SkeletonCarouselRow {
|
|
card-size: 180px;
|
|
}
|
|
|
|
// Recommended Albums (Last.fm artist top-albums, not scrobbled).
|
|
if ExternalRecoState.rec-albums.albums.length > 0: Carousel {
|
|
section: ExternalRecoState.rec-albums;
|
|
card-height: 266px;
|
|
album-clicked(id) => {
|
|
root.open-album(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if ExternalRecoState.rec-albums.albums.length == 0 && ExternalRecoState.pending-rec-albums: SkeletonCarouselRow {
|
|
card-size: 180px;
|
|
}
|
|
|
|
// Fresh Releases (ListenBrainz, from artists you follow).
|
|
if ExternalRecoState.fresh-releases.albums.length > 0: Carousel {
|
|
section: ExternalRecoState.fresh-releases;
|
|
card-height: 266px;
|
|
album-clicked(id) => {
|
|
root.open-album(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if ExternalRecoState.fresh-releases.albums.length == 0 && ExternalRecoState.pending-fresh-releases: SkeletonCarouselRow {
|
|
card-size: 180px;
|
|
}
|
|
|
|
// Weekly Exploration (ListenBrainz discovery playlist).
|
|
if ExternalRecoState.weekly-exploration.length > 0: SlimCarousel {
|
|
title: @tr("Weekly Exploration");
|
|
items: ExternalRecoState.weekly-exploration;
|
|
show-list-actions: true;
|
|
list-action(action) => {
|
|
root.media-action("ext-reco-list", "weekly-exploration", action);
|
|
}
|
|
item-clicked(id) => {
|
|
root.play-track(id);
|
|
}
|
|
}
|
|
if ExternalRecoState.weekly-exploration.length == 0 && ExternalRecoState.pending-weekly-exploration: SkeletonSlimRow { }
|
|
|
|
// Weekly Jams (ListenBrainz familiar playlist).
|
|
if ExternalRecoState.weekly-jams.length > 0: SlimCarousel {
|
|
title: @tr("Weekly Jams");
|
|
items: ExternalRecoState.weekly-jams;
|
|
show-list-actions: true;
|
|
list-action(action) => {
|
|
root.media-action("ext-reco-list", "weekly-jams", action);
|
|
}
|
|
item-clicked(id) => {
|
|
root.play-track(id);
|
|
}
|
|
}
|
|
if ExternalRecoState.weekly-jams.length == 0 && ExternalRecoState.pending-weekly-jams: SkeletonSlimRow { }
|
|
|
|
// Deep cuts from artists you know (Qobuz catalog albums).
|
|
if ExternalRecoState.deep-cut-albums.albums.length > 0: Carousel {
|
|
section: ExternalRecoState.deep-cut-albums;
|
|
card-height: 266px;
|
|
album-clicked(id) => {
|
|
root.open-album(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if ExternalRecoState.deep-cut-albums.albums.length == 0 && ExternalRecoState.pending-deep-cut-albums: SkeletonCarouselRow {
|
|
card-size: 180px;
|
|
}
|
|
|
|
// Cold-start fallback — Qobuz editorial top albums.
|
|
if ExternalRecoState.top-albums.albums.length > 0: Carousel {
|
|
section: ExternalRecoState.top-albums;
|
|
card-height: 266px;
|
|
album-clicked(id) => {
|
|
root.open-album(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if ExternalRecoState.top-albums.albums.length == 0 && ExternalRecoState.pending-top-albums: SkeletonCarouselRow {
|
|
card-size: 180px;
|
|
}
|
|
|
|
// Cold-start fallback — Qobuz editorial top artists.
|
|
if ExternalRecoState.top-artists.length > 0: ArtistCarousel {
|
|
title: @tr("Popular artists on Qobuz");
|
|
artists: ExternalRecoState.top-artists;
|
|
card-height: 256px;
|
|
artist-clicked(id) => {
|
|
root.open-artist(id);
|
|
}
|
|
media-action(kind, id, action) => {
|
|
root.media-action(kind, id, action);
|
|
}
|
|
}
|
|
if ExternalRecoState.top-artists.length == 0 && ExternalRecoState.pending-top-artists: SkeletonCarouselRow {
|
|
card-size: 180px;
|
|
}
|
|
|
|
// Empty state — nothing loaded, nothing pending, not loading.
|
|
if !root.any-content && !root.any-pending && !ExternalRecoState.loading: VerticalLayout {
|
|
spacing: 8px;
|
|
Text {
|
|
text: @tr("No recommendations yet");
|
|
color: Theme.text-primary;
|
|
font-size: 18px;
|
|
font-weight: Typography.semibold;
|
|
}
|
|
Text {
|
|
text: @tr("Connect Last.fm or ListenBrainz in Settings, or play more music, to get personalized recommendations.");
|
|
color: Theme.text-muted;
|
|
font-size: 13px;
|
|
}
|
|
}
|
|
}
|