Sonos sends me this query (abridged):
<getMetadata>
<id>playlists</id>
</getMetadata>
I respond:
<getMetadataResponse>
<getMetadataResult>
<count>2</count>
<index>0</index>
<total>2</total>
<mediaCollection readOnly=\"false\" userContent=\"false\" renameable=\"false\">
<itemType>playlist</itemType>
<id>playlist:29986647</id>
<title>playlist-1</title>
<albumArtURI>uri1</albumArtURI>
<canPlay>true</canPlay>
</mediaCollection>
<mediaCollection readOnly=\"false\" userContent=\"false\" renameable=\"false\">
<itemType>playlist</itemType>
<id>playlist:28002250</id>
<title>playlist-2</title>
<albumArtURI>uri2</albumArtURI>
<canPlay>true</canPlay>
</mediaCollection>
</getMetadataResult>
</getMetadataResponse>
In the Sonos app (S2), when I click on Playlists it just shows the title of the page as "playlist-1" and no tracks are listed. playlist-2
is ignored, and I don't get a call to return the tracks for playlist-1
.
I guess this is something to do with mediaCollection
s, itemType
s and containment - should there be a root collection? Am I using the correct itemType
?
Regarding itemType
, I noticed that when displaying genres, these seem to work when returned as albumList
s rather than genre
s. I have tried trackList
as an alternative to playlist
but that doesn't work.
The code I'm using is based on bonob.
I found that the problem was that when getMetadata
was called for the root collection, we were returning the playlists container with itemType
as playlist
. This meant the resulting item, when clicked, wasn't drawn as a container. Changing this to container
fixed the problem and showed all the playlists.