CFenner/MMM-Sonos

Album art not showing

Opened this issue · 8 comments

Everything else works, but I'm seeing only a generic icon where the album art should be. Except during commercial, then the graphic appears. Has anyone seen this?

Did it ever work correct? Is the album art also missing if you tune into a radio station?

radio station album art works for me. still get name of station , and then second line which is bbc.media.radio2_mf_p?s=1517844460&.....

@gmglickman can you query the sonos api and post the results here?

See jishi/node-sonos-http-api#673
I have a pull request in that mitigates this: #28

Is there any update on this issue?

I know the problem is the url for absoluteAlbumArtUri is relative, and doesn't include the full url when playing tracks from a local network media library, giving a broken album cover image. The /getaa?... image url won't work locally, but will if you give it a full url with any Sonos player's network ip.

I'm aware of the #28 pull request by @hdurdle which adds the artBase config to put in that needed Sonos ip, but that code doesn't work for me. It returns a "Uncaught (in promise) TypeError: cover is undefined" error. That pull request is still marked Open and needing branch conflicts resolved.

Ive updated my MMM-Sonos.js in the follwoing way (only the section update Room List all the way to the clean section)

Works for me ...

  updateRoomList: function (data) {
    const roomList = []
    data.forEach(function (item) {
      const roomName = this.getRoomName(item)
      if (roomName !== '') {
        const currentTrack = item.coordinator.state.currentTrack
        //Extract http from absoluteAlbumArtUri - might be required later
        let baseUrl = currentTrack.absoluteAlbumArtUri.split('/').slice(0, 3).join('/');
        let artist = currentTrack.artist
        let track = currentTrack.title
        // Get cover from albumArtUri - could be http or /getaa Version
        let cover = currentTrack.albumArtUri
        // Check what we got from albumArtUri and either add baseUrl or leave it 
        if (!cover.startsWith("http")) {
                // If not, prepend the base URL
                cover = baseUrl + cover;
            }
        //let cover = currentTrack.absoluteAlbumArtUri
        //        var streamInfo = currentTrack.streamInfo;
        //        var type = currentTrack.type;

        // clean data

Great, could you change that in the repository and create a pull request? I currently have no working setup to test this.

Just created pull request 97 - hope this helps