mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[GH-ISSUE #1550] Confusing shuffle behaviour #700
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#700
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @aome510 on GitHub (Aug 24, 2025).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/1550
Before all, I want to say thank you for releasing a new librespot version. I've been waiting for the new release since people reported getting different issues when they used my project with Spotify breaking their APIs 🤦.
Back to the issue, I recently upgraded
librespotto0.7.0for myspotify-playerproject and found the new shuffle behaviour confusing.It seems
librespotdoesn't allow shuffle when the repeat is eithertrackorcontext. Receivingevery time I use Spotify API to change the shuffle state. It only works with the repeat mode is
off. I found the code responsible for this check ingithub.com/photovoltex/librespot@78ce118d32/connect/src/state/restrictions.rs (L55)My main question is why do we disallow shuffle when the repeat mode is not off?
The confusing part is that the shuffle state is still updated even when the message said otherwise. For example, if I set the shuffle to true when repeat is context, it will first show shuffle to be false with the above error message but when the next song is played, the shuffle state is updated to true.
I'm guessing this happens because we set the state before handling the state change in
github.com/photovoltex/librespot@78ce118d32/connect/src/state/handle.rs (L13-L17)self.shuffleis when theService unavailableerror is returned.@photovoltex commented on GitHub (Aug 25, 2025):
Track repeat and shuffle seems a bit silly so let's talk about context repeat and shuffle.
I can't tell for certain anymore why we changed it like that but I remember spotify did behave similar at the time. But currently it seems they have changed it or never did so before? Hard to tell but most of the implementation tries to copy spotifys behavior.
It might also be a limitation of the state back then that wasn't adjusted so we could changed that again but this will probably need some adjustment in code for context repeat as the shuffle context and context are not the same.
@aome510 commented on GitHub (Aug 25, 2025):
yeah I agree but that doesn't mean we shouldn't allow to set the state accordingly. I believe Spotify does support all the state combination of shuffle/repeat
@photovoltex commented on GitHub (Aug 26, 2025):
I think will take a look what the overhead of the change would be, in theory it shouldn't be to bad. If so, I suppose we could remove the restriction or adjust it accordingly if spotify now a days allows the combination.
@photovoltex commented on GitHub (Aug 28, 2025):
So I made some progress here but there are still some inconsistent behavior when toggling repeat on and off. When I have fixed them I will create a PR for it.
The behavior between shuffle and repeat will be that the shuffled context will be repeated, but not be reshuffled. That's apparently what spotify does currently and that's what we aim for.
@aome510 commented on GitHub (Aug 28, 2025):
amazing, thank you @photovoltex!