Improved media player?

Hi all,

I'm wondering if there are any plans for an improved media player?

I understand that it needs to work with a significant number of platforms, but it would be really good to get two features added to the existing dashboard widget if possible:

  1. Album art based on "currently playing"
  2. The ability to swipe left/right on the icon for the current song/station to move forward/back in the playlist

Does anyone know if there are plans to support something like this?

Fwiw, I've got a C5 and most of my speakers are SONOS.

1 Like

OK, I'm looking into this a bit more and I've found that the MakerAPI exposes the following data when you interrogate a SONOS speaker:

   "album" : "Where Will I Be? (Acoustic)",
   "artist" : "Patrick James",
   "audioSource" : "Sonos Q",
   "enqueuedUri" : "x-rincon-cpcontainer:1006206cspotify%3aplaylist%3a2O4QEcrn4ktDdkOhM2lS5x?sid=9&flags=8300&sn=2",
   "level" : "11",
   "metaData" : "<DIDL-Lite xmlns:dc=\"\" 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/\"><item id=\"1006206cspotify%3aplaylist%3a2O4QEcrn4ktDdkOhM2lS5x\" parentID=\"00020000playlist:coffe house\" restricted=\"true\"><dc:title>Coffee House Acoustic \\u2615</dc:title><upnp:class>object.container.playlistContainer</upnp:class><dc:creator>Double J Music</dc:creator><upnp:albumArtURI></upnp:albumArtURI><r:description>Coffee House Acoustic \\u2615</r:description><desc id=\"cdudn\" nameSpace=\"urn:schemas-rinconnetworks-com:metadata-1-0/\">SA_RINCON<MY ID>_X_#Svc2311-0-Token</desc></item></DIDL-Lite>",
   "mute" : "unmuted",
   "name" : "Where Will I Be? - Acoustic",
   "station" : null,
   "status" : "paused",
   "trackMetaData" : "<DIDL-Lite xmlns:dc=\"\" 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/\"><item id=\"-1\" parentID=\"-1\" restricted=\"true\"><res protocolInfo=\"*:audio/x-spotify:*\" duration=\"0:04:13\">x-sonos-spotify:spotify%3atrack%3a2ICCVrvTSWLQXNFoXwIZxR?sid=9&amp;flags=8224&amp;sn=2</res><r:streamContent></r:streamContent><r:radioShowMd></r:radioShowMd><upnp:albumArtURI>/getaa?s=1&amp;u=x-sonos-spotify%3aspotify%253atrack%253a2ICCVrvTSWLQXNFoXwIZxR%3fsid%3d9%26flags%3d8224%26sn%3d2</upnp:albumArtURI><dc:title>Where Will I Be? - Acoustic</dc:title><upnp:class>object.item.audioItem.musicTrack</upnp:class><dc:creator>Patrick James</dc:creator><upnp:album>Where Will I Be? (Acoustic)</upnp:album></item></DIDL-Lite>",
   "trackNumber" : "20",
   "trackUri" : "x-sonos-spotify:spotify%3atrack%3a2ICCVrvTSWLQXNFoXwIZxR?sid=9&flags=8224&sn=2",
   "transportUri" : "x-rincon-queue:RINCON_<MY ID>#0",
   "uri" : "x-rincon-queue:RINCON_<MY ID>#0"

In the {metaData} section, there's a URL for the AlbumArt, and it seems to be XML embedded in JSON (:face_vomiting:), so it should be relatively easy to parse out?

EDIT The XML is DIDL, sample python for parsing out the Album Art is as follows:

import requests
import json
from didl_lite import didl_lite

uri = "http://<my hub>/apps/api/<app id>/devices/<device id>?access_token=<my access token>"

r = requests.get(uri)

data = r.json()
meta = json.loads(data["attributes"][1]["currentValue"])

didl = didl_lite.from_xml_string(meta["metaData"])
artwork = getattr(didl[0], "album_art_uri")

This returns which converts to

any chance you could make a driver where you put in your sonos ip address and it makes the album art available to a dashboard tile?

1 Like

Interestingly, searching around for groovy didl media found DLNA-PLAYER/Media Renderer Events.groovy at master · SmartThingsUle/DLNA-PLAYER · GitHub which presumably can be converted to a HE app/device somehow?

1 Like

I can’t speak to whether or not it still works as I havent used it in a long time but someone ported it,

1 Like

Thanks for this, I've only just got around to testing it, I assume this replaces the current driver I'm using for my Sonos devices?

I don't own a Sonos, but I believe that is correct.

1 Like

OK, thanks, I'm struggling to see the album art in the dashboard but it does seem to track the playlists etc.