mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 00:05:55 +03:00
[GH-ISSUE #1266] Support additionnal SpotifyUri types #582
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#582
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 @acolombier on GitHub (Mar 19, 2024).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/1266
Is your feature request related to a problem? Please describe.
Currently, only a subset of URI are supported, while some other like
genreormedialistconfigaren't, which preventing deserializing data coming from certain endpoint likerootlistDescribe the solution you'd like
SpotifyIdcould be refactored to aligned better with the underlying core concept; this way,SpotifyIdandSpotifyItemTypewould becomeSpotifyUri, and the enum would define sub part, such asSpotifyID(Spotify IDin the above doc), but not exclusively, like it is the case with the current structure.Describe alternatives you've considered
Alternatively, I have currently extended the existing Struct/Enum relation, which allows supporting these additional URI type in a non-breaking way, but this leads to inconsistency, which is likely to grow as more URI type are added
Additional context
N/A
@acolombier commented on GitHub (Mar 19, 2024):
Happy to help implementing the later if that is of interest
@roderickvd commented on GitHub (Mar 31, 2024):
Sounds like a good idea. Feel free to open a PR!
@SapiensAnatis commented on GitHub (Aug 11, 2025):
Had a bit of a look at this since
SpotifyIdis currently also unable to represent a local file URI. Local file URIs are arbitrary-length strings of the formspotify:local:{artist}:{album_title}:{track_title}:{duration_in_seconds}. @photovoltex mentioned tackling this as a potential first step to supporting local files but noted it may not be the best solution if the breaking changes are too large.I implemented a struct like this on top of
SpotifyId:and then changed the player to use
SpotifyUriinstead ofSpotifyIdinternally. We can probably manage the player's method interface reasonably easily by just adding new methods instead of changing existing ones (perhaps with#[deprecated]depending on what overall direction we want to take), for example forplayer.load():However we will have breaking changes due to changing the player structs and enums. In particular
PlayerEventis often used to manage user interfaces and the like -- the same way thelibrespotbinary sets up a player. For example spotifyd uses it here: https://github.com/Spotifyd/spotifyd/blob/master/src/process.rsThat is unless there is some further mitigation we can do like keeping track of both a
SpotifyIdand aSpotifyUriin the internal player state?My attempt also involved breaking changes to some other function signatures which I assume are only called internally by spirc, but that I could be wrong about.
I got it to build and you can see the changes here. The bulk of the changed lines of code are because
SpotifyUricannot implementCopylikeSpotifyIdcan, so I have abused.clone()all over the place -- this is a first draft though and there may be a more intelligent way to make the borrow checker happy.I suppose I'm just wondering what level of breaking change we think is acceptable vs. how much do we want to do this refactor?
@acolombier commented on GitHub (Aug 12, 2025):
This is exactly where I left that! Also had breaking change type level of changes and thus thought it was worth carrying on, but if this would be acceptable, I think this would be a fair solution.
Thanks for taking over on this one by the way!
@photovoltex commented on GitHub (Sep 11, 2025):
Now we have a quite more flexible struct representing the uri of an item. Isn't this issue done by that? Or do we want to add more types and close it afterwards?
Just asking to figure out what the closing condition of this ticket would be to get it fully resolved :)
@acolombier commented on GitHub (Oct 1, 2025):
Perhaps we could close it and track subtypes individually?