aboutsummaryrefslogtreecommitdiffstats
path: root/src/daemon.rs
diff options
context:
space:
mode:
authorsalmonik <raisersoft@proton.me>2026-05-08 01:12:31 +0200
committersalmonik <raisersoft@proton.me>2026-05-08 01:12:31 +0200
commit0f00616dca071750381234b5c59c8ec1e71b28ed (patch)
tree35d01b2ea8bbff458df5cb39ccc7d7b5dc6640ae /src/daemon.rs
parentAdd desktop notifications for track changes, queue end, and errors (diff)
downloadrsplayer-0f00616dca071750381234b5c59c8ec1e71b28ed.tar.gz
rsplayer-0f00616dca071750381234b5c59c8ec1e71b28ed.zip
Fix shuffle first song not being shuffled
update_shuffle_indices now shuffles all indices when position is 0 (no tracks have been played yet), so the first track played is random instead of always being tracks[0]. Directory playback now uses q.current() to pick the first track, resolving through shuffled indices when shuffle is active. Also pins notify-rust version in Cargo.toml and removes PLAN.md (superseded by TODO.md).
Diffstat (limited to '')
-rw-r--r--src/daemon.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/daemon.rs b/src/daemon.rs
index cca9b11..00bf35f 100644
--- a/src/daemon.rs
+++ b/src/daemon.rs
@@ -453,11 +453,10 @@ fn process_command(
453 q.add_track(file.clone()); 453 q.add_track(file.clone());
454 } 454 }
455 if !audio.is_playing() 455 if !audio.is_playing()
456 && let Some(track) = files.first() 456 && let Some(track) = q.current()
457 { 457 {
458 let track = Track::from_path(track.clone());
459 audio.play(track.path.clone()); 458 audio.play(track.path.clone());
460 notification::notify_track(&track); 459 notification::notify_track(track);
461 } 460 }
462 format!("Queued {} tracks from: {}\n", files.len(), path_str) 461 format!("Queued {} tracks from: {}\n", files.len(), path_str)
463 } 462 }