Skip to content

Confusing shuffle behaviour #1550

@aome510

Description

@aome510

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 librespot to 0.7.0 for my spotify-player project and found the new shuffle behaviour confusing.

It seems librespot doesn't allow shuffle when the repeat is either track or context. Receiving

ERROR librespot_connect::spirc: failed to handle request: Service unavailable { currently shuffle is not allowed because endless_context }

every 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 in

https://github.com/photovoltex/librespot/blob/78ce118d32912adfb2705481f69c83df6a88211f/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 https://github.com/photovoltex/librespot/blob/78ce118d32912adfb2705481f69c83df6a88211f/connect/src/state/handle.rs#L13-L17

self.shuffle is when the Service unavailable error is returned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions