mirror of
https://github.com/home-assistant/core.git
synced 2025-07-30 16:57:19 +00:00
Fixes for Sonos media titles (#34311)
This commit is contained in:
parent
81d006499e
commit
de440cf579
@ -419,7 +419,7 @@ class SonosEntity(MediaPlayerDevice):
|
|||||||
if self._status in ("PAUSED_PLAYBACK", "STOPPED",):
|
if self._status in ("PAUSED_PLAYBACK", "STOPPED",):
|
||||||
# Sonos can consider itself "paused" but without having media loaded
|
# Sonos can consider itself "paused" but without having media loaded
|
||||||
# (happens if playing Spotify and via Spotify app you pick another device to play on)
|
# (happens if playing Spotify and via Spotify app you pick another device to play on)
|
||||||
if self._media_title is None:
|
if self.media_title is None:
|
||||||
return STATE_IDLE
|
return STATE_IDLE
|
||||||
return STATE_PAUSED
|
return STATE_PAUSED
|
||||||
if self._status in ("PLAYING", "TRANSITIONING"):
|
if self._status in ("PLAYING", "TRANSITIONING"):
|
||||||
@ -614,12 +614,19 @@ class SonosEntity(MediaPlayerDevice):
|
|||||||
except (TypeError, KeyError, AttributeError):
|
except (TypeError, KeyError, AttributeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Radios without tagging can have part of the radio URI as title.
|
# Non-playing radios will not have a current title. Radios without tagging
|
||||||
# Non-playing radios will not have a current title. In these cases we
|
# can have part of the radio URI as title. In these cases we try to use the
|
||||||
# try to use the radio name instead.
|
# radio name instead.
|
||||||
try:
|
try:
|
||||||
if self._media_title in self._uri or self.state != STATE_PLAYING:
|
uri_meta_data = variables["enqueued_transport_uri_meta_data"]
|
||||||
self._media_title = variables["enqueued_transport_uri_meta_data"].title
|
if isinstance(
|
||||||
|
uri_meta_data, pysonos.data_structures.DidlAudioBroadcast
|
||||||
|
) and (
|
||||||
|
self.state != STATE_PLAYING
|
||||||
|
or self.soco.is_radio_uri(self._media_title)
|
||||||
|
or self._media_title in self._uri
|
||||||
|
):
|
||||||
|
self._media_title = uri_meta_data.title
|
||||||
except (TypeError, KeyError, AttributeError):
|
except (TypeError, KeyError, AttributeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user