fix(qt): size-aware now-playing artwork, up to the mega tier
Restored queues and recently_played carried whatever variant the building surface picked — 50px JPEGs measured in the wild — into the now-playing bar, MPRIS, Discord and the immersive big slots. The np feed rewrites sized Qobuz covers up to 600px; big slots (immersive panels, split, preview overlay) resolve per size bucket through npArtworkPathLarge with one re-resolve per tier crossed and never on shrink. Registry-miss arm (restored sessions carry no ImageSet): rewrite to the FULL requested bucket with a session negative cache, so a pre-mega album pays one 404 per session instead of one per track change. And the mega tier's wire suffix is the literal _max.jpg, not _3000 (404 measured against the live CDN) — qobuz_cover_at_px now accepts and emits _max. Local covers gain an on-demand 1600px tier (never upscaled); Plex big slots tokenize at 1024. km
This commit is contained in:
22 files changed
+993
-16
No files matched your search
@@ -58,14 +58,20 @@ Item {
|
||||
width: 220
|
||||
height: 220
|
||||
fillMode: Image.PreserveAspectFit
|
||||
// The .slint prefers `artwork-large` and falls back to `artwork`;
|
||||
// this port publishes only one cover path (player_bridge
|
||||
// .np_artwork_path), which is the cached original — 600px for a
|
||||
// Qobuz cover, so the 220px preview is a downscale either way.
|
||||
source: QbzPlayer.npArtworkPath
|
||||
// D2 (contract 04 §4): the small feed is now the thumbnail
|
||||
// variant (150px), too small for a 220px preview — prefer the
|
||||
// size-resolved large feed, fall back to the small one. The
|
||||
// request below asks with 2x DPR headroom (440 -> the 600
|
||||
// bucket).
|
||||
source: QbzPlayer.npArtworkPathLarge !== ""
|
||||
? QbzPlayer.npArtworkPathLarge : QbzPlayer.npArtworkPath
|
||||
asynchronous: true
|
||||
smooth: true
|
||||
mipmap: true
|
||||
}
|
||||
}
|
||||
|
||||
// Ask for the large feed while the preview is up (bucketed in Rust —
|
||||
// repeated shows of the same track at the same size are no-ops).
|
||||
onVisibleChanged: if (visible) QbzPlayer.requestNpArtworkSize(440)
|
||||
}
|
||||
@@ -1035,6 +1035,8 @@ fn map_release_card(release: &qbz_models::PageArtistRelease) -> AlbumCardData {
|
||||
quality_detail: home_qt::quality_detail_from_parts(bit_depth, sample_rate),
|
||||
art_url: crate::cover_artwork_qt::prefer_album_cover(
|
||||
&release.id,
|
||||
// Release grid card: full variant (best()) — the down-tier was
|
||||
// reverted after the 2026-08-15 owner smoke (contract 04 §3).
|
||||
release
|
||||
.image
|
||||
.as_ref()
|
||||
@@ -1139,6 +1141,9 @@ pub async fn load_suggestions(
|
||||
quality_detail: home_qt::quality_detail_from_parts(bit_depth, sample_rate),
|
||||
art_url: crate::cover_artwork_qt::prefer_album_cover(
|
||||
&a.id,
|
||||
// Recommendation grid card: full variant (best()) — the
|
||||
// down-tier was reverted after the 2026-08-15 owner smoke
|
||||
// (contract 04 §3).
|
||||
a.image.best().cloned().unwrap_or_default(),
|
||||
),
|
||||
}
|
||||
|
||||
@@ -442,6 +442,8 @@ pub(crate) fn map_release(release: &PageArtistRelease) -> AlbumCardData {
|
||||
quality_detail: home_qt::quality_detail_from_parts(bit_depth, sample_rate),
|
||||
art_url: crate::cover_artwork_qt::prefer_album_cover(
|
||||
&release.id,
|
||||
// Discography grid card: full variant (best()) — the down-tier
|
||||
// was reverted after the 2026-08-15 owner smoke (contract 04 §3).
|
||||
release
|
||||
.image
|
||||
.as_ref()
|
||||
|
||||
@@ -77,6 +77,14 @@ const HTTP_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10);
|
||||
/// now-playing bar / the sidebar dock, which all render well under it.
|
||||
pub const PLEX_THUMB_PX: u32 = 256;
|
||||
|
||||
/// The ONE larger Plex transcode tier (contract 04 §3): only the big slots
|
||||
/// (immersive main art, lightbox-class surfaces) tokenize at 1024; every list
|
||||
/// stays at [`PLEX_THUMB_PX`]. The transcode url carries `width=`, so the two
|
||||
/// tiers are separate cache entries by construction. (The Slint app passes
|
||||
/// per-surface sizes — `qbz/src/artwork.rs:555-566` — so this is parity, not
|
||||
/// invention.)
|
||||
pub const PLEX_THUMB_PX_LARGE: u32 = 1024;
|
||||
|
||||
/// Memo ceiling. The memo is an accelerator, not a source of truth, so it is
|
||||
/// cleared wholesale rather than carrying LRU bookkeeping.
|
||||
const MEMO_CAP: usize = 8192;
|
||||
@@ -445,15 +453,43 @@ pub async fn download_missing(urls: Vec<String>) {
|
||||
// Now-playing artwork (phase 4)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// The pixel tier the now-playing feed (`npArtworkPath`) resolves Qobuz
|
||||
/// covers at. The queue persists WHATEVER variant the building surface
|
||||
/// picked — a restored session can carry the 50px `small` (measured in the
|
||||
/// owner's image cache 2026-08-15: 50x50 JPEGs, pixelated art on the NPB,
|
||||
/// MPRIS and immersive). 600 covers every consumer of this feed (NPB large,
|
||||
/// the preview overlay, the sidebar dock, queue rows through the derivative
|
||||
/// layer); bigger immersive slots are served by the large feed below.
|
||||
const NP_FEED_PX: u32 = 600;
|
||||
|
||||
/// The url the now-playing feed actually resolves: a sized Qobuz cover is
|
||||
/// rewritten to [`NP_FEED_PX`] (`qbz_models::qobuz_cover_at_px`); everything
|
||||
/// else (local files, Plex thumbs, unsized urls) passes through. A custom
|
||||
/// cover override is keyed on the url the surfaces carry, so its presence
|
||||
/// pins the original — the rewrite must not route around it.
|
||||
fn np_feed_url(url: &str) -> String {
|
||||
if !crate::cover_artwork_qt::override_for_url(url).is_empty() {
|
||||
return url.to_string();
|
||||
}
|
||||
qbz_models::qobuz_cover_at_px(url, NP_FEED_PX).unwrap_or_else(|| url.to_string())
|
||||
}
|
||||
|
||||
/// Attach the current track's artwork to the NowPlayingModel: a disk hit (or
|
||||
/// a local file, which is always a hit) applies immediately; a miss downloads
|
||||
/// in the background and then republishes.
|
||||
pub fn attach_now_playing(url: &str) {
|
||||
// D2 track edge: the size-aware large feed belongs to the track that just
|
||||
// ended. Clear it, and re-resolve at the pending bucket when a panel has
|
||||
// one outstanding (the QML side only calls `requestNpArtworkSize` on
|
||||
// bucket/visibility changes, so without this kick a track change with a
|
||||
// settled window would leave the immersive art on the small feed).
|
||||
restart_now_playing_large();
|
||||
if url.is_empty() {
|
||||
crate::now_playing::set_artwork_path(String::new());
|
||||
return;
|
||||
}
|
||||
let hit = cached_path(url);
|
||||
let feed = np_feed_url(url);
|
||||
let hit = cached_path(&feed);
|
||||
if !hit.is_empty() {
|
||||
crate::now_playing::set_artwork_path(hit);
|
||||
return;
|
||||
@@ -461,22 +497,273 @@ pub fn attach_now_playing(url: &str) {
|
||||
// Nothing fetchable (a missing local cover, Plex not connected): clear
|
||||
// the bar instead of leaving the previous track's cover behind.
|
||||
if matches!(
|
||||
classify(url),
|
||||
classify(&feed),
|
||||
ArtUrl::Empty | ArtUrl::LocalFile(_) | ArtUrl::PlexUnconfigured
|
||||
) {
|
||||
crate::now_playing::set_artwork_path(String::new());
|
||||
return;
|
||||
}
|
||||
let url = url.to_string();
|
||||
crate::spawn(async move {
|
||||
download_missing(vec![url.clone()]).await;
|
||||
let path = cached_path(&url);
|
||||
download_missing(vec![feed.clone()]).await;
|
||||
let path = cached_path(&feed);
|
||||
if !path.is_empty() {
|
||||
crate::now_playing::set_artwork_path(path);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Size-aware LARGE now-playing art (contract 2026-08-15-immersive-completion
|
||||
// 04 §4 — workstream D2)
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// `npArtworkPath` stays the fallback feed — the queue-build sites' best()
|
||||
// pick, with sized Qobuz covers rewritten UP to [`NP_FEED_PX`] (a restored
|
||||
// queue can carry the 50px `small`; owner smoke 2026-08-15). The immersive
|
||||
// panels (Static / AlbumReactive /
|
||||
// SPLIT) compute their slot size, call `QbzPlayer.requestNpArtworkSize(px)`,
|
||||
// and bind `npArtworkPathLarge` with a fallback to `npArtworkPath` (the Slint
|
||||
// `artwork-large.width > 0 ? artwork-large : artwork` pattern). Re-resolution
|
||||
// is BUCKETED on `qbz_models::ImageSet::bucket_for_px` — one landing (and one
|
||||
// notify) per size tier crossed, never per resize pixel (pulse law), and a
|
||||
// SHRINK never re-fetches: the already-cached larger file downscales through
|
||||
// the RoundedImage derivative layer.
|
||||
|
||||
/// album id -> the full Qobuz variant set, registered at queue-build time
|
||||
/// (the only place the `ImageSet` still exists — `QueueTrack` flattens it to
|
||||
/// one url). Capped, cleared wholesale: an accelerator, not a source of
|
||||
/// truth; a miss just keeps the large feed on the small-feed url.
|
||||
static NP_VARIANTS: LazyLock<RwLock<HashMap<String, qbz_models::ImageSet>>> =
|
||||
LazyLock::new(|| RwLock::new(HashMap::new()));
|
||||
|
||||
const NP_VARIANTS_CAP: usize = 512;
|
||||
|
||||
/// Queue-build sites call this with the album's full `ImageSet` so the large
|
||||
/// feed can re-pick the variant per size bucket later.
|
||||
pub fn note_np_variants(album_id: &str, image: &qbz_models::ImageSet) {
|
||||
if album_id.is_empty() || image.best().is_none() {
|
||||
return;
|
||||
}
|
||||
if let Ok(mut map) = NP_VARIANTS.write() {
|
||||
if map.len() >= NP_VARIANTS_CAP {
|
||||
map.clear();
|
||||
}
|
||||
map.insert(album_id.to_string(), image.clone());
|
||||
}
|
||||
}
|
||||
|
||||
fn np_variants(album_id: &str) -> Option<qbz_models::ImageSet> {
|
||||
NP_VARIANTS.read().ok()?.get(album_id).cloned()
|
||||
}
|
||||
|
||||
/// The last large-art request: which track it serves and the biggest bucket
|
||||
/// requested for it. `bucket == 0` = no panel has asked for large art this
|
||||
/// session (the common case: immersive never opened), so track edges cost
|
||||
/// nothing.
|
||||
struct LargeReq {
|
||||
track_id: u64,
|
||||
bucket: u32,
|
||||
}
|
||||
|
||||
static NP_LARGE: Mutex<LargeReq> = Mutex::new(LargeReq {
|
||||
track_id: 0,
|
||||
bucket: 0,
|
||||
});
|
||||
|
||||
/// Registry-miss rewrites that already failed this session (a 404 = the
|
||||
/// album predates the mega tier; a network failure pins the same way, and
|
||||
/// self-heals on the next launch). One miss per url EVER: without this a
|
||||
/// pre-mega album would cost a 404 on EVERY track change — the reason the
|
||||
/// rewrite used to be capped at [`NP_FEED_PX`]. The cap is what left
|
||||
/// restored-queue art soft on the big slots: a restored session carries no
|
||||
/// `ImageSet`, every smoke of the owner starts from one, and 600px into a
|
||||
/// ~1000px split slot reads as pixelation (owner smoke 2026-08-15 night).
|
||||
static NP_LARGE_NEG: LazyLock<RwLock<HashSet<String>>> =
|
||||
LazyLock::new(|| RwLock::new(HashSet::new()));
|
||||
|
||||
/// `QbzPlayer.requestNpArtworkSize(px)` — a panel reports its art slot size
|
||||
/// (CSS px; the same expression as its artProbe cap, minus the native clamp,
|
||||
/// which stays the final safety). Bucketed + deduped: a resize drag costs at
|
||||
/// most one resolve per tier crossed, and requests at or below the tier
|
||||
/// already resolved for this track are no-ops.
|
||||
pub fn request_now_playing_art(px: i32) {
|
||||
if px <= 0 {
|
||||
return;
|
||||
}
|
||||
let bucket = qbz_models::ImageSet::bucket_for_px(px as u32);
|
||||
let seed = crate::now_playing::art_seed();
|
||||
if seed.url.is_empty() {
|
||||
return;
|
||||
}
|
||||
{
|
||||
let mut lr = NP_LARGE.lock().unwrap();
|
||||
if lr.track_id == seed.track_id && bucket <= lr.bucket {
|
||||
return;
|
||||
}
|
||||
lr.track_id = seed.track_id;
|
||||
lr.bucket = bucket;
|
||||
}
|
||||
resolve_np_large(seed, bucket);
|
||||
}
|
||||
|
||||
/// Track edge (called from [`attach_now_playing`]): drop the previous track's
|
||||
/// large path and re-resolve at the pending bucket, if any.
|
||||
fn restart_now_playing_large() {
|
||||
crate::now_playing::set_artwork_path_large(String::new());
|
||||
let bucket = NP_LARGE.lock().unwrap().bucket;
|
||||
if bucket == 0 {
|
||||
return;
|
||||
}
|
||||
let seed = crate::now_playing::art_seed();
|
||||
if seed.url.is_empty() {
|
||||
return;
|
||||
}
|
||||
NP_LARGE.lock().unwrap().track_id = seed.track_id;
|
||||
resolve_np_large(seed, bucket);
|
||||
}
|
||||
|
||||
/// Kick the async resolve; the landing publishes ONLY if the track is still
|
||||
/// current (a slow Plex transcode must not stamp the previous track's art
|
||||
/// onto the new one).
|
||||
fn resolve_np_large(seed: crate::now_playing::ArtSeed, bucket: u32) {
|
||||
crate::spawn(async move {
|
||||
let path = resolve_large(&seed, bucket).await;
|
||||
if crate::now_playing::art_seed().track_id == seed.track_id {
|
||||
// "" on failure: the QML fallback keeps showing npArtworkPath.
|
||||
crate::now_playing::set_artwork_path_large(path);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Where the large art for `seed` at size `bucket` comes from:
|
||||
/// - Qobuz (registry hit): the `ImageSet::for_px` variant url, through the
|
||||
/// shared disk cache like any remote cover;
|
||||
/// - Qobuz (registry miss — a restored queue keeps no `ImageSet`): the
|
||||
/// seed url's size suffix rewritten to `min(bucket, 600)`
|
||||
/// (`qbz_models::qobuz_cover_at_px`);
|
||||
/// - Plex: the 1024px transcode tier ([`PLEX_THUMB_PX_LARGE`]);
|
||||
/// - Local: the on-demand 1600px tier (`local_artwork::large_art_blocking`);
|
||||
/// - anything else: "" — the fallback shows the small feed.
|
||||
async fn resolve_large(seed: &crate::now_playing::ArtSeed, bucket: u32) -> String {
|
||||
if !matches!(seed.source.as_str(), "local" | "plex") {
|
||||
if let Some(set) = np_variants(&seed.album_id) {
|
||||
if let Some(url) = set.for_px(bucket).cloned() {
|
||||
let hit = cached_path(&url);
|
||||
if !hit.is_empty() {
|
||||
return hit;
|
||||
}
|
||||
download_missing(vec![url.clone()]).await;
|
||||
return cached_path(&url);
|
||||
}
|
||||
}
|
||||
// Registry miss (a restored queue flattens tracks to ONE url, so no
|
||||
// ImageSet survives): a sized Qobuz cover still upgrades by suffix
|
||||
// rewrite, now to the FULL requested bucket — the 600 cap this used
|
||||
// to have left restored-queue art soft on every big slot (see
|
||||
// NP_LARGE_NEG). A 404 (a pre-mega album) is paid ONCE per url per
|
||||
// session thanks to the negative set, never per track change. A
|
||||
// custom cover override answers the small feed already, so the large
|
||||
// feed stays empty and the QML fallback shows it.
|
||||
if !crate::cover_artwork_qt::override_for_url(&seed.url).is_empty() {
|
||||
return String::new();
|
||||
}
|
||||
if let Some(upgraded) = qbz_models::qobuz_cover_at_px(&seed.url, bucket) {
|
||||
if NP_LARGE_NEG.read().ok().is_some_and(|n| n.contains(&upgraded)) {
|
||||
return String::new();
|
||||
}
|
||||
let hit = cached_path(&upgraded);
|
||||
if !hit.is_empty() {
|
||||
return hit;
|
||||
}
|
||||
download_missing(vec![upgraded.clone()]).await;
|
||||
let got = cached_path(&upgraded);
|
||||
if got.is_empty() {
|
||||
if let Ok(mut n) = NP_LARGE_NEG.write() {
|
||||
n.insert(upgraded);
|
||||
}
|
||||
}
|
||||
return got;
|
||||
}
|
||||
return String::new();
|
||||
}
|
||||
// Plex: classify() hardcodes the 256 tier, so the large tier tokenizes
|
||||
// apart under a size-suffixed memo key (the transcode url itself carries
|
||||
// `width=`, so cache entries separate naturally).
|
||||
if crate::local_plex::is_thumb_path(&seed.url) {
|
||||
let key = format!("{}@{}", seed.url, PLEX_THUMB_PX_LARGE);
|
||||
let fetch = crate::local_plex::thumb_url(&seed.url, Some(PLEX_THUMB_PX_LARGE));
|
||||
if fetch.is_empty() {
|
||||
return String::new();
|
||||
}
|
||||
if let Some(p) = disk_path(&key, &fetch) {
|
||||
return file_url(&p.to_string_lossy());
|
||||
}
|
||||
download_one(key.clone(), fetch.clone()).await;
|
||||
return disk_path(&key, &fetch)
|
||||
.map(|p| file_url(&p.to_string_lossy()))
|
||||
.unwrap_or_default();
|
||||
}
|
||||
// Local / offline file: the on-demand large tier (bounded decode, native
|
||||
// when smaller). Blocking — off the async executor.
|
||||
if let ArtUrl::LocalFile(path) = classify(&seed.url) {
|
||||
let track_id = (seed.source == "local").then_some(seed.track_id);
|
||||
let resolved =
|
||||
tokio::task::spawn_blocking(move || crate::local_artwork::large_art_blocking(&path, track_id))
|
||||
.await
|
||||
.ok()
|
||||
.flatten();
|
||||
return resolved
|
||||
.map(|p| file_url(&p.to_string_lossy()))
|
||||
.unwrap_or_default();
|
||||
}
|
||||
String::new()
|
||||
}
|
||||
|
||||
/// Single-url download into the shared cache — the large feed's fetch (the
|
||||
/// batched [`download_missing`] re-classifies urls, which would tokenize a
|
||||
/// Plex path at the WRONG tier; this takes the final fetch url directly).
|
||||
/// Same discipline as the batched body: status check, empty-body reject,
|
||||
/// zero-byte entries count as misses on the next read.
|
||||
async fn download_one(key: String, fetch: String) {
|
||||
if disk_path(&key, &fetch).is_some() {
|
||||
return;
|
||||
}
|
||||
let response = match HTTP.get(&fetch).send().await {
|
||||
Ok(resp) => resp,
|
||||
Err(e) => {
|
||||
log::warn!("[qbz-qt] artwork download failed ({fetch}): {e}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
let response = match response.error_for_status() {
|
||||
Ok(resp) => resp,
|
||||
Err(e) => {
|
||||
log::warn!("[qbz-qt] artwork download rejected ({fetch}): {e}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
let bytes = match response.bytes().await {
|
||||
Ok(b) if !b.is_empty() => b,
|
||||
_ => return,
|
||||
};
|
||||
let Some(cache) = cache() else {
|
||||
return;
|
||||
};
|
||||
let stored = cache
|
||||
.lock()
|
||||
.ok()
|
||||
.and_then(|guard| match guard.store(&fetch, &bytes) {
|
||||
Ok(path) => Some(path),
|
||||
Err(e) => {
|
||||
log::warn!("[qbz-qt] artwork store failed ({fetch}): {e}");
|
||||
None
|
||||
}
|
||||
});
|
||||
if let Some(path) = stored {
|
||||
memo_put(&key, path);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -520,6 +807,24 @@ mod tests {
|
||||
fn missing_local_file_resolves_to_placeholder() {
|
||||
assert_eq!(cached_path("/nonexistent/qbz/cover.jpg"), "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn np_variant_registry_round_trips_and_skips_empty_sets() {
|
||||
let set = qbz_models::ImageSet {
|
||||
thumbnail: Some("t150".into()),
|
||||
mega: Some("m3000".into()),
|
||||
..Default::default()
|
||||
};
|
||||
note_np_variants("alb-1", &set);
|
||||
let got = np_variants("alb-1").expect("registered");
|
||||
assert_eq!(got.for_px(660).map(String::as_str), Some("m3000"));
|
||||
assert_eq!(got.for_px(72).map(String::as_str), Some("t150"));
|
||||
// Empty ids and url-less sets are not registered.
|
||||
note_np_variants("", &set);
|
||||
note_np_variants("alb-2", &qbz_models::ImageSet::default());
|
||||
assert!(np_variants("").is_none());
|
||||
assert!(np_variants("alb-2").is_none());
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -40,10 +40,18 @@ fn queue_track(track: &Track) -> qbz_models::QueueTrack {
|
||||
Some(album) => (
|
||||
album.id.clone(),
|
||||
album.title.clone(),
|
||||
// Queue row / np bar feed: full variant (best()) — the thumbnail
|
||||
// down-tier was reverted after the 2026-08-15 owner smoke (contract 04 §3).
|
||||
album.image.best().cloned().unwrap_or_default(),
|
||||
),
|
||||
None => (String::new(), String::new(), String::new()),
|
||||
};
|
||||
// Register the full variant set for the immersive large-art feed (D2).
|
||||
if let Some(album) = track.album.as_ref() {
|
||||
if !album.id.is_empty() {
|
||||
crate::artwork_qt::note_np_variants(&album.id, &album.image);
|
||||
}
|
||||
}
|
||||
let album_key = if album_id.is_empty() {
|
||||
None
|
||||
} else {
|
||||
|
||||
@@ -121,6 +121,9 @@ pub(crate) fn build_radio(
|
||||
album_id: a.id.clone(),
|
||||
title: a.title.clone(),
|
||||
artist: a.artist.name.clone(),
|
||||
// Grid card (RadioCard on the For You rail): full variant
|
||||
// (best()) — the down-tier was reverted after the 2026-08-15
|
||||
// owner smoke (contract 04 §3).
|
||||
art_url: a.image.best().cloned().unwrap_or_default(),
|
||||
art_path: String::new(),
|
||||
});
|
||||
@@ -991,6 +994,8 @@ fn to_row(track: &Track) -> TrackRow {
|
||||
bit_depth,
|
||||
sample_rate,
|
||||
explicit: track.parental_warning,
|
||||
// Track row art: full variant (best()) — the thumbnail down-tier
|
||||
// was reverted after the 2026-08-15 owner smoke (contract 04 §3).
|
||||
artwork_url: track
|
||||
.album
|
||||
.as_ref()
|
||||
@@ -1011,10 +1016,18 @@ pub(crate) fn to_queue_track(track: &Track) -> QueueTrack {
|
||||
Some(album) => (
|
||||
album.id.clone(),
|
||||
album.title.clone(),
|
||||
// Queue row / np bar feed: full variant (best()) — the thumbnail
|
||||
// down-tier was reverted after the 2026-08-15 owner smoke (contract 04 §3).
|
||||
album.image.best().cloned().unwrap_or_default(),
|
||||
),
|
||||
None => (String::new(), String::new(), String::new()),
|
||||
};
|
||||
// Register the full variant set for the immersive large-art feed (D2).
|
||||
if let Some(album) = track.album.as_ref() {
|
||||
if !album.id.is_empty() {
|
||||
crate::artwork_qt::note_np_variants(&album.id, &album.image);
|
||||
}
|
||||
}
|
||||
let album_key = if album_id.is_empty() {
|
||||
None
|
||||
} else {
|
||||
|
||||
@@ -1245,6 +1245,8 @@ pub(crate) fn map_flat_album(album: Album) -> HomeCard {
|
||||
album.maximum_bit_depth,
|
||||
album.maximum_sampling_rate,
|
||||
),
|
||||
// Home rail grid card: full variant (best()) — the down-tier was
|
||||
// reverted after the 2026-08-15 owner smoke (contract 04 §3).
|
||||
art_url: album.image.best().cloned().unwrap_or_default(),
|
||||
..HomeCard::default()
|
||||
}
|
||||
@@ -1358,6 +1360,8 @@ fn map_fav_artist(a: Artist) -> HomeCard {
|
||||
id: a.id.to_string(),
|
||||
title: a.name,
|
||||
item_kind: "artist".to_string(),
|
||||
// Artist grid card on Home: full variant (best()) — the down-tier
|
||||
// was reverted after the 2026-08-15 owner smoke (contract 04 §3).
|
||||
art_url: a
|
||||
.image
|
||||
.and_then(|img| img.best().cloned())
|
||||
|
||||
@@ -315,11 +315,15 @@ pub fn discord_push(runtime: &Arc<AppRuntime<LoggingAdapter>>) {
|
||||
};
|
||||
// Discord's large_image needs an http(s) URL or an asset key; local /
|
||||
// Plex covers are filesystem paths Discord can't fetch, so drop them
|
||||
// (the core falls back to the "cover" asset key).
|
||||
// (the core falls back to the "cover" asset key). A sized Qobuz cover
|
||||
// is rewritten to the 600 tier first — the queue can carry the 50px
|
||||
// `small` from a restored session, and Discord renders whatever the
|
||||
// suffix says (owner smoke 2026-08-15: pixelated presence art).
|
||||
let cover_url = track
|
||||
.artwork_url
|
||||
.clone()
|
||||
.filter(|u| u.starts_with("http://") || u.starts_with("https://"));
|
||||
.filter(|u| u.starts_with("http://") || u.starts_with("https://"))
|
||||
.map(|u| qbz_models::qobuz_cover_at_px(&u, 600).unwrap_or(u));
|
||||
let meta = NowListening {
|
||||
title,
|
||||
artist: track.artist.clone(),
|
||||
|
||||
@@ -312,6 +312,7 @@ fn map_track(track: Track) -> FeedItem {
|
||||
if let Some(version) = track.version.as_ref().filter(|v| !v.is_empty()) {
|
||||
title = format!("{title} ({version})");
|
||||
}
|
||||
// Track row art: full variant (best()) — the thumbnail down-tier was reverted after the 2026-08-15 owner smoke (contract 04 §3).
|
||||
let artwork_url = track
|
||||
.album
|
||||
.as_ref()
|
||||
@@ -403,6 +404,8 @@ fn map_album(album: Album) -> FeedItem {
|
||||
year: qbz_text_utils::dates::release_label(date.as_deref()),
|
||||
quality_tier: home_qt::quality_tier_from_depth(bit_depth).to_string(),
|
||||
quality_detail: home_qt::quality_detail_from_parts(bit_depth, sample_rate),
|
||||
// Library grid card: full variant (best()) — the down-tier was
|
||||
// reverted after the 2026-08-15 owner smoke (contract 04 §3).
|
||||
image_url: album.image.best().cloned().unwrap_or_default(),
|
||||
is_favorite: true,
|
||||
..Default::default()
|
||||
@@ -808,6 +811,7 @@ async fn fetch_purchases(
|
||||
.items
|
||||
.into_iter()
|
||||
.map(|t| {
|
||||
// Track row art: full variant (best()) — the thumbnail down-tier was reverted after the 2026-08-15 owner smoke (contract 04 §3).
|
||||
let (img, alb, aid) = t
|
||||
.album
|
||||
.as_ref()
|
||||
|
||||
@@ -269,3 +269,64 @@ pub async fn fetch_plex_misses(misses: Vec<(String, String)>) -> Vec<(String, St
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Large art tier (contract 2026-08-15-immersive-completion 04 §5, ruling 6)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// The 1600px-tier art for a big slot (immersive main art, SPLIT, lightbox),
|
||||
/// resolved ON DEMAND. `src` is the track's raw art source (the DB's
|
||||
/// `artwork_path` — usually the 500px thumb; sometimes an original cover file
|
||||
/// when the folder-cover fallback served it directly). `track_id` is the
|
||||
/// local-library rowid, needed to re-open the source when `src` is only the
|
||||
/// thumb: embedded picture bytes out of the audio file first (the scanner's
|
||||
/// precedence, scan.rs:130), then the folder-art heuristic. If the original
|
||||
/// fits inside `qbz_library::LARGE_ART_PX` the native file is served — never
|
||||
/// an upscale. When every re-open fails, the 500px thumb itself is returned:
|
||||
/// it is the best art that exists for this track.
|
||||
///
|
||||
/// BLOCKING (one DB read, then possibly a decode) — call from
|
||||
/// `spawn_blocking`. Lists never come here: they keep the 500px tier.
|
||||
pub fn large_art_blocking(src: &str, track_id: Option<u64>) -> Option<PathBuf> {
|
||||
let path = Path::new(src);
|
||||
if !path.is_file() {
|
||||
return None;
|
||||
}
|
||||
let is_thumb = qbz_library::get_thumbnails_dir()
|
||||
.map(|dir| path.starts_with(dir))
|
||||
.unwrap_or(false);
|
||||
if !is_thumb {
|
||||
// An original cover file: bound it (native size served as-is when it
|
||||
// already fits).
|
||||
return qbz_library::get_or_generate_large_thumbnail(path).ok();
|
||||
}
|
||||
// `src` is a 500px thumb — its hash is one-way, so the original is
|
||||
// re-derived from the track row.
|
||||
let Some(track) = track_id.and_then(|id| {
|
||||
crate::local_state::with_db(|db| db.get_track(id as i64)).flatten()
|
||||
}) else {
|
||||
return Some(path.to_path_buf());
|
||||
};
|
||||
// Serialize per source (the module-docs race): the large tier shares the
|
||||
// 500px tier's hash key, so the same lock shard covers both.
|
||||
let guard = GEN_LOCKS[gen_shard(src)]
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner());
|
||||
let out = large_art_for_track(&track).or_else(|| Some(path.to_path_buf()));
|
||||
drop(guard);
|
||||
out
|
||||
}
|
||||
|
||||
/// Embedded bytes first (the scanner's precedence), folder art second.
|
||||
fn large_art_for_track(track: &qbz_library::LocalTrack) -> Option<PathBuf> {
|
||||
let file = Path::new(&track.file_path);
|
||||
if let Some(bytes) = qbz_library::MetadataExtractor::extract_artwork_bytes(file) {
|
||||
if let Ok(p) =
|
||||
qbz_library::get_or_generate_large_thumbnail_from_bytes(&bytes, &track.file_path)
|
||||
{
|
||||
return Some(p);
|
||||
}
|
||||
}
|
||||
let art = qbz_library::MetadataExtractor::find_folder_artwork(file, Some(&track.album))?;
|
||||
qbz_library::get_or_generate_large_thumbnail(Path::new(&art)).ok()
|
||||
}
|
||||
@@ -273,6 +273,17 @@ fn meta_changed(key: &(u64, Option<String>)) -> bool {
|
||||
pub(crate) fn art_url_for(track: &qbz_models::QueueTrack) -> Option<String> {
|
||||
let plex = crate::local_plex::settings();
|
||||
let artwork = track.artwork_ref_with_plex(&plex.base_url, &plex.token, None);
|
||||
// A restored queue can carry the 50px `small` Qobuz variant — the widget
|
||||
// fetches this url itself, so a tiny suffix IS the pixelation the owner
|
||||
// reported on the Plasma/GNOME art (2026-08-15). Rewrite to the 600 tier
|
||||
// (and the offline cache lookup below then hits the very file the
|
||||
// now-playing feed already downloaded at that tier).
|
||||
let artwork = match artwork {
|
||||
qbz_models::ArtworkRef::Remote(u) => qbz_models::ArtworkRef::Remote(
|
||||
qbz_models::qobuz_cover_at_px(&u, 600).unwrap_or(u),
|
||||
),
|
||||
other => other,
|
||||
};
|
||||
let mut art = artwork.to_mpris_url();
|
||||
if crate::offline_fwd::engine().is_offline() {
|
||||
if let qbz_models::ArtworkRef::Remote(url) = &artwork {
|
||||
|
||||
@@ -164,6 +164,11 @@ fn publish(m: &NowPlayingModel) {
|
||||
.set_np_quality_effective_tier(QString::from(m.delivered.effective_tier.as_str()));
|
||||
b.as_mut()
|
||||
.set_np_quality_limit_cause(m.delivered.limit_cause);
|
||||
// A3: the delivered stream params as scalars — the Spectral Ribbon
|
||||
// overlay header reads them ("Audio Stream, {rate} Hz, {bits} bits",
|
||||
// ImmersiveSpectralOverlay.slint:45). 0 = not reported yet.
|
||||
b.as_mut().set_np_eff_rate_hz(m.eff_rate_hz as i32);
|
||||
b.as_mut().set_np_eff_bits(m.eff_bits as i32);
|
||||
// --- Cast / remote ------------------------------------------------
|
||||
b.as_mut().set_np_is_remote(m.is_remote);
|
||||
b.as_mut()
|
||||
@@ -279,6 +284,12 @@ pub struct TrackMeta {
|
||||
pub album: String,
|
||||
pub album_id: String,
|
||||
pub artist_id: String,
|
||||
/// The queue track's id + source ("qobuz" | "local" | "plex" | …), stashed
|
||||
/// out-of-band for the size-aware large-art feed (D2): local tracks need
|
||||
/// the rowid to re-open embedded/folder art, Plex rows route to the 1024
|
||||
/// transcode tier, Qobuz rows re-resolve through the registered ImageSet.
|
||||
pub track_id: u64,
|
||||
pub source: String,
|
||||
/// Container origin of THIS track ("album" | "artist" | "playlist" |
|
||||
/// "label" + its id). Never optional at this seam: `refresh_now_playing`
|
||||
/// resolves the fallback (the track's own album) before it gets here, so a
|
||||
@@ -299,6 +310,17 @@ pub struct TrackMeta {
|
||||
/// Resets the DELIVERED block: the engine re-derives it once the new stream
|
||||
/// opens, and the previous track's downgrade state must never linger.
|
||||
pub fn set_track(meta: TrackMeta) {
|
||||
// Stash the artwork seed out-of-band BEFORE the meta swap (the closure
|
||||
// moves the fields it publishes): the small feed resolves through
|
||||
// `artwork_qt::attach_now_playing`, the size-aware large feed (D2) reads
|
||||
// ART_SEED.
|
||||
*ARTWORK_URL.lock().unwrap() = meta.artwork_url.clone();
|
||||
*ART_SEED.lock().unwrap() = ArtSeed {
|
||||
url: meta.artwork_url.clone(),
|
||||
track_id: meta.track_id,
|
||||
album_id: meta.album_id.clone(),
|
||||
source: meta.source.clone(),
|
||||
};
|
||||
mutate(|m| {
|
||||
m.has_track = true;
|
||||
m.title = meta.title;
|
||||
@@ -322,9 +344,6 @@ pub fn set_track(meta: TrackMeta) {
|
||||
m.shuffle = meta.shuffle;
|
||||
m.repeat_mode = meta.repeat_mode;
|
||||
});
|
||||
// Stash the url out-of-band so the artwork pipeline can resolve it
|
||||
// without a second full publish.
|
||||
*ARTWORK_URL.lock().unwrap() = meta.artwork_url;
|
||||
}
|
||||
|
||||
/// Seed the CATALOG maximum + the requested tier for the new current track
|
||||
@@ -389,6 +408,9 @@ pub fn clear_track() {
|
||||
*m = kept;
|
||||
});
|
||||
crate::quality_state::seed_track(None, None, false);
|
||||
// No current track: the large-art feed has nothing to re-resolve (D2).
|
||||
*ART_SEED.lock().unwrap() = ArtSeed::default();
|
||||
set_artwork_path_large(String::new());
|
||||
}
|
||||
|
||||
// --- Cast / remote (wiring seam — no cast service in the POC build) -------
|
||||
@@ -463,11 +485,78 @@ pub fn set_cast_delivered(delivered: Delivered) {
|
||||
/// The artwork url of the current track, stashed for the artwork pipeline.
|
||||
static ARTWORK_URL: Mutex<String> = Mutex::new(String::new());
|
||||
|
||||
/// What the size-aware large-art feed (D2, contract
|
||||
/// `2026-08-15-immersive-completion` 04 §4) needs to re-resolve the current
|
||||
/// track at a bigger tier: the raw url, the queue id (local tracks re-open
|
||||
/// their audio file by rowid), the album id (Qobuz variant-set registry key)
|
||||
/// and the source word ("local" | "plex" | "qobuz" | …).
|
||||
#[derive(Clone, Default)]
|
||||
pub struct ArtSeed {
|
||||
pub url: String,
|
||||
pub track_id: u64,
|
||||
pub album_id: String,
|
||||
pub source: String,
|
||||
}
|
||||
|
||||
static ART_SEED: Mutex<ArtSeed> = Mutex::new(ArtSeed {
|
||||
url: String::new(),
|
||||
track_id: 0,
|
||||
album_id: String::new(),
|
||||
source: String::new(),
|
||||
});
|
||||
|
||||
/// The current track's large-art seed (empty url = nothing to re-resolve).
|
||||
pub(crate) fn art_seed() -> ArtSeed {
|
||||
ART_SEED.lock().unwrap().clone()
|
||||
}
|
||||
|
||||
/// `(track_id, progress 0..1)` for the Spectral Ribbon drain (A3,
|
||||
/// `viz_qt.rs` → `ribbon_qt.rs`): the playback fraction at SECOND
|
||||
/// granularity — the reference reads Slint's NowPlayingState progress, which
|
||||
/// is itself second-granular, and the gap-fill exists precisely because it
|
||||
/// updates ~1 Hz (`shader_underlay.rs:898-899`). Reads the model + the art
|
||||
/// seed's queue id (the model carries no numeric track id).
|
||||
pub(crate) fn ribbon_cursor() -> (u64, f32) {
|
||||
let guard = MODEL.lock().unwrap();
|
||||
let progress = guard
|
||||
.as_ref()
|
||||
.map(|m| {
|
||||
if m.duration_secs > 0 {
|
||||
(m.elapsed_secs as f32 / m.duration_secs as f32).clamp(0.0, 1.0)
|
||||
} else {
|
||||
0.0
|
||||
}
|
||||
})
|
||||
.unwrap_or(0.0);
|
||||
drop(guard);
|
||||
(art_seed().track_id, progress)
|
||||
}
|
||||
|
||||
/// Attach a resolved artwork path to the current track (artwork pipeline).
|
||||
pub fn set_artwork_path(path: String) {
|
||||
mutate(|m| m.artwork_path = path);
|
||||
}
|
||||
|
||||
/// Publish the size-aware LARGE art sibling (`QbzPlayer.npArtworkPathLarge`).
|
||||
/// Deliberately NOT a model field: it resolves asynchronously and
|
||||
/// independently of the meta publish, so it gets the single-property
|
||||
/// publisher treatment (the `publish_show_context_icon` pattern) — one notify
|
||||
/// per actual change, no full-model republish per art landing (pulse law:
|
||||
/// batched, deduped).
|
||||
pub fn set_artwork_path_large(path: String) {
|
||||
static LAST: Mutex<String> = Mutex::new(String::new());
|
||||
{
|
||||
let mut last = LAST.lock().unwrap();
|
||||
if *last == path {
|
||||
return;
|
||||
}
|
||||
*last = path.clone();
|
||||
}
|
||||
crate::player_bridge::ui(move |mut b| {
|
||||
b.as_mut().set_np_artwork_path_large(QString::from(path.as_str()))
|
||||
});
|
||||
}
|
||||
|
||||
/// 1 Hz position push from the poll pump. `has_audio` = the engine
|
||||
/// surfaced a track id (clears the loading spinner).
|
||||
///
|
||||
|
||||
@@ -555,7 +555,13 @@ pub(crate) async fn fetch_album_queue(
|
||||
|
||||
let album_title = album.title.clone();
|
||||
let album_artist = album.artist.name.clone();
|
||||
// Queue rows / the np bar feed render <= 150px but take the full
|
||||
// variant (best()) — the thumbnail down-tier was reverted after the
|
||||
// 2026-08-15 owner smoke ("mala calidad" on the big tiles). The full
|
||||
// variant set is registered so the immersive large-art feed can
|
||||
// re-resolve per slot size (D2).
|
||||
let album_artwork = album.image.best().cloned().unwrap_or_default();
|
||||
crate::artwork_qt::note_np_variants(album_id, &album.image);
|
||||
let raw_tracks = album
|
||||
.tracks
|
||||
.as_ref()
|
||||
@@ -623,6 +629,13 @@ fn artist_top_queue_tracks(
|
||||
let audio = track.audio_info.as_ref();
|
||||
let album = track.album.as_ref();
|
||||
let album_id = album.map(|a| a.id.clone());
|
||||
// Queue rows / the np bar feed render <= 150px but take the
|
||||
// full variant (best()) — the thumbnail down-tier was reverted
|
||||
// after the 2026-08-15 owner smoke; register the full set so the
|
||||
// immersive large-art feed can re-resolve (D2).
|
||||
if let (Some(id), Some(img)) = (album_id.as_deref(), album.and_then(|a| a.image.as_ref())) {
|
||||
crate::artwork_qt::note_np_variants(id, img);
|
||||
}
|
||||
QueueTrack {
|
||||
id: track.id,
|
||||
title: track.title.clone(),
|
||||
@@ -1318,10 +1331,19 @@ async fn catalog_queue_track(
|
||||
Some(album) => (
|
||||
album.id.clone(),
|
||||
album.title.clone(),
|
||||
// Queue row / np bar feed: full variant (best()) — the
|
||||
// thumbnail down-tier was reverted after the 2026-08-15 owner
|
||||
// smoke (contract 04 §3);
|
||||
// the full set is registered for the immersive large feed (D2).
|
||||
album.image.best().cloned().unwrap_or_default(),
|
||||
),
|
||||
None => (String::new(), String::new(), String::new()),
|
||||
};
|
||||
if let Some(album) = track.album.as_ref() {
|
||||
if !album.id.is_empty() {
|
||||
crate::artwork_qt::note_np_variants(&album.id, &album.image);
|
||||
}
|
||||
}
|
||||
let album_key = if album_id.is_empty() {
|
||||
None
|
||||
} else {
|
||||
@@ -2032,6 +2054,8 @@ pub(crate) async fn refresh_now_playing(runtime: &Arc<AppRuntime<LoggingAdapter>
|
||||
.artist_id
|
||||
.map(|id| id.to_string())
|
||||
.unwrap_or_default(),
|
||||
track_id: track.id,
|
||||
source: track.source.clone().unwrap_or_default(),
|
||||
context_kind,
|
||||
context_id,
|
||||
duration_secs: track.duration_secs as i32,
|
||||
|
||||
@@ -32,6 +32,11 @@ pub mod qbz_player {
|
||||
#[qproperty(QString, np_title)]
|
||||
#[qproperty(QString, np_artist)]
|
||||
#[qproperty(QString, np_artwork_path)]
|
||||
// Size-aware LARGE art sibling (contract 04 §4, D2): resolved per
|
||||
// size bucket by request_np_artwork_size for the big immersive slots.
|
||||
// "" = no large art resolved — bind with a fallback to
|
||||
// np_artwork_path (the Slint `artwork-large : artwork` pattern).
|
||||
#[qproperty(QString, np_artwork_path_large)]
|
||||
#[qproperty(i32, np_elapsed_secs)]
|
||||
#[qproperty(i32, np_duration_secs)]
|
||||
#[qproperty(f32, np_progress)]
|
||||
@@ -72,6 +77,11 @@ pub mod qbz_player {
|
||||
// 0 none · 1 streaming-quality setting · 2 local output device cap ·
|
||||
// 3 cast renderer cap · 4 Qobuz offered nothing higher.
|
||||
#[qproperty(i32, np_quality_limit_cause)]
|
||||
// A3: the DELIVERED stream params as scalars (0 = not reported yet) —
|
||||
// the Spectral Ribbon overlay header reads them
|
||||
// (ImmersiveSpectralOverlay.slint:45 parity).
|
||||
#[qproperty(i32, np_eff_rate_hz)]
|
||||
#[qproperty(i32, np_eff_bits)]
|
||||
|
||||
// --- Output LEDs (settings.rs `output_labels`) -------------------
|
||||
// PIPEWIRE|ALSA|JACK|PULS|SYST|AUTO — *_active lights the LED.
|
||||
@@ -128,6 +138,14 @@ pub mod qbz_player {
|
||||
#[qinvokable]
|
||||
fn boot(self: Pin<&mut QbzPlayer>);
|
||||
|
||||
/// A big art slot (immersive panels) reports its size in CSS px
|
||||
/// (D2, contract 04 §4). Bucketed on the Qobuz variant table: only a
|
||||
/// bucket CROSSING re-resolves, the result lands on
|
||||
/// `np_artwork_path_large` asynchronously, and a shrink never
|
||||
/// re-fetches (the derivative layer downscales the cached file).
|
||||
#[qinvokable]
|
||||
fn request_np_artwork_size(self: Pin<&mut QbzPlayer>, px: i32);
|
||||
|
||||
// --- Transport (phase 4 wires the player; POC log-and-noop, except
|
||||
// the pure-UI toggles which mutate the NowPlayingModel) -----------
|
||||
#[qinvokable]
|
||||
@@ -231,6 +249,7 @@ pub struct QbzPlayerRust {
|
||||
np_title: QString,
|
||||
np_artist: QString,
|
||||
np_artwork_path: QString,
|
||||
np_artwork_path_large: QString,
|
||||
np_elapsed_secs: i32,
|
||||
np_duration_secs: i32,
|
||||
np_progress: f32,
|
||||
@@ -249,6 +268,8 @@ pub struct QbzPlayerRust {
|
||||
np_quality_true_detail: QString,
|
||||
np_quality_effective_tier: QString,
|
||||
np_quality_limit_cause: i32,
|
||||
np_eff_rate_hz: i32,
|
||||
np_eff_bits: i32,
|
||||
np_output_backend_label: QString,
|
||||
np_output_backend_active: bool,
|
||||
np_output_mode_label: QString,
|
||||
@@ -278,6 +299,7 @@ impl Default for QbzPlayerRust {
|
||||
np_title: QString::default(),
|
||||
np_artist: QString::default(),
|
||||
np_artwork_path: QString::default(),
|
||||
np_artwork_path_large: QString::default(),
|
||||
np_elapsed_secs: 0,
|
||||
np_duration_secs: 0,
|
||||
np_progress: 0.0,
|
||||
@@ -297,6 +319,8 @@ impl Default for QbzPlayerRust {
|
||||
np_quality_true_detail: QString::default(),
|
||||
np_quality_effective_tier: QString::default(),
|
||||
np_quality_limit_cause: 0,
|
||||
np_eff_rate_hz: 0,
|
||||
np_eff_bits: 0,
|
||||
// The Slint NowPlayingState defaults (state.slint) — an unlit
|
||||
// "SYST / DEFAULT" pair until the first settings snapshot.
|
||||
np_output_backend_label: QString::from("SYST"),
|
||||
@@ -347,6 +371,10 @@ impl qbz_player::QbzPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn request_np_artwork_size(self: Pin<&mut Self>, px: i32) {
|
||||
crate::artwork_qt::request_now_playing_art(px);
|
||||
}
|
||||
|
||||
pub fn toggle_play(self: Pin<&mut Self>) {
|
||||
crate::transport_toggle_play();
|
||||
}
|
||||
|
||||
@@ -515,6 +515,7 @@ pub(crate) fn map_track(track: &Track) -> PlaylistTrackRow {
|
||||
bit_depth: track.maximum_bit_depth,
|
||||
sample_rate: track.maximum_sampling_rate,
|
||||
explicit: track.parental_warning,
|
||||
// Track row art: full variant (best()) — the thumbnail down-tier was reverted after the 2026-08-15 owner smoke (contract 04 §3).
|
||||
art_url: album
|
||||
.and_then(|a| a.image.best().cloned())
|
||||
.unwrap_or_default(),
|
||||
@@ -686,6 +687,10 @@ fn collage_urls(playlist: &Playlist, tracks: &[Track]) -> Vec<String> {
|
||||
.map(|a| {
|
||||
(
|
||||
a.id.clone(),
|
||||
// Mosaic tiles on the header/cards: the server-listed
|
||||
// arm above prefers images300, so the member-album
|
||||
// fallback requests the matching large variant
|
||||
// (contract 04 §3).
|
||||
a.image.best().cloned().unwrap_or_default(),
|
||||
)
|
||||
})
|
||||
|
||||
@@ -331,6 +331,9 @@ fn map_album(album: &Album) -> CardRow {
|
||||
quality_label: quality_label(album.maximum_bit_depth, album.maximum_sampling_rate),
|
||||
art_url: crate::cover_artwork_qt::prefer_album_cover(
|
||||
&album.id,
|
||||
// Search-result album grid card: full variant (best()) — the
|
||||
// down-tier was reverted after the 2026-08-15 owner smoke
|
||||
// (contract 04 §3).
|
||||
album.image.best().cloned().unwrap_or_default(),
|
||||
),
|
||||
..Default::default()
|
||||
@@ -342,6 +345,7 @@ fn map_track(track: &Track) -> TrackRow {
|
||||
if let Some(version) = track.version.as_ref().filter(|v| !v.is_empty()) {
|
||||
title = format!("{title} ({version})");
|
||||
}
|
||||
// Track row art: full variant (best()) — the thumbnail down-tier was reverted after the 2026-08-15 owner smoke (contract 04 §3).
|
||||
let artwork_url = track
|
||||
.album
|
||||
.as_ref()
|
||||
@@ -394,6 +398,8 @@ fn map_artist(artist: &Artist) -> ArtistRow {
|
||||
Some(n) if n > 0 => qbz_i18n::tf("{} album", "{} albums", n as i64, &[&n.to_string()]),
|
||||
_ => String::new(),
|
||||
},
|
||||
// ArtistCard grid cell (200px): full variant (best()) — the down-tier
|
||||
// was reverted after the 2026-08-15 owner smoke (contract 04 §3).
|
||||
art_url: artist
|
||||
.image
|
||||
.as_ref()
|
||||
@@ -549,6 +555,9 @@ fn map_search_all_to_cortinilla(query: &str, results: &SearchAllResults) -> Cort
|
||||
source: "qobuz".into(),
|
||||
title: a.name.clone(),
|
||||
subtitle: map_artist(a).subtitle,
|
||||
// Cortinilla dropdown row art (~40px): full variant (best()) — the
|
||||
// thumbnail down-tier was reverted after the 2026-08-15 owner smoke
|
||||
// (contract 04 §3).
|
||||
art_url: a
|
||||
.image
|
||||
.as_ref()
|
||||
@@ -1336,6 +1345,9 @@ fn map_search_all_to_immersive(query: &str, results: &SearchAllResults) -> Corti
|
||||
source: "qobuz".into(),
|
||||
title: a.name.clone(),
|
||||
subtitle: map_artist(a).subtitle,
|
||||
// Cortinilla dropdown row art (~40px): full variant (best()) — the
|
||||
// thumbnail down-tier was reverted after the 2026-08-15 owner smoke
|
||||
// (contract 04 §3).
|
||||
art_url: a
|
||||
.image
|
||||
.as_ref()
|
||||
|
||||
@@ -170,7 +170,11 @@ fn shuffle_tracks(tracks: &mut [qbz_models::Track], seed: u64) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Best collage cover URL for a track's album (large → best variant).
|
||||
/// Collage cover URL for a track's album. Suggestion-card collage tiles draw
|
||||
/// at <= ~144 CSS px (SuggestionsPanel wells); the full variant (best()) is
|
||||
/// downscaled to the drawn size by the RoundedImage derivative layer — the
|
||||
/// thumbnail down-tier was reverted after the 2026-08-15 owner smoke
|
||||
/// (contract 04 §3).
|
||||
fn track_album_cover(track: &qbz_models::Track) -> Option<String> {
|
||||
track
|
||||
.album
|
||||
|
||||
Reference in new issue
Block a user