Imaster#236
Open
simojenki wants to merge 6 commits into
Open
Conversation
…ta playlist listing
This change corrects how playlists are represented and served via SMAPI so Sonos treats them as actual playlists (not generic containers), and ensures playlist lists are returned from the appropriate endpoint.
What changed
Playlist metadata itemType changed from "container" → "playlist" for:
Individual playlist containers (playlist:${id})
The “Playlists” root node
Removed the “copy/reshape” PlaylistLike hack (and the placeholder entries: []) and now passes the real Playlist object into the playlist metadata builder.
Stopped serving “playlists” via getExtendedMetadata (removed the case "playlists" block there), leaving playlists to be surfaced via the normal metadata browsing path.
Tests updated to assert the new correct SMAPI shape:
"playlists" root is "playlist"
playlist containers are "playlist"
removed canEnumerate expectations for the playlists node/containers
Why
Sonos behaviour differs depending on itemType. Marking playlists as "container" causes them to be treated as generic folders rather than playlist entities, which breaks/impairs playlist semantics (including how entries are browsed/handled).
The prior PlaylistLike rehydration (and fake entries) was an implementation smell that masked the real object shape and made the behaviour inconsistent across SMAPI endpoints.
Moving playlist listing out of getExtendedMetadata reduces ambiguity: extended metadata is for details of an item, not for browsing a collection.
…s as SMAPI itemType=playlist and remove extended-metadata playlist listing
What’s happening (and why the submenu is missing): In SMAPI getMetadata, the playlist items themselves must come back with itemType: "playlist" (and canPlay: true) for Sonos to expose Play Now / Play Next / Add to End of Queue / Replace Queue. In the currently-working-build version, the playlist entries were being returned as itemType: "container" — that makes them browsable (so you can see playlist contents) but not treated as a playable playlist object, so Sonos doesn’t show the playback actions. What I changed: playlist() helper now returns: itemType: "playlist" (instead of "container") keeps canPlay: true and canEnumerate: true Updated the Jest expectations in smapi.test.ts to match (itemType: "playlist" for playlist entries). The root “Playlists” node (id: "playlists") remains itemType: "container" (that part was already correct for browsing).
hardens /art/, avoids invalid headers, and adds the "[object Object]" guard.
default:
// Sonos may call getExtendedMetadata on top-level containers
// (artists, albums, playlists, etc).
// Returning an empty-but-valid result prevents browse/search errors.
return getMetadataResult({
mediaCollection: [],
index: 0,
total: 0,
});
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.
No description provided.