mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[PR #1445] [MERGED] Shuffle tracks in place #1396
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#1396
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?
📋 Pull Request Information
Original PR: https://github.com/librespot-org/librespot/pull/1445
Author: @photovoltex
Created: 1/18/2025
Status: ✅ Merged
Merged: 2/2/2025
Merged by: @photovoltex
Base:
dev← Head:shuffle-in-place📝 Commits (9)
c9d7a6dconnect: add shuffle_vec.rs50e1bd5connect: shuffle in place9aa806dadd shuffle with seed optionf933e1dreduce complexity to add new metadata fields90dd971add context index to metadata581e4fbuse seed for shufflef57fdf9add log for shuffle seedf596b1cconnect: use small_rng, derive Default4ddab70Apply suggestions from code review📊 Changes
12 files changed (+315 additions, -171 deletions)
View changed files
📝
connect/Cargo.toml(+1 -1)📝
connect/src/context_resolver.rs(+11 -14)📝
connect/src/lib.rs(+1 -0)➕
connect/src/shuffle_vec.rs(+117 -0)📝
connect/src/spirc.rs(+10 -17)📝
connect/src/state.rs(+3 -5)📝
connect/src/state/context.rs(+51 -42)📝
connect/src/state/handle.rs(+12 -6)📝
connect/src/state/metadata.rs(+57 -59)📝
connect/src/state/options.rs(+22 -17)📝
connect/src/state/tracks.rs(+8 -9)📝
connect/src/state/transfer.rs(+22 -1)📄 Description
Follow up on https://github.com/librespot-org/librespot/pull/1356#issuecomment-2427617758
With the updated protobuf definitions, there is technically a given seed from the side of spotify when transfering playback. The given seed seems to be a hex value which we can convert into a u64 (which we currently use as seed value). But the shuffled queue isn't even similar to what spotify shuffles (which makes sense as they use a more preference base algorithm with less randomness). So when transferring we reshuffle unless we have a previous shuffle seed in the context metadata.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.