hankhank10 / music-screen-api

Display the playing Sonos track in real time on an e-ink display - also includes functionality for last.fm
120 stars 17 forks source link

Track and Artist information not showing correctly using new BBC Sounds Sonos service #53

Closed ashenshugarRET closed 2 years ago

ashenshugarRET commented 2 years ago

The BBC in the UK have released a new Sonos service to stream their radio stations directly to Sonos speakers. The album artworks perfectly but the artist and track information is not rendering correctly, the song title is always showing as "Type=sng" and the artist is always showing as "Br P". Reviewing the JSON data from the node-http-sonos-api below seems to indicate this is due to the formatting used for the title parameter [ { "uuid": "XXXXXXXXXXXXXXXXXXXXX", "coordinator": { "uuid": "XXXXXXXXXXXXXXXXXXXXX", "state": { "volume": 16, "mute": false, "equalizer": { "bass": 0, "treble": 0, "loudness": true }, "currentTrack": { "artist": "Radio 2", "title": "BR P|TYPE=SNG|TITLE Twisting By The Pool|ARTIST Dire Straits|ALBUM", "albumArtUri": "https://ichef.bbci.co.uk/images/ic/640x640/p01bqgwt.jpg", "duration": 0, "uri": "x-sonosapi-hls:stations%7eplayable%7e%7ebbc_radio_two%7e%7eurn%3abbc%3aradio%3anetwork%3abbc_radio_two?sid=325&flags=288&sn=10", "trackUri": "x-sonosapi-hls:stations%7eplayable%7e%7ebbc_radio_two%7e%7eurn%3abbc%3aradio%3anetwork%3abbc_radio_two?sid=325&flags=288&sn=10", "type": "radio", "stationName": "Radio 2", "absoluteAlbumArtUri": "https://ichef.bbci.co.uk/images/ic/640x640/p01bqgwt.jpg" }, "nextTrack": { "artist": "", "title": "", "album": "", "albumArtUri": "", "duration": 0, "uri": "" }, "trackNo": 1, "elapsedTime": 444, "elapsedTimeFormatted": "00:07:24", "playbackState": "PLAYING", "playMode": { "repeat": "none", "shuffle": false, "crossfade": false } }, "roomName": "Office", "coordinator": "XXXXXXXXXXXXXXXXXXXXX", "groupState": { "volume": 16, "mute": false } }, "members": [ { "uuid": "XXXXXXXXXXXXXXXXXXXXX", "state": { "volume": 16, "mute": false, "equalizer": { "bass": 0, "treble": 0, "loudness": true }, "currentTrack": { "artist": "Radio 2", "title": "BR P|TYPE=SNG|TITLE Twisting By The Pool|ARTIST Dire Straits|ALBUM", "albumArtUri": "https://ichef.bbci.co.uk/images/ic/640x640/p01bqgwt.jpg", "duration": 0, "uri": "x-sonosapi-hls:stations%7eplayable%7e%7ebbc_radio_two%7e%7eurn%3abbc%3aradio%3anetwork%3abbc_radio_two?sid=325&flags=288&sn=10", "trackUri": "x-sonosapi-hls:stations%7eplayable%7e%7ebbc_radio_two%7e%7eurn%3abbc%3aradio%3anetwork%3abbc_radio_two?sid=325&flags=288&sn=10", "type": "radio", "stationName": "Radio 2", "absoluteAlbumArtUri": "https://ichef.bbci.co.uk/images/ic/640x640/p01bqgwt.jpg" }, "nextTrack": { "artist": "", "title": "", "album": "", "albumArtUri": "", "duration": 0, "uri": "" }, "trackNo": 1, "elapsedTime": 444, "elapsedTimeFormatted": "00:07:24", "playbackState": "PLAYING", "playMode": { "repeat": "none", "shuffle": false, "crossfade": false } }, "roomName": "Office", "coordinator": "XXXXXXXXXXXXXXXXXXXXX", "groupState": { "volume": 16, "mute": false } } ] } ]

@jjlawren Can the code in sonos_user_data.py be updated to correctly render the artist and track information for BBC radio station streaming through the Sonos Service?

Thanks

ashenshugarRET commented 2 years ago

I solved this and created a pull request #54 with the required changes

ashenshugarRET commented 2 years ago

Closing issue as this is fixed in pull request #54