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

Shuffle the play queue ? #471

Open
vicpa opened this issue Aug 25, 2024 · 7 comments
Open

Shuffle the play queue ? #471

vicpa opened this issue Aug 25, 2024 · 7 comments

Comments

@vicpa
Copy link

vicpa commented Aug 25, 2024

Really like the app- Thanks
I am new so pardon if I am missing something
One question is there a way to shuffle the play queue?

The one icon available on play bar has a tool tip "shuffle" but is generally is used for repeat. (see below) and seems to function that way.
shuffle

Where should I be looking?

@dweymouth
Copy link
Owner

That tool tip is incorrect, it should say Repeat (and is fixed now on main). Currently there is no way to shuffle the queue after songs have been added, but you shuffle as you add them. I haven't implemented queue shuffling yet (#11) because I haven't figured out a good way to do it, considering all the edge cases of adding and removing songs from the queue while shuffle is enabled

@dweymouth
Copy link
Owner

BTW if anyone has ideas for how this should work (adding and removing from the queue while shuffle is enabled, then disabling shuffling, what should be the proper queue order) - feel free to add suggestions!

@vicpa
Copy link
Author

vicpa commented Aug 25, 2024

To narrow it down The use case is add a couple of things to the queue. Have the tracks play in a random order.
I know I said shuffle, but that implies changing the queue itself which isn't really a requirement.

One suggestion:

  1. So if the queue stays the same - logically the play next in the queue would be either "play next unplayed track" or pick a "Random Unplayed track" depending on the toggle.
  2. The queue stays the same adds, deletes etc., just adding or deleting unplayed tracks.
  3. Toggle off Shuffle/Random just uses "play next unplayed track". I suppose you can start from either the currently playing track, or the "first unplayed track depending on level of effort.

@dweymouth
Copy link
Owner

Some more thoughts on how this could work:

  • When in shuffle mode, two copies of the queue are maintained, one in non-shuffled order and the other shuffled
  • When turning shuffle on, a new shuffled order is generated from the non-shuffled queue. The index of the first copy of the currently playing track in the shuffled queue becomes the playback index.
  • When inserting tracks into the queue while shuffle is enabled, they are inserted in a random position in the shuffled queue (regardless of whether "queue next" or "append" was performed), but in the ordered queue, they are inserted either after the first copy of the currently-playing track (for "queue next") or at the end (for "append")
  • When removing tracks from the queue (by index) the tracks at the given index are removed from the ordered queue, and the first instance of each track in the shuffled queue is removed

@vicpa
Copy link
Author

vicpa commented Aug 28, 2024

Your logic sounds correct. Certainly, meets my use case.

@UltraBlackLinux
Copy link

Any updates on this? I'd love to be able to shuffle my favorites like you can shuffle all tracks...

@dweymouth
Copy link
Owner

I started working on this but it is surprisingly complex with all the edge cases around the queue being modified while shuffle mode is on. I've been taking a break from the project for a bit - this will be the first thing I work on once I come back. In the meantime, you can shuffle your favorites by doing Ctrl+A on the favorite tracks view, right-click, Shuffle

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

No branches or pull requests

3 participants