mirror of
https://github.com/home-assistant/core.git
synced 2025-05-13 02:19:16 +00:00
Provide Sonos media position if duration not available (#73001)
This commit is contained in:
parent
14030991cf
commit
04b2223f06
@ -205,13 +205,15 @@ class SonosMedia:
|
||||
self, position_info: dict[str, int], force_update: bool = False
|
||||
) -> None:
|
||||
"""Update state when playing music tracks."""
|
||||
if (duration := position_info.get(DURATION_SECONDS)) == 0:
|
||||
duration = position_info.get(DURATION_SECONDS)
|
||||
current_position = position_info.get(POSITION_SECONDS)
|
||||
|
||||
if not (duration or current_position):
|
||||
self.clear_position()
|
||||
return
|
||||
|
||||
should_update = force_update
|
||||
self.duration = duration
|
||||
current_position = position_info.get(POSITION_SECONDS)
|
||||
|
||||
# player started reporting position?
|
||||
if current_position is not None and self.position is None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user