feat(track): show Qobuz subtitle/edition (version) in core renderers (#360)

Qobuz returns a separate `version` field for tracks belonging to remix
albums, reissues, and deluxe editions (e.g. "Player's Ball Mix",
"Nine Inch Noize Version", "Remastered 2024"). The mobile app shows it
parenthesized after the title so remix albums are distinguishable from
originals; qbz only showed the bare title, making remix albums
impossible to navigate (issue #360).

Backend
-------
- Add `version: Option<String>` to qbz_models::Track (the V2 model
  consumed by qbz-qobuz/qbz-library) and to api::models::Track (the
  legacy struct still used by some V2 command paths).
- Add `version: Option<String>` to qbz_models::QueueTrack so the field
  travels through the local queue, persistence, QConnect remote queue,
  and frontend snapshots without being lost in conversion.
- Propagate `version` in every Track→QueueTrack converter:
  qconnect::model_track_to_core_queue_track,
  link_resolver::track_to_queue_track_from_api,
  mixtape::enqueue::track_to_queue_track_from_api and the inline
  builders. Plex/local builders set version=None (no edition concept
  outside Qobuz).
- V2QueueTrack (the wire shape exposed to the frontend) gains the
  field with serde default so older clients keep deserializing.

Frontend
--------
- New `formatTrackTitle(track)` helper in src/lib/utils/trackTitle.ts:
  returns `title` when version is empty, else `title (version)`.
- Add `version?: string | null` to QobuzTrack, Track (UI), PlaylistTrack,
  DisplayTrack, BackendQueueTrack, QueueTrack (UI), and PlayingTrack
  so the field flows from the wire to the renderer.
- Propagate `version` through the four buildQueueTrackFrom* builders
  in trackActions.ts and through the QobuzAlbum→AlbumDetail adapter.
- Use formatTrackTitle in the high-traffic renderers:
  - NowPlayingBar (currentTrack derived in routes/+page.svelte)
  - QueuePanel: now-playing label, upcoming-track rows, history rows
  - VirtualizedTrackList: default getTrackTitle accessor
  - AlbumDetailView: TrackRow title binding
  - PlaylistDetailView: TrackRow title binding
  - SearchView: popular-track card label and the two track-list
    rows (Tracks tab + cross-search "All" view)

Tests
-----
- 196 lib tests pass (no behavior change for the no-version path).
- npm run check: 0 errors.

Follow-up: more views still pass `{track.title}` directly (HomeView,
ArtistDetailView, FavoritesView, ForYouTab, MixtapeCollectionDetailView,
LocalLibraryView, the various Suggest/Top/Label views, the immersive
panels, the miniplayer surface, and the Track*Modal stack). They all
render UI Track-shaped objects that now carry version, so each is a
mechanical "import formatTrackTitle + replace {track.title} with
{formatTrackTitle(track)}". Doing them in a follow-up commit to keep
this one reviewable.

cc
This commit is contained in:
vicrodh committed 2026-04-27 18:45:17 -06:00
1 parent 532ec89095
commit 6ff7aab61e
20 files changed
+118 -12

No files matched your search

+4
View File
@@ -248,6 +248,10 @@ pub struct Track {
pub id: u64,
#[serde(default)]
pub title: String,
/// Subtitle/edition info from Qobuz (e.g. "Player's Ball Mix",
/// "Nine Inch Noize Version", "Remastered 2024"). Frontend renders
/// it parenthesized after the title (issue #360).
pub version: Option<String>,
pub isrc: Option<String>,
#[serde(default)]
pub duration: u32,
@@ -1746,6 +1746,7 @@ pub async fn v2_create_infinite_radio(
tracks.push(super::queue::V2QueueTrack {
id: core.id,
title: core.title,
version: core.version,
artist: core.artist,
album: core.album,
duration_secs: core.duration_secs,
@@ -1795,6 +1796,7 @@ fn track_to_queue_track_from_api(track: &crate::api::Track) -> CoreQueueTrack {
CoreQueueTrack {
id: track.id,
title: track.title.clone(),
version: track.version.clone(),
artist,
album,
duration_secs: track.duration as u64,
+6
View File
@@ -427,6 +427,10 @@ mod tests {
pub struct V2QueueTrack {
pub id: u64,
pub title: String,
/// Subtitle/edition info from Qobuz (e.g. "Player's Ball Mix"),
/// rendered parenthesized after the title in the frontend (#360).
#[serde(default)]
pub version: Option<String>,
pub artist: String,
pub album: String,
pub duration_secs: u64,
@@ -462,6 +466,7 @@ impl From<V2QueueTrack> for CoreQueueTrack {
Self {
id: t.id,
title: t.title,
version: t.version,
artist: t.artist,
album: t.album,
duration_secs: t.duration_secs,
@@ -485,6 +490,7 @@ impl From<CoreQueueTrack> for V2QueueTrack {
Self {
id: t.id,
title: t.title,
version: t.version,
artist: t.artist,
album: t.album,
duration_secs: t.duration_secs,
+6
View File
@@ -234,6 +234,7 @@ async fn resolve_qobuz_album(
CoreQueueTrack {
id: track.id,
title: track.title.clone(),
version: track.version.clone(),
artist,
album: album_title.clone(),
duration_secs: track.duration as u64,
@@ -377,6 +378,7 @@ fn track_to_queue_track_from_api(track: &crate::api::Track) -> CoreQueueTrack {
CoreQueueTrack {
id: track.id,
title: track.title.clone(),
version: track.version.clone(),
artist,
album,
duration_secs: track.duration as u64,
@@ -412,6 +414,7 @@ fn plex_cached_track_to_queue_track(track: &crate::plex::PlexCachedTrack) -> Cor
CoreQueueTrack {
id,
title: track.title.clone(),
version: None,
artist: track.artist.clone(),
album: track.album.clone(),
duration_secs: track.duration_secs,
@@ -450,6 +453,7 @@ pub fn local_track_to_queue_track(track: &qbz_library::LocalTrack) -> CoreQueueT
// Local ids start from 1 and are never negative in practice.
id: track.id as u64,
title: track.title.clone(),
version: None,
artist: track.artist.clone(),
album: track.album_group_title.clone(),
duration_secs: track.duration_secs,
@@ -489,6 +493,7 @@ mod tests {
.map(|i| CoreQueueTrack {
id: i as u64,
title: format!("{}-t{}", item.title, i),
version: None,
artist: item.subtitle.clone().unwrap_or_default(),
album: item.title.clone(),
duration_secs: 180,
@@ -584,6 +589,7 @@ mod tests {
CoreQueueTrack {
id: 0,
title: "t".into(),
version: None,
artist: "a".into(),
album: "alb".into(),
duration_secs: 100,
+1
View File
@@ -347,6 +347,7 @@ mod tests {
CoreQueueTrack {
id,
title: title.to_string(),
version: None,
artist: artist.to_string(),
album: String::new(),
duration_secs: 0,
+1
View File
@@ -125,6 +125,7 @@ pub(super) fn model_track_to_core_queue_track(track: &Track) -> QueueTrack {
QueueTrack {
id: track.id,
title: track.title.clone(),
version: track.version.clone(),
artist,
album,
duration_secs: track.duration as u64,