mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix Sonos get_queue action may fail if track metadata is missing (#130756)
initial commit
This commit is contained in:
parent
c219b512eb
commit
acfc4711cd
@ -782,9 +782,9 @@ class SonosMediaPlayerEntity(SonosEntity, MediaPlayerEntity):
|
||||
queue: list[DidlMusicTrack] = self.coordinator.soco.get_queue(max_items=0)
|
||||
return [
|
||||
{
|
||||
ATTR_MEDIA_TITLE: track.title,
|
||||
ATTR_MEDIA_ALBUM_NAME: track.album,
|
||||
ATTR_MEDIA_ARTIST: track.creator,
|
||||
ATTR_MEDIA_TITLE: getattr(track, "title", None),
|
||||
ATTR_MEDIA_ALBUM_NAME: getattr(track, "album", None),
|
||||
ATTR_MEDIA_ARTIST: getattr(track, "creator", None),
|
||||
ATTR_MEDIA_CONTENT_ID: track.get_uri(),
|
||||
}
|
||||
for track in queue
|
||||
|
@ -26,5 +26,17 @@
|
||||
"protocol_info": "file:*:audio/mpegurl:*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Track with no album or creator",
|
||||
"item_id": "Q:0/3",
|
||||
"parent_id": "Q:0",
|
||||
"original_track_number": 1,
|
||||
"resources": [
|
||||
{
|
||||
"uri": "x-file-cifs://192.168.42.10/music/TrackWithNoAlbumOrCreator.mp3",
|
||||
"protocol_info": "file:*:audio/mpegurl:*"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -71,6 +71,12 @@
|
||||
'media_content_id': 'x-file-cifs://192.168.42.10/music/The%20Beatles/Abbey%20Road/01%20Come%20Together.mp3',
|
||||
'media_title': 'Come Together',
|
||||
}),
|
||||
dict({
|
||||
'media_album_name': None,
|
||||
'media_artist': None,
|
||||
'media_content_id': 'x-file-cifs://192.168.42.10/music/TrackWithNoAlbumOrCreator.mp3',
|
||||
'media_title': 'Track with no album or creator',
|
||||
}),
|
||||
]),
|
||||
})
|
||||
# ---
|
||||
|
Loading…
x
Reference in New Issue
Block a user