fix(radio): pass album_id and artist_id for track navigation
Add album_id and artist_id fields to QueueTrack struct so that radio tracks have proper navigation metadata. This enables clicking artist/album in the main player to navigate correctly when playing tracks from artist or track radio. Changes: - Add album_id/artist_id to Rust QueueTrack struct - Update track_to_queue_track to extract IDs from Qobuz Track - Add fields to frontend BackendQueueTrack interface - Pass IDs in ArtistDetailView radio playback - Pass IDs in playQueueTrack to playTrack service
This commit is contained in:
1 parent
8eed63deb0
commit
aabbe8ea67
5 files changed
+18
-1
No files matched your search
@@ -265,6 +265,9 @@ fn track_to_queue_track(track: &Track) -> QueueTrack {
|
||||
.map(|a| a.title.clone())
|
||||
.unwrap_or_else(|| "Unknown Album".to_string());
|
||||
|
||||
let album_id = track.album.as_ref().map(|a| a.id.clone());
|
||||
let artist_id = track.performer.as_ref().map(|p| p.id);
|
||||
|
||||
QueueTrack {
|
||||
id: track.id,
|
||||
title: track.title.clone(),
|
||||
@@ -276,5 +279,7 @@ fn track_to_queue_track(track: &Track) -> QueueTrack {
|
||||
bit_depth: track.maximum_bit_depth,
|
||||
sample_rate: track.maximum_sampling_rate,
|
||||
is_local: false,
|
||||
album_id,
|
||||
artist_id,
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,10 @@ pub struct QueueTrack {
|
||||
/// Whether this is a local library track (not from Qobuz)
|
||||
#[serde(default)]
|
||||
pub is_local: bool,
|
||||
/// Album ID for navigation (Qobuz album ID)
|
||||
pub album_id: Option<String>,
|
||||
/// Artist ID for navigation (Qobuz artist ID)
|
||||
pub artist_id: Option<u64>,
|
||||
}
|
||||
|
||||
/// Repeat mode options
|
||||
|
||||
@@ -293,6 +293,8 @@
|
||||
hires: firstTrack.hires,
|
||||
bitDepth: firstTrack.bit_depth ?? undefined,
|
||||
samplingRate: firstTrack.sample_rate ?? undefined,
|
||||
albumId: firstTrack.album_id ?? undefined,
|
||||
artistId: firstTrack.artist_id ?? undefined,
|
||||
});
|
||||
console.log(`[Radio] Started playback of track ${firstTrack.id}`);
|
||||
|
||||
@@ -343,6 +345,8 @@
|
||||
hires: firstTrack.hires,
|
||||
bitDepth: firstTrack.bit_depth ?? undefined,
|
||||
samplingRate: firstTrack.sample_rate ?? undefined,
|
||||
albumId: firstTrack.album_id ?? undefined,
|
||||
artistId: firstTrack.artist_id ?? undefined,
|
||||
});
|
||||
console.log(`[Radio] Started playback of track ${firstTrack.id}`);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ export interface BackendQueueTrack {
|
||||
bit_depth: number | null;
|
||||
sample_rate: number | null;
|
||||
is_local?: boolean;
|
||||
album_id?: string | null;
|
||||
artist_id?: number | null;
|
||||
}
|
||||
|
||||
interface BackendQueueState {
|
||||
|
||||
@@ -941,7 +941,9 @@
|
||||
bitDepth: track.bit_depth ?? undefined,
|
||||
// Only convert Hz to kHz for local tracks. Qobuz tracks are already in kHz.
|
||||
samplingRate: isLocal && track.sample_rate ? track.sample_rate / 1000 : track.sample_rate ?? undefined,
|
||||
isLocal
|
||||
isLocal,
|
||||
albumId: track.album_id ?? undefined,
|
||||
artistId: track.artist_id ?? undefined
|
||||
}, { isLocal, showLoadingToast: false });
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user