fix(session): save full queue with all tracks and metadata

The save was broken in two ways:
1. Only current_track + upcoming (capped at 20) were saved, dropping
   all history tracks. Queue was reconstructed incomplete on restore.
2. Track metadata (hires, bit_depth, sample_rate, source, etc.) was
   not being persisted, only the basic 6 fields.

Add v2_get_all_queue_tracks command that returns the full uncapped
track list with correct current_index. Use it in saveSessionBeforeClose
instead of the capped v2_get_queue_state. Map all metadata fields.
This commit is contained in:
vicrodh committed 2026-02-20 20:33:39 -06:00
1 parent 5a0d4c50a1
commit aa1aa32f7a
6 files changed
+45 -27

No files matched your search

+6
View File
@@ -127,6 +127,12 @@ impl<A: FrontendAdapter + Send + Sync + 'static> QbzCore<A> {
queue.get_state()
}
/// Get all queue tracks and current index (for session persistence)
pub async fn get_all_queue_tracks(&self) -> (Vec<QueueTrack>, Option<usize>) {
let queue = self.queue.read().await;
queue.get_all_tracks()
}
/// Set repeat mode
pub async fn set_repeat_mode(&self, mode: RepeatMode) {
let queue = self.queue.write().await;