Repository navigation
feat: remove from playlists and tell whether one holds a track - #411
Merged
Merged
Conversation
isnogudus
force-pushed
the
feature/playlist-remove
branch
from
October 3, 2026 13:24
53fc6d3 to
9cb6f4d
Compare
Add POST /library/playlists/remove_track, which removes one entry from a playlist the user may edit: a REM change by index range, one entry at the position the client listed it, or else at the first occurrence. Playlists may hold an item more than once, and keying the removal by the item (Rem.items_as_key) would remove every duplicate, so the daemon checks that the position still holds the track and removes that entry only. The removal is based on the playlist's current revision and retried once when it changed; an entry no longer at its position is reported as 409 so the client lists the playlist again. Like appending, it drops the cached listing. Add GET /library/playlists/contains, which tells whether a playlist already holds items, so clients can ask before adding a duplicate. Both read the playlist through the new Spclient.PlaylistContents, which pages through it and reports a change between pages as a conflict. PlaylistAppend and PlaylistRemove now share how a change is sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
isnogudus
force-pushed
the
feature/playlist-remove
branch
from
October 3, 2026 13:32
9cb6f4d to
7e387e9
Compare
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.
Adds the two pieces a client needs to edit playlists comfortably: removing an entry, and checking for a duplicate before adding.
POST /library/playlists/remove_track{"playlist_uri", "uri", "position"}removes one entry from a playlist the user may edit.positionis optional; without it the first occurrence goes).uri, and sends aREMchange by index range (from_index,length1) based on the current revision; it is retried once if the playlist changed meanwhile. An entry no longer at its position answers 409, so the client lists the playlist again instead of removing the wrong track.Rem.items_as_key, as some clients do): Spotify then removed every duplicate of the track. Removing by index range removes exactly the named entry./context/trackslisting.GET /library/playlists/contains?playlist_uri=…&uris=…tells whether a playlist already holds up to 50 items, so a client can ask before adding a duplicate. The playlist is read fresh on every call.Both read the playlist with the new
Spclient.PlaylistContents, which pages through it (from/length, followingtruncated) and reports a revision change between pages as a conflict.PlaylistAppendandPlaylistRemovenow share how a change is sent.Testing
A, A, B, A, removing position 3 leftA, A, B— the named duplicate only;containsanswers correctly for a held and a missing track; a 1508-track playlist reads completely.go mod tidy,go generate ./...,gofmt, build andgo test -tags "test_unit test_integration" ./...are clean.🤖 Generated with Claude Code