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"

XML body

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.

Search Types

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 output

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>
	&lt;DIDL-Lite xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot; xmlns:r=&quot;urn:schemas-rinconnetworks-com:metadata-1-0/&quot; xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot;&gt;&lt;container id=&quot;A:ALBUM/...and%20Justice%20for%20All&quot; parentID=&quot;A:ALBUM&quot; restricted=&quot;true&quot;&gt;&lt;dc:title&gt;...and Justice for All&lt;/dc:title&gt;&lt;upnp:class&gt;object.container.album.musicAlbum&lt;/upnp:class&gt;&lt;res protocolInfo=&quot;x-rincon-playlist:*:*:*&quot;&gt;x-rincon-playlist:RINCON_000E5884455C01400#A:ALBUM/...and%20Justice%20for%20All&lt;/res&gt;&lt;dc:creator&gt;Metallica&lt;/dc:creator&gt;&lt;upnp:albumArtURI&gt;/getaa?u=x-file-cifs%3a%2f%2fTLE-SERVER%2fshare%2fogg%2fMetallica%2520-%2520and%2520Justice%2520for%2520All%2f01%2520-%2520Blackened.ogg&amp;amp;v=2&lt;/upnp:albumArtURI&gt;&lt;/container&gt;&lt;container id=&quot;A:ALBUM/...But%20Seriously&quot; parentID=&quot;A:ALBUM&quot; restricted=&quot;true&quot;&gt;&lt;dc:title&gt;...But Seriously&lt;/dc:title&gt;&lt;upnp:class&gt;object.container.album.musicAlbum&lt;/upnp:class&gt;&lt;res protocolInfo=&quot;x-rincon-playlist:*:*:*&quot;&gt;x-rincon-playlist:RINCON_000E5884455C01400#A:ALBUM/...But%20Seriously&lt;/res&gt;&lt;dc:creator&gt;Phil Collins&lt;/dc:creator&gt;&lt;upnp:albumArtURI&gt;/getaa?u=x-file-cifs%3a%2f%2fTLE-SERVER%2fshare%2fogg%2fPhil%2520Collins%2520-%2520But%2520Seriously%2f01%2520-%2520Hang%2520in%2520Long%2520Enough.ogg&amp;amp;v=2&lt;/upnp:albumArtURI&gt;&lt;/container&gt;&lt;/DIDL-Lite&gt;
      </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&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>

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 no res tag
  • The returned items in the tracks search are contained in item tags and not container tags. Futhermore, they contain some more tags with information (e.g. an album tag) than they other types of items, see the tracks_details.xml file for details. *The albums search has an extra creator tag
⚠️ **GitHub.com Fallback** ⚠️