mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 00:05:55 +03:00
[PR #1538] [MERGED] refactor: Introduce SpotifyUri struct #1432
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#1432
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/1538
Author: @SapiensAnatis
Created: 8/14/2025
Status: ✅ Merged
Merged: 9/11/2025
Merged by: @photovoltex
Base:
dev← Head:chore/uri-refactor📝 Commits (10+)
fea16c2refactor: Introduce SpotifyUri struct569e3f0fix: Don't pass unknown URIs from deprecated player methodsaaa970frefactor: remove SpotifyUri::to_base16c16310crefactor: Store original data in SpotifyUri::Unknown4b7a1d7refactor: Remove SpotifyItemType46d3eb9refactor: Address review feedback5224eaetest: Add more SpotifyUri testsff7ddcdchore: Correctly mark changes as breaking in CHANGELOG.md501697crefactor: Respond to review feedback1a25fb1chore: Changelog updates📊 Changes
23 files changed (+937 additions, -625 deletions)
View changed files
📝
CHANGELOG.md(+25 -0)📝
connect/src/spirc.rs(+4 -4)📝
connect/src/state/context.rs(+5 -3)📝
connect/src/state/tracks.rs(+4 -4)📝
core/src/lib.rs(+2 -0)📝
core/src/spclient.rs(+3 -3)📝
core/src/spotify_id.rs(+23 -405)➕
core/src/spotify_uri.rs(+583 -0)📝
examples/play.rs(+5 -6)📝
examples/playlist_tracks.rs(+3 -2)📝
metadata/src/album.rs(+11 -7)📝
metadata/src/artist.rs(+14 -10)📝
metadata/src/audio/item.rs(+14 -18)📝
metadata/src/episode.rs(+10 -6)📝
metadata/src/image.rs(+2 -2)📝
metadata/src/lib.rs(+4 -4)📝
metadata/src/playlist/annotation.rs(+20 -6)📝
metadata/src/playlist/item.rs(+3 -3)📝
metadata/src/playlist/list.rs(+25 -12)📝
metadata/src/show.rs(+10 -6)...and 3 more files
📄 Description
Contributes to #1266
Introduces a new
SpotifyUristruct which is layered on top of the existingSpotifyId, but has the capability to support URIs that do not confirm to the canonical base62 encoded format. This allows it to describe URIs likespotify:local,spotify:genreand others thatSpotifyIdcannot represent.Changed the internal player state to use these URIs as much as possible, such that the player could in the future accept a URI of the type
spotify:local, as a means of laying the groundwork for local file support.I know #1266 is not a very good issue for my first one on the project, but I would really like to implement local file support and it doesn't seem like that will be possible for the player to handle without hacks unless we change the way we store the track URI. This is because local files URIs are of the form
spotify:local:{artist}:{album_title}:{track_title}:{duration_in_seconds}which cannot be represented under au128insideSpotifyIdlike the base62 names that all official tracks have.I have opened this PR to show what the proposed refactor in #1266 would involve, particularly with regard to the breaking changes I have had to make. So there are probably some things that can be polished more and tests added, but I wanted to get some feedback on the overall direction first. If the proposed change is too radical I will not be offended if you decide to close this PR 🙂
p.s. I have put all the changelogs etc. as 0.7.0 but it sounds like that is coming soon so just to be clear I have no expectation of this making it into the upcoming release
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.