wait_for_it
wait_for_it

Reputation: 15

Unable to Edit/Create playlists in "playlists" container in Sonos version 5.4 (latest update)

When I updated to version 5.4 I no longer have the option to create a playlist in the "playlists" container, nor to add a track to a playlist already existing in it. In version 5.3 it was working well. I also checked other Music Services on Sonos, same problem. Did anything change in the specifications for User Content Playlists that is not specified in the documentation for Playlist Editing?

This is how I'm adding my User Content container:

$result->mediaCollection[] = array('id'=>'playlists', 'title'=>'My Playlists', 'itemType'=>'favorites', 'containsFavorite'=>true, 'displayType'=>'genreList', 'readOnly'=>false, 'userContent'=>true, 'renameable'=>true, 'albumArtURI'=>PATH.'/img.png');

Edit:
I am using the Android controller (version 5.4, build 29590261) and I am testing on a Play:1 (version 5.4, build 29591030).
I am able to add a song/playlist to an already existing playlist or to a new playlist (by long press on a song to get to the extended metadata, and then "Add Track to 'Service Name' Playlist"), but what I can't figure out how to do is: deleting a playlist, renaming a playlist, and editing songs in a playlist (reorder, delete songs). I don't have a screenshot for version 5.3 but there was an button in the top right corner (three vertical dots) of the playlists container from which one can edit playlists or create new ones (check the screenshots below, from version 5.4). Am I missing something?

The playlists container Long press on the playlists container

Edit 2:
I figured out what is causing the issue. I am using the .wsdl for beta in order to be able to implement Custom Item Display (This is not beta anymore, as I understood from the Adding New SMAPI Features page). When I revert to the normal Sonos.wsdl file from the Sonos Documentation, the info and options button appears again. How can I use Custom Item Display while keeping the info and options button there and all functionalities of playlist editing unchanged?

Note: the Sonos(beta).wsdl was here but it's not available anymore.

Edit 3:
I downloaded the Sonos.wsdl from the Sonos documentation, but I still can't see the button. In order to reproduce the issue, please check the following PHP implementation and Presentation Map XML code:

PHP implementation:

define('BASE_PATH', rtrim("http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']), '/'));

class SonosAPI
{
    public function getMetadata($args)
    {
        $result = new StdClass();
        $result->index = $args->index;
        switch($args->id) {
            case 'root':
                $result->mediaCollection[] = array('id'=>'playlists', 'title'=>'My Playlists', 'itemType'=>'favorites', 'displayType'=>'genreList', 'readOnly'=>false, 'userContent'=>true, 'renameable'=>true, 'albumArtURI'=>BASE_PATH.'/image.png');
                $result->count = $result->total = 1;
                break;
            case 'playlists':
                $result->mediaCollection[] = array('id'=>'123', 'title'=>'Title', 'itemType'=>'playlist', 'displayType'=>'genreList', 'canPlay'=>true, 'readOnly'=>false, 'userContent'=>false, 'renameable'=>true, 'albumArtURI'=>BASE_PATH.'/image.png');
                $result->count = $result->total = 1;
                break;
        }

        return array('getMetadataResult' => $result);
    }

}

$server = new SoapServer("Sonos.wsdl", array('cache_wsdl' => 0)); // disable cache in development
$server->setClass('SonosAPI');

try {
    $server->handle();
} catch (Exception $e) {
    Log("[ERROR] ".$e->getMessage());
}

?>

Presentation Map file:

<?xml version="1.0" encoding="utf-8" ?>
<Presentation>

    <PresentationMap type="DisplayType">
        <DisplayType id="genreGrid">
            <DisplayMode>GRID</DisplayMode>
        </DisplayType>
        <DisplayType id="genreList">
            <DisplayMode>LIST</DisplayMode>
        </DisplayType>
        <DisplayType id="genreHero">
            <DisplayMode>HERO</DisplayMode>
        </DisplayType>
        <DisplayType id="genreEditorial">
            <DisplayMode>EDITORIAL</DisplayMode>
        </DisplayType>
        <DisplayType id="twoLine">
          <Lines>
            <Line token="title"/>
            <Line token="summary"/>
          </Lines>
        </DisplayType>
    </PresentationMap>

</Presentation>

XML response to getMetadata of root (which contains the playlists container):

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns1="http://www.sonos.com/Services/1.1" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Body>
      <ns1:getMetadataResponse>
         <ns1:getMetadataResult>
            <ns1:index>0</ns1:index>
            <ns1:count>4</ns1:count>
            <ns1:total>4</ns1:total>
            <ns1:mediaCollection>
               <ns1:id>rootlang:ar</ns1:id>
               <ns1:itemType>collection</ns1:itemType>
               <ns1:displayType>genreGrid</ns1:displayType>
               <ns1:title>Arabic</ns1:title>
               <ns1:albumArtURI>{SOME LINK}</ns1:albumArtURI>
            </ns1:mediaCollection>
            <ns1:mediaCollection>
               <ns1:id>rootlang:en</ns1:id>
               <ns1:itemType>collection</ns1:itemType>
               <ns1:displayType>genreGrid</ns1:displayType>
               <ns1:title>International</ns1:title>
               <ns1:albumArtURI>{SOME LINK}</ns1:albumArtURI>
            </ns1:mediaCollection>
            <ns1:mediaCollection>
               <ns1:id>rootlang:default</ns1:id>
               <ns1:itemType>collection</ns1:itemType>
               <ns1:displayType>genreGrid</ns1:displayType>
               <ns1:title>Arabic + International</ns1:title>
               <ns1:albumArtURI>{SOME LINK}</ns1:albumArtURI>
            </ns1:mediaCollection>
            <ns1:mediaCollection renameable="true" readOnly="false" userContent="true">
               <ns1:id>playlists</ns1:id>
               <ns1:itemType>favorites</ns1:itemType>
               <ns1:displayType>genreList</ns1:displayType>
               <ns1:title>My Playlists</ns1:title>
               <ns1:albumArtURI>{SOME LINK}</ns1:albumArtURI>
            </ns1:mediaCollection>
         </ns1:getMetadataResult>
      </ns1:getMetadataResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

XML response to getMetadata of playlists:

 <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns1="http://www.sonos.com/Services/1.1" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Body>
      <ns1:getMetadataResponse>
         <ns1:getMetadataResult>
            <ns1:index>0</ns1:index>
            <ns1:count>1</ns1:count>
            <ns1:total>1</ns1:total>
            <ns1:mediaCollection renameable="true" readOnly="false" userContent="false">
               <ns1:id>playlist:19663408</ns1:id>
               <ns1:itemType>playlist</ns1:itemType>
               <ns1:displayType>genreList</ns1:displayType>
               <ns1:title>Test Playlist</ns1:title>
               <ns1:canPlay>true</ns1:canPlay>
               <ns1:albumArtURI>{SOME LINK}</ns1:albumArtURI>
            </ns1:mediaCollection>
         </ns1:getMetadataResult>
      </ns1:getMetadataResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Upvotes: 0

Views: 886

Answers (1)

Custom Display Types were made available in the most recent production software update. The beta wsdl that you were using is for v5.4 which is now the current production build. Make sure that you are using the production version of the wsdl and you will have info & options and also have access to Custom Display Types (provided they are properly enabled in your service).

However I have confirmed that we do have a bug when using Display Types with playlist containers when playlist editing is enabled. The work around is to removed the displayType node from your root playlist and child playlist containers (all other containers that use displayType do not need to be changed). This work around has been tested and works. We have opened an issue to track this internally.

Upvotes: 0

Related Questions