mirror of
https://github.com/home-assistant/core
synced 2024-09-03 08:14:07 +02: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…
Reference in New Issue
Block a user