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

Fixed the shuffle behavior #423

Closed

Conversation

Iliano101
Copy link
Contributor

@Iliano101 Iliano101 commented Jul 1, 2024

Hello,
I noticed that the shuffle behavior was different from a normal music app. Instead of creating a randomized queue and playing the songs in the shown order, the app would keep the playlist order in the queue and simply randomize the queue playing order. I made it so the songs of a playlist are now randomized once and then the queue plays in order. This allows the user to see what song is next and change the order if the wish to.

This relates to issue #65 (8/31) :
Display now playing queue in playing order (for ex. if shuffle)

PS :
It seems like the auto formating from android studio changed a lot of spaces in the code. Sorry if that makes it harder to see the important lines.

@maxrave-dev
Copy link
Owner

Firstly, thank you for contributing to SimpMusic. If you check out "Load more" flow in app, your changed code is only affected to all song which showed in Playlist Page, but all song weren't loaded and they not be shuffle. Did you try to open a local playlist with more than 50 tracks, and did they shuffled?

@Iliano101
Copy link
Contributor Author

Iliano101 commented Jul 2, 2024

Ah, I see. I tried it just now with an 58 song local playlist and with my new code, the first 50 songs get shuffled together and the last 8 songs are shuffled with eachother and put at the end of the queue.

I'm pretty sure that it works fine with a non local playlist though.

I guess I you have a solution, you can try to fix it. Otherwise you can close the PR and Ill make a new one if I find a fix.

@Iliano101 Iliano101 closed this Jul 2, 2024
@Iliano101
Copy link
Contributor Author

Iliano101 commented Jul 2, 2024

I closed the PR because :

  1. The shuffle only shuffled the songs per 50 song blocks in local playlists.
  2. The shuffle behaviour I set did not fit with the button on the now playing screen

I don't know your code enough to find and update the "Load more" flow, so maybe that's something you can do ? That would be a great improvement, for sure.

@maxrave-dev
Copy link
Owner

Because every load is loading 50 songs per time and I don't know how to shuffle all the database

@maxrave-dev
Copy link
Owner

The loadMore function is in SharedViewModel

@sanchin
Copy link

sanchin commented Aug 2, 2024

Hi,
I've been looking for some shuffle capability in SimpMusic and found this conversation.

To shuffle the data from a table you could do a select ordered by random:
SELECT * FROM table ORDER BY RANDOM() LIMIT 1;
It could work just like that - picking a random row from the table each time, but there would be no queue that way.
So a different approach of just randomizing the rows and then loading them into the queue could be better. Playlists are rather not that big to make this query take ages.

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