Skip to content

play: Add -R/--randomize option to play plugin#6424

Open
amiv1 wants to merge 1 commit intobeetbox:masterfrom
amiv1:play-randomize
Open

play: Add -R/--randomize option to play plugin#6424
amiv1 wants to merge 1 commit intobeetbox:masterfrom
amiv1:play-randomize

Conversation

@amiv1
Copy link
Contributor

@amiv1 amiv1 commented Mar 8, 2026

Description

I really wanted to combine random with play to shuffle tracks in a temporary playlist, but couldn't find easy way to do it. I'd like to introduce a new flag -R / --randomize to the play plugin to shuffle tracks before passing them to the player.

I couldn't really decide between -r and -R, not sure if there's any rule there. If you believe lower case would be better, just let me know.

Regarding tests: they're mocking the random.shuffle function and asserting if it's been called or not. Because of the random nature of the feature, it's challenging to create a proper test that will assert the order because there's always a chance that the randomized order will be exactly the same as the input, which may lead to flaky tests.

To Do

  • Documentation. (If you've added a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • Tests. (Very much encouraged but not strictly required.)

@amiv1 amiv1 requested a review from a team as a code owner March 8, 2026 10:15
@codecov
Copy link

codecov bot commented Mar 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.52%. Comparing base (c89b94a) to head (dd80ac8).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6424   +/-   ##
=======================================
  Coverage   69.52%   69.52%           
=======================================
  Files         141      141           
  Lines       18475    18479    +4     
  Branches     3020     3021    +1     
=======================================
+ Hits        12844    12848    +4     
  Misses       4997     4997           
  Partials      634      634           
Files with missing lines Coverage Δ
beetsplug/play.py 84.54% <100.00%> (+0.58%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@amiv1 amiv1 force-pushed the play-randomize branch 2 times, most recently from 8489835 to 73f1b37 Compare March 8, 2026 10:34
@amiv1 amiv1 changed the title feat(play): Add -R/--randomize option to play plugin play: Add -R/--randomize option to play plugin Mar 8, 2026
@snejus snejus requested a review from Copilot March 8, 2026 13:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

@amiv1 amiv1 force-pushed the play-randomize branch 5 times, most recently from fd06e8c to 50fdbb8 Compare March 10, 2026 09:37
@amiv1 amiv1 requested a review from snejus March 10, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants