Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Commands.pm to randomize certain ["playlist", "loadtracks"] actions #598

Closed
wants to merge 1 commit into from

Conversation

philchillbill
Copy link
Contributor

The proposed simple change shuffles the @tracks array produced by calls to ["playlist", "loadtracks"] when any of track.titlesearch, contributor.namesearch, or genre.id are used as search criteria.

When these criteria are used, there is by definition no inherent expectation of preservation of order (as there would be for e.g. an album). However, LMS currently always returns exactly the same @tracks array when ["playlist", "loadtracks"] is used. This is indeed shuffled if the player in question has shuffle enabled, but if the player has it disabled (e.g. because the user never shuffles albums) then the result is always the same which, as mentioned in the forum, is boring.

List::Util qw(shuffle) is a core module so should not cause any dependency issues.

@michaelherger
Copy link
Member

That's looking reasonable. I might tweak it to support the new balanced shuffle. Could you please provide me with an example command for each of the three options? No worries about the IDs, I'll use some of mine.

@philchillbill
Copy link
Contributor Author

That's looking reasonable. I might tweak it to support the new balanced shuffle. Could you please provide me with an example command for each of the three options? No worries about the IDs, I'll use some of mine.

curl -X POST -d '{"id":0,"params":["00:04:20...",["playlist","loadtracks","contributor.namesearch=Snow+Patrol"]],"method":"slim.request"}' http://yourserver:9000/jsonrpc.js

curl -X POST -d '{"id":0,"params":["00:04:20...",["playlist","loadtracks","track.titlesearch=Chasing+Cars"]],"method":"slim.request"}' http://yourserver:9000/jsonrpc.js

curl -X POST -d '{"id":0,"params":["00:04:20...",["playlist","loadtracks","genre.id:1000"]],"method":"slim.request"}' http://yourserver:9000/jsonrpc.js

@mherger mherger closed this in 0ab68ee May 7, 2021
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.

None yet

2 participants