spclient: Specify base url for metadata requests#1528
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds the ability to specify a custom base URL for metadata requests in the SpClient, addressing issue #1527. The change allows metadata requests to use a specific Spotify client endpoint while maintaining existing behavior for other requests.
- Adds an optional
base_urlfield toRequestOptionsstruct - Updates the request method to use the custom base URL when provided
- Modifies
get_metadatamethod to use a hardcoded Spotify client URL
89b3880 to
24447ff
Compare
|
I'm not sure how difficult the release pipeline is for this project, but this one is blocking at least two downstream apps from upgrading on their end to repair playback. @tdgroot - Is there any chance this'll be shipped soon? |
Once this is merged, downstream developers are free to use the |
photovoltex
left a comment
There was a problem hiding this comment.
I'm not a huge fan of the change itself (we might have to merge it for the current moment tho). Anyhow, is anyone encountering the 500 error even anymore? Currently it seems the 500 is resolved and it just can't find the audio files in a track anymore.
This workaround also did break during the in the middle of the day devgianlu/go-librespot#189 (comment)
No sweat; I was only getting a feel for viability. |
I just tried it right now, still hitting 500. [2025-08-07T18:44:48Z ERROR librespot_playback::player] Unable to load audio item: Error { kind: Unavailable, error: StatusCode(500) }
[2025-08-07T18:44:48Z ERROR librespot_playback::player] Skipping to next track, unable to load track <SpotifyId("spotify:track:0I7OQmvpngDuiYxwyA4S54")>: ()
[2025-08-07T18:44:48Z ERROR librespot_connect::spirc] could not dispatch player event: Invalid state { context is not available. type: Default } |
|
An alternative we could do is to explicitly add the fallback AP to the list we get from apresolve. Our normal retry logic would then (eventually) use it. It feels like a more logical fix, but it'll perform worse than this workaround. I think what's here is a good hotfix. |
Yes, that seems robust.
Generally we should mirror what the official clients do. From glancing at the fix over at |
Using the 'normal' endpoints, I sometimes get 500 error responses and other times get what looks like a good response, except crucially the returned EDIT: |
|
How is this working for everyone now? From the comments that blocking Then there’s #1529 and I’m wondering whether those access points would work without this hack? |
|
I don't think dealer vs dealer-g2 makes any difference here, you get the same (half-broken) spclient APs either way. My comment about the ports in #1529 was wrong - sorry. |
|
Also, blocking apresolve behaves slightly differently to the workaround here. Blocking it forces all spclient access to go through the fallback, instead of just |
|
OK. @tdgroot could you get back on @photovoltex's review comment and change those |
|
@roderickvd Sure, I'll try to find some time tomorrow morning and make the requested changes! |
|
@roderickvd branch has been updated, LMK what you think :) |
|
Yes, looks good to me, thanks. @photovoltex you agree your review comment was resolved as you wanted? |
|
Yeah, seems good to me. Even tho a changelog entry is still missing. |
|
@photovoltex @roderickvd added changelog entry |
|
Your changelog entry specifies After resolving the conflict, would you also help out and touch up this entry:
⬇️ change to:
Then when I find some time and camping internet access I will help out out a release. 🥳 |
|
Kudos for the quick reverse engineering! In the end we want to provide a working, stable Spotify library (and reference player) to the community. A lot of users and distributions out there are depending on us to get it fixed. (With caveats of voluntary open source work and all.) What would be the cons of releasing this “hotfix” in v0.7 these days (with a whole bag of other goodies from the past months) and then being open to a v0.7.1 or v0.8 quickly after? Gives us time to vet @photovoltex’s new code and service the community. |
|
Sounds good to me. A quicker solution is probably better for now than to wait another day. Will create a PR for it later down the line then. |
|
Hotfix asap sounds good to me too. You could still put the extended-metadata change into dev almost straight afterwards, and get confidence/exposure on that without having to rush. |
|
Hi all, |
Whatever that is, it isn't related to this issue. Can you open a new issue for your problem. It would be even better if you can |
|
@tdgroot don’t want to rush you, so just let us know when you’ve got time to resolve the merge conflict in the changelog, or would like us to do it for you. |
This will allocate less strings and makes it possible to have const request option values. Also document why the metadata base url workaround is needed.
bcfc88d to
8dfc619
Compare
|
@roderickvd finally found some time. Just rebased my branch on |
|
Awesome thanks. Letting this cook for a few hours (and when I have enough time) before we push a release. |
|
Brilliant, thank you @tdgroot. |
hi there, sorry for asking. but i am using mopidy with the spotify-extension in a docker container. so all in all is there going to be a release of a new librespot version soon? best regards |
|
I am out for a few days now, and plan to do a release after. |
Everything to fix the recent issues is checked into the dev branch, you can look at the recently method PRs to see the other fix went in. So using the latest dev branch will work, if building that is feasible for you, until the release is cut. For the specific Mopidy-Spotify usecase, you can grab a fixed binary from |
This fixes #1527