Music Library Information - SonosCollaboration/SonosProtocol GitHub Wiki
This pages describes the different queries that can be performed to retrieve information from the music library.
Item | Value |
---|---|
Endpoint | [[Content Directory Endpoint |
Action | "urn:schemas-upnp-org:service:ContentDirectory:1#Browse" |
The generel structure of the XML body is as listed below.
<u:Browse xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1">
<ObjectID>{search}</ObjectID>
<BrowseFlag>BrowseDirectChildren</BrowseFlag>
<Filter>dc:title,res,dc:creator,upnp:artist,upnp:album,upnp:albumArtURI</Filter>
<StartingIndex>{start}</StartingIndex>
<RequestedCount>{max_items}</RequestedCount>
<SortCriteria></SortCriteria>
</u:Browse>
The values in {} are the ones that should be replaced when creating the request, where:
Variable | Value |
---|---|
search | The string that describes the search type, [[see below |
start | The stating number of the returned items (zero based) |
max_items | The maximum number of items returned. Note the unit may limit the returned values to a smaller number, presumably due to communication size issues. |
The supported search types are listed in the table below
Search string | Returns |
---|---|
A: | A list of the search folders in the next rows (A:***) |
A:ARTIST | A list of artists |
A:ALBUMARTIST | A list of album artists |
A:ALBUM | A list albums |
A:GENRE | A list of genres |
A:COMPOSER | A list of composers |
A:TRACKS | A list of tracks |
A:PLAYLISTS | A list of playlists |
Example xml files for each the return value for each of these searches can be found in the music_library_information folder. For each search these a base file with the total output and a "details" file with just the xml for the items.
Example XML for e.g. the albums as follows:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:BrowseResponse xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1">
<Result>
<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><container id="A:ALBUM/...and%20Justice%20for%20All" parentID="A:ALBUM" restricted="true"><dc:title>...and Justice for All</dc:title><upnp:class>object.container.album.musicAlbum</upnp:class><res protocolInfo="x-rincon-playlist:*:*:*">x-rincon-playlist:RINCON_000E5884455C01400#A:ALBUM/...and%20Justice%20for%20All</res><dc:creator>Metallica</dc:creator><upnp:albumArtURI>/getaa?u=x-file-cifs%3a%2f%2fTLE-SERVER%2fshare%2fogg%2fMetallica%2520-%2520and%2520Justice%2520for%2520All%2f01%2520-%2520Blackened.ogg&amp;v=2</upnp:albumArtURI></container><container id="A:ALBUM/...But%20Seriously" parentID="A:ALBUM" restricted="true"><dc:title>...But Seriously</dc:title><upnp:class>object.container.album.musicAlbum</upnp:class><res protocolInfo="x-rincon-playlist:*:*:*">x-rincon-playlist:RINCON_000E5884455C01400#A:ALBUM/...But%20Seriously</res><dc:creator>Phil Collins</dc:creator><upnp:albumArtURI>/getaa?u=x-file-cifs%3a%2f%2fTLE-SERVER%2fshare%2fogg%2fPhil%2520Collins%2520-%2520But%2520Seriously%2f01%2520-%2520Hang%2520in%2520Long%2520Enough.ogg&amp;v=2</upnp:albumArtURI></container></DIDL-Lite>
</Result>
<NumberReturned>2</NumberReturned>
<TotalMatches>402</TotalMatches>
<UpdateID>0</UpdateID>
</u:BrowseResponse>
</s:Body>
</s:Envelope>
Some metadata for the search is contained in the response and the code for the search items are contained in the Result
tag as text. Interpreting the result as XML it looks like the following:
<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/">
<container id="A:ALBUM/...and%20Justice%20for%20All" parentID="A:ALBUM" restricted="true">
<dc:title>...and Justice for All</dc:title>
<upnp:class>object.container.album.musicAlbum</upnp:class>
<res protocolInfo="x-rincon-playlist:*:*:*">x-rincon-playlist:RINCON_000E5884455C01400#A:ALBUM/...and%20Justice%20for%20All</res>
<dc:creator>Metallica</dc:creator>
<upnp:albumArtURI>/getaa?u=x-file-cifs%3a%2f%2fTLE-SERVER%2fshare%2fogg%2fMetallica%2520-%2520and%2520Justice%2520for%2520All%2f01%2520-%2520Blackened.ogg&v=2</upnp:albumArtURI>
</container>
<container id="A:ALBUM/...But%20Seriously" parentID="A:ALBUM" restricted="true">
<dc:title>...But Seriously</dc:title>
<upnp:class>object.container.album.musicAlbum</upnp:class>
<res protocolInfo="x-rincon-playlist:*:*:*">x-rincon-playlist:RINCON_000E5884455C01400#A:ALBUM/...But%20Seriously</res>
<dc:creator>Phil Collins</dc:creator>
<upnp:albumArtURI>/getaa?u=x-file-cifs%3a%2f%2fTLE-SERVER%2fshare%2fogg%2fPhil%2520Collins%2520-%2520But%2520Seriously%2f01%2520-%2520Hang%2520in%2520Long%2520Enough.ogg&v=2</upnp:albumArtURI>
</container>
</DIDL-Lite>
Notice how, even though we are dealing with a album item, the name of the album is contained in the title
tag and not, as one might think, in a album
tage. The title
tag is used for the name of the search item in all the searches. With a few exceptions, listed in the following, all the return values for these queries look the same as the examples shown above:
- The
A:PLAYLISTS
item in the folder search has nores
tag - The returned items in the tracks search are contained in
item
tags and notcontainer
tags. Futhermore, they contain some more tags with information (e.g. analbum
tag) than they other types of items, see the tracks_details.xml file for details. *The albums search has an extracreator
tag