Skip to content

Conversation

photovoltex
Copy link
Member

This should allow to combine repeat and shuffle without any odd behaviors. Shuffling itself was quite a bit inconsistent before, so I had to adjust the shuffling a bit so that's a bit more predictable to work with.

@aome510 could you give this a try and see if there is anything weird in the combination or how the queue behaves? Thanks in advance :)

Fixes #1550

@Copilot Copilot AI review requested due to automatic review settings August 29, 2025 22:09
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables the combination of repeat and shuffle modes in the Spotify Connect implementation without odd behaviors. The changes restructure how shuffling works to be more predictable and consistent when combined with repeat functionality.

Key changes:

  • Introduced ShuffleState struct to track shuffle seed and initial track together
  • Modified shuffle logic to preserve the first track position for consistency across state resets
  • Removed restrictions that prevented combining repeat and shuffle modes

Reviewed Changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
connect/src/state/transfer.rs Updates transfer logic to handle ShuffleState instead of just seed
connect/src/state/options.rs Adds ShuffleState struct and refactors shuffle method to use it
connect/src/state/restrictions.rs Removes restriction preventing shuffle when repeat context is enabled
connect/src/state/handle.rs Simplifies repeat context handling logic
connect/src/state/context.rs Updates skip track logic and removes unused skip_track field
connect/src/state/tracks.rs Adds repeat context check and improves skip track handling
connect/src/state/metadata.rs Adds initial track metadata support
connect/src/state.rs Updates state structure and error naming
connect/src/shuffle_vec.rs Enhances shuffle algorithm to preserve first track position
connect/src/context_resolver.rs Adds condition to prevent reshuffling in certain scenarios
CHANGELOG.md Documents the changes and fixes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@roderickvd roderickvd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some ideas for your consideration.

@aome510
Copy link
Contributor

aome510 commented Aug 31, 2025

@aome510 could you give this a try and see if there is anything weird in the combination or how the queue behaves? Thanks in advance :)

Tested your branch for my project and it works great for all combinations of shuffle and repeat. Thanks again for putting up this PR!

@roderickvd
Copy link
Member

Tested your branch for my project and it works great for all combinations of shuffle and repeat. Thanks again for putting up this PR!

Great! @photovoltex no pressure but if you're OK to merge, then by all means do, and we can release v0.7.1.

@photovoltex
Copy link
Member Author

Tested your branch for my project and it works great for all combinations of shuffle and repeat. Thanks again for putting up this PR!

Great to here. Then I suppose we can merge it :D

@photovoltex photovoltex merged commit eff5ca3 into librespot-org:dev Aug 31, 2025
12 checks passed
@photovoltex photovoltex deleted the adjust/shuffle-repeat-interaction branch August 31, 2025 18:32
paulfariello pushed a commit to paulfariello/librespot that referenced this pull request Sep 23, 2025
* fix: incorrect autoplay resolver behavior when shuffling

* refactor: store the initial track in the remote context

* adjust: shuffle repeat interaction

* chore: update .gitignore

* chore: rename internal error

* adjust: shuffle behavior to ensure consistency

* fix: prefer repeat context over autoplay

* chore: update changelog

* chore: reduce complexity of shuffle

* chore: test shuffle with first
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.

Confusing shuffle behaviour
3 participants