fix(foryou): radio excludes local/Plex, Plex/local artwork, radio nav buttons
- Radio Stations seed only Qobuz-sourced recent albums; local/Plex albums carry ids the Qobuz /radio/album endpoint can't resolve, so they no longer generate radio tiles (they still appear in Recently Played Albums). - Recently Played albums/tracks route artwork by scheme (spawn_search_loads): http -> Qobuz CDN, /library/ or /photo/ -> Plex thumb, else local file. The plain HTTP loader left Plex/local covers blank. - Radio Stations carousel extracted to a RadioCarousel component with prev/next nav buttons (drag preserved), mirroring SlimCarousel. cc
This commit is contained in:
3 files changed
+138
-36
No files matched your search
@@ -23,7 +23,7 @@ import { SlimCarousel } from "SlimCarousel.slint";
|
|||||||
import { ArtistCarousel } from "ArtistCarousel.slint";
|
import { ArtistCarousel } from "ArtistCarousel.slint";
|
||||||
import { Spotlight } from "Spotlight.slint";
|
import { Spotlight } from "Spotlight.slint";
|
||||||
import { QobuzMixesRow } from "QobuzMixesRow.slint";
|
import { QobuzMixesRow } from "QobuzMixesRow.slint";
|
||||||
import { RadioCard } from "RadioCard.slint";
|
import { RadioCarousel } from "RadioCarousel.slint";
|
||||||
import { HomeSkeleton } from "HomeSkeleton.slint";
|
import { HomeSkeleton } from "HomeSkeleton.slint";
|
||||||
|
|
||||||
export component ForYouView inherits VerticalLayout {
|
export component ForYouView inherits VerticalLayout {
|
||||||
@@ -77,40 +77,12 @@ export component ForYouView inherits VerticalLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// radioStations — album-seeded radio tiles (bespoke Flickable body).
|
// radioStations — album-seeded radio tiles (paged carousel w/ nav buttons).
|
||||||
if desc.id == "radioStations" && ForYouState.radio-stations.length > 0: VerticalLayout {
|
if desc.id == "radioStations" && ForYouState.radio-stations.length > 0: RadioCarousel {
|
||||||
spacing: 12px;
|
title: @tr("Radio Stations");
|
||||||
Text {
|
stations: ForYouState.radio-stations;
|
||||||
text: @tr("Radio Stations");
|
start-radio-album(id) => {
|
||||||
color: Theme.text-primary;
|
root.start-radio-album(id);
|
||||||
font-size: 18px;
|
|
||||||
font-weight: Typography.semibold;
|
|
||||||
}
|
|
||||||
Rectangle {
|
|
||||||
height: 234px;
|
|
||||||
clip: true;
|
|
||||||
radio-flick := Flickable {
|
|
||||||
width: 100%;
|
|
||||||
height: parent.height;
|
|
||||||
viewport-width: ForYouState.radio-stations.length * (200px + 32px);
|
|
||||||
viewport-height: self.height;
|
|
||||||
HorizontalLayout {
|
|
||||||
spacing: 32px;
|
|
||||||
alignment: start;
|
|
||||||
for st in ForYouState.radio-stations: RadioCard {
|
|
||||||
seed-title: st.title;
|
|
||||||
seed-subtitle: st.artist;
|
|
||||||
label: @tr("RADIO");
|
|
||||||
artwork: st.artwork;
|
|
||||||
clicked => {
|
|
||||||
root.start-radio-album(st.album-id);
|
|
||||||
}
|
|
||||||
play => {
|
|
||||||
root.start-radio-album(st.album-id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
// Radio Stations carousel for Discover > For You — album-seeded radio tiles in a
|
||||||
|
// paged horizontal Flickable with prev/next nav buttons (drag still works). The
|
||||||
|
// nav buttons mirror SlimCarousel; the body uses RadioCard (the bespoke radio
|
||||||
|
// tile) instead of slim/album cards. Replaces the previous bespoke Flickable
|
||||||
|
// block in ForYouView, which had no navigation buttons.
|
||||||
|
|
||||||
|
import { Theme } from "../foundation/semantic-colors.slint";
|
||||||
|
import { Typography } from "../foundation/typography.slint";
|
||||||
|
import { RadioStationItem } from "../state.slint";
|
||||||
|
import { RadioCard } from "RadioCard.slint";
|
||||||
|
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
||||||
|
|
||||||
|
component NavButton inherits Rectangle {
|
||||||
|
in property <image> icon;
|
||||||
|
in property <bool> enabled: true;
|
||||||
|
callback clicked();
|
||||||
|
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
border-radius: 14px;
|
||||||
|
opacity: root.enabled ? 1.0 : 0.4;
|
||||||
|
background: ta.has-hover && root.enabled
|
||||||
|
? Theme.surface-hover
|
||||||
|
: Theme.surface-elevated;
|
||||||
|
|
||||||
|
QbzIcon {
|
||||||
|
source: root.icon;
|
||||||
|
width: 15px;
|
||||||
|
height: 15px;
|
||||||
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
||||||
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
||||||
|
tint: root.enabled ? Theme.text-primary : Theme.text-muted;
|
||||||
|
}
|
||||||
|
|
||||||
|
ta := TouchArea {
|
||||||
|
enabled: root.enabled;
|
||||||
|
mouse-cursor: root.enabled ? pointer : default;
|
||||||
|
clicked => {
|
||||||
|
root.clicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export component RadioCarousel inherits VerticalLayout {
|
||||||
|
in property <string> title;
|
||||||
|
in property <[RadioStationItem]> stations;
|
||||||
|
callback start-radio-album(string);
|
||||||
|
|
||||||
|
// 200px card + 32px inter-card spacing (matches the HorizontalLayout below).
|
||||||
|
property <length> card-pitch: 232px;
|
||||||
|
property <length> total-width: root.stations.length * root.card-pitch;
|
||||||
|
property <length> max-scroll: Math.max(0px, root.total-width - flick.width);
|
||||||
|
|
||||||
|
spacing: 12px;
|
||||||
|
|
||||||
|
// Header: title + (conditional) page controls — only when the row overflows.
|
||||||
|
HorizontalLayout {
|
||||||
|
Text {
|
||||||
|
text: root.title;
|
||||||
|
color: Theme.text-primary;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: Typography.semibold;
|
||||||
|
vertical-alignment: center;
|
||||||
|
horizontal-stretch: 1;
|
||||||
|
}
|
||||||
|
if root.max-scroll > 0px: HorizontalLayout {
|
||||||
|
spacing: 4px;
|
||||||
|
VerticalLayout {
|
||||||
|
alignment: center;
|
||||||
|
NavButton {
|
||||||
|
icon: @image-url("../assets/icons/chevron-left.svg");
|
||||||
|
enabled: flick.viewport-x < -1px;
|
||||||
|
clicked => {
|
||||||
|
flick.viewport-x = Math.min(0px, flick.viewport-x + flick.width);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
VerticalLayout {
|
||||||
|
alignment: center;
|
||||||
|
NavButton {
|
||||||
|
icon: @image-url("../assets/icons/chevron-right.svg");
|
||||||
|
enabled: flick.viewport-x > -root.max-scroll + 1px;
|
||||||
|
clicked => {
|
||||||
|
flick.viewport-x = Math.max(-root.max-scroll, flick.viewport-x - flick.width);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
height: 234px;
|
||||||
|
clip: true;
|
||||||
|
flick := Flickable {
|
||||||
|
width: 100%;
|
||||||
|
height: parent.height;
|
||||||
|
viewport-width: root.total-width;
|
||||||
|
viewport-height: self.height;
|
||||||
|
HorizontalLayout {
|
||||||
|
spacing: 32px;
|
||||||
|
alignment: start;
|
||||||
|
for st in root.stations: RadioCard {
|
||||||
|
seed-title: st.title;
|
||||||
|
seed-subtitle: st.artist;
|
||||||
|
label: @tr("RADIO");
|
||||||
|
artwork: st.artwork;
|
||||||
|
clicked => {
|
||||||
|
root.start-radio-album(st.album-id);
|
||||||
|
}
|
||||||
|
play => {
|
||||||
|
root.start-radio-album(st.album-id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -470,6 +470,14 @@ fn build_radio(
|
|||||||
let mut radio_seen: HashSet<String> = HashSet::new();
|
let mut radio_seen: HashSet<String> = HashSet::new();
|
||||||
let mut radio_stations: Vec<RadioSeed> = Vec::new();
|
let mut radio_stations: Vec<RadioSeed> = Vec::new();
|
||||||
for a in recent_album_list {
|
for a in recent_album_list {
|
||||||
|
// Radio Stations seed a Qobuz album radio (/radio/album), so only
|
||||||
|
// Qobuz-sourced albums are eligible. Locally-played / Plex albums carry
|
||||||
|
// ids the Qobuz radio endpoint can't resolve, so they must NOT appear
|
||||||
|
// here (they still show in "Recently Played Albums"). Empty source =
|
||||||
|
// legacy pre-source entry, treated as Qobuz.
|
||||||
|
if !(a.source.is_empty() || a.source.eq_ignore_ascii_case("qobuz")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if radio_seen.insert(a.id.clone()) {
|
if radio_seen.insert(a.id.clone()) {
|
||||||
radio_stations.push(RadioSeed {
|
radio_stations.push(RadioSeed {
|
||||||
album_id: a.id.clone(),
|
album_id: a.id.clone(),
|
||||||
@@ -651,7 +659,12 @@ fn apply_recent(
|
|||||||
.collect();
|
.collect();
|
||||||
state.set_recent_tracks(ModelRc::new(VecModel::from(slim)));
|
state.set_recent_tracks(ModelRc::new(VecModel::from(slim)));
|
||||||
});
|
});
|
||||||
crate::artwork::spawn_loads(jobs, weak.clone(), cache.clone());
|
// Recently-played albums/tracks mix sources (Qobuz / Plex / local), so the
|
||||||
|
// artwork must be routed by scheme: http -> Qobuz CDN, /library/ or /photo/
|
||||||
|
// -> Plex thumb (tokenized LAN fetch), else a local file read. The plain
|
||||||
|
// HTTP loader (spawn_loads) left Plex and local covers blank.
|
||||||
|
let plex = crate::plex_settings::get();
|
||||||
|
crate::artwork::spawn_search_loads(jobs, plex.base_url, plex.token, weak.clone(), cache.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn apply_release_watch(weak: &slint::Weak<AppWindow>, cache: &ImageCache, cards: Vec<AlbumCard>) {
|
fn apply_release_watch(weak: &slint::Weak<AppWindow>, cache: &ImageCache, cards: Vec<AlbumCard>) {
|
||||||
|
|||||||
Reference in new issue
Block a user