Repository navigation
feat(gui): play the shown songs in a random order from the Shuffle button - #864
Conversation
…tton The Shuffle button next to Play on Liked Songs and playlist pages was a placeholder that stayed disabled. It now sends a PlayUris action with the shown rows' URIs shuffled by Fisher-Yates, so it plays what the page shows, including the rows a filter narrowed it to. The random function is a parameter so tests can pin the order. Fixes LargeModGames#841
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Route the two strings main added through the table: the Shuffle button's label (gui.shuffle_named, LargeModGames#864) and the missing ALSA default device hint (status.app.audio_backend_no_alsa_default, LargeModGames#861). Add generated_name to the PlaylistInfo built by the LargeModGames#859 test.
Which Issue Fixes
Fixes #841
Brief Description
The Shuffle button next to Play on Liked Songs and playlist pages was a placeholder: it was hard-coded
disabledwith no handler. It now plays the songs the page shows in a random order, only the matching rows when a filter is active.shufflePlayRequestingui/src/sortModel.tscollects the shown rows' URIs (skipping rows without one), shuffles them with Fisher-Yates, and returns aPlayUrisaction withoffset: 0. The random function is a parameter so tests can pin the order. The button mirrors the Play button's enabled state (first < 0) and is labelledShuffle ${title}to tell it apart from the player bar's shuffle toggle. NoSetShuffleis sent: that acts on whatever is playing now, while this starts a new order for the list you are looking at.No Rust change:
PlayUrisalready routes throughstart_playback_uris, which keeps the existing 100-URI server-side window on Spotify and plays one random song on Apple Music, same as Play after a sort or filter.How Did You Test
shufflePlayRequesttests ingui/src/sortModel.test.ts: pinned orders for() => 0and() => 0.999, no request when no shown row has a URI, single song and duplicate URIs kept, the caller's rows are not reordered, a URI of any source is kept, and a 101-URI list passes through whole (the window is the server's job).gui/src/listPage.test.tsx: enabled witharia-label="Shuffle Liked Songs"once the list shows a playable song, disabled while a playlist is still loading.npm run lint,npm run format:check,npm run typecheck,npm test(407 passed),npm run buildall pass ingui/.shots/chromium/library-playlist.pngattached shows the page with the button in place.Summary by CodeRabbit