So I got a chance to install cast-web-api and take a closer look. It looks like album art is stored in the image
field in the trackData
attribute.
@vervallsweg any thoughts on remapping this field of the trackData attribute to better match the official Sonos driver?
For reference purposes, here’s the existing reported trackData
for a few test cases:
Spotify
{
"application": "Spotify",
"title": "You Make My Dreams",
"groupPlayback": false,
"muted": false,
"status": "PLAYING",
"subtitle": "Daryl Hall & John Oates",
"volume": 8,
"image": "https://i.scdn.co/image/ab67616d00001e026de69821e8460a9d689e20ba"
}
Google Play Music
{
"title": "Ruby, My Dear (feat. Coleman Hawkins)",
"application": "Google Play Music",
"status": "PLAYING",
"muted": false,
"groupPlayback": false,
"volume": 8,
"subtitle": "Thelonious Monk Septet",
"image": "http://lh3.googleusercontent.com/N9WJY4KjbfqWSDS0a1nLM_sM30yIYBq0siCmc18GJLQM_1xzC6t4NQDht05mGJxCk1stlWzq7A"
}
Pandora
{
"title": "Radioactive",
"application": "Pandora",
"status": "PLAYING",
"muted": false,
"groupPlayback": false,
"volume": 8,
"subtitle": "Imagine Dragons",
"image": "http://mediaserver-cont-dc6-2-v4v6.pandora.com/images/public/int/1/6/4/6/602537286461_500W_500H.jpg"
}
If the driver could remap the field names to match what the Sonos driver is using (or at least duplicate a few select fields under different aliases), that would improve compatibility and get the album art working:
Current Field |
|
Mapped Field |
image |
→ |
albumArtUrl |
application |
→ |
mediaSource |
subtitle |
→ |
artist† |
† This might not be a perfect mapping for non-music sources. I tried a few podcasts and news and it was a reasonable enough translation in my limited tests.
Other Examples:
'Play the News' Example
{
"application": "Google News",
"title": "Congress demands answers from Trump about Soleimani killing",
"groupPlayback": false,
"muted": false,
"status": "BUFFERING",
"subtitle": "AP Audio Stories",
"volume": 8,
"image": "https://images.theabcdn.com/i/33861969/1400x1400.jpg"
}
'Play a Podcast' Example
{
"application": "Google Podcasts",
"title": "\"You Have the Rite\" | Marc Bamuthi Joseph",
"groupPlayback": false,
"muted": false,
"status": "PLAYING",
"subtitle": "",
"volume": 8,
"image": "https://lh3.googleusercontent.com/proxy/etAt_XgRZDaEMNIZg0tPh3_6M5TfyTAeaR1WwY0xh_jOl2eNaT5a2t8YFhIkFWczXLt5ak2kSrKFVEm3nkHtwcmikW6G158oz6wX-Q=s225-e14"
}
As noted in my original post above, these are technically in the new audioTrackData
attribute (from the Audio Track Data capability) in the official Sonos device… though at least getting a remapped field within the trackData
attribute would bring these closer to parity.