Repository navigation
fix: play a list of tracks the Web API names spotify:webapi - #445
Open
RickatRITE wants to merge 2 commits into
Open
RickatRITE wants to merge 2 commits into
RickatRITE wants to merge 2 commits into
Conversation
A Web API play naming "uris" rather than a "context_uri" now sends its context with the uri "spotify:webapi" instead of none, with the tracks still inline. That uri is not a context type, so the play is refused with "unsupported context type: spotify:webapi": the API answers 204 and nothing plays, the same failure devgianlu#410 fixed for the context with no uri. Treat that uri like a missing one when inferring the type of a context, so the inline items decide. Any other unrecognised uri is still refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With metadata.context_sweep enabled, starting a list of tracks the Web API names "spotify:webapi" scheduled an enumeration of that uri, which names no context and fails with "unsupported context type". Skip it as the list with no uri already is: its items came with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows up on #410.
Problem
A Web API play that names tracks directly (
PUT /v1/me/player/playwith"uris": [...]and nocontext_uri) now reaches the device with the context urispotify:webapi. #410 fixed the same request when it came with no uri at all.spotify:webapiis not a context type, so the play is refused, the API still answers204, and nothing plays:I saw this with the v0.10.5 Windows release (
audio_backend: wasapi, zeroconf credentials) on 2026-11-13, for every such play over about 40 minutes; master has the same check. Spotify goes on reporting the device as playing, so a pause sent to it afterwards fails with403 Restriction violated, and the daemon logsfailed handling dealer requestwithno primary stream. I can't tell exactly when Spotify started sending this uri.Fix
InferSpotifyIdTypeFromContexttreatsspotify:webapi(WebApiTrackListUri) like a missing uri, so the inline items decide the type, as they have since #410. Any other unrecognised uri is still refused, as 1d150cc intended. The context keeps its uri, so the state reported back to Spotify namesspotify:webapias it was given.The second commit is a small follow-up. With
metadata.context_sweepenabled, starting such a list scheduled an enumeration ofspotify:webapi, which fails withunsupported context type. It is now skipped, as the list with no uri already is. It's a separate commit in case you'd rather not take it.Tests
TestInferSpotifyIdTypeFromContext: new cases forspotify:webapiwith tracks, with episodes, with gids only, and with no items.TestNewContextResolverWebApiUris: such a context resolves with no spclient, so nothing is fetched.TestContextSweepSkipsBareTrackLists: neither list is swept.gofmt,go vetandgo test -count=1 -tags "test_unit test_integration" ./...pass on Linux, and this branch's CI passed on Ubuntu, macOS and Windows on my fork.started wasapi outputandloaded track (paused: false, ...), and audio plays.Not covered
I left these alone, since I haven't seen Spotify send them:
playlist_number_of_tracksthat doesn't match still lead to a resolve of the uri, which fails. A list with no uri behaves the same.spotify:webapi, with no pages, is not empty toemptyContext, so it doesn't fall back to the current track as an empty context does.spotify:webapias the context uri. I haven't checked whether Spotify accepts that.🤖 Generated with Claude Code