Add seek support to LinkPlay (#130349)

This commit is contained in:
Simon Lamon 2024-11-11 12:49:56 +01:00 committed by GitHub
parent 7a4dac1eb1
commit 870bf388e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -298,6 +298,11 @@ class LinkPlayMediaPlayerEntity(MediaPlayerEntity):
except ValueError as err:
raise HomeAssistantError(err) from err
@exception_wrap
async def async_media_seek(self, position: float) -> None:
"""Seek to a position."""
await self._bridge.player.seek(round(position))
@exception_wrap
async def async_join_players(self, group_members: list[str]) -> None:
"""Join `group_members` as a player group with the current player."""
@ -383,9 +388,9 @@ class LinkPlayMediaPlayerEntity(MediaPlayerEntity):
)
self._attr_source = SOURCE_MAP.get(self._bridge.player.play_mode, "other")
self._attr_media_position = self._bridge.player.current_position / 1000
self._attr_media_position = self._bridge.player.current_position_in_seconds
self._attr_media_position_updated_at = utcnow()
self._attr_media_duration = self._bridge.player.total_length / 1000
self._attr_media_duration = self._bridge.player.total_length_in_seconds
self._attr_media_artist = self._bridge.player.artist
self._attr_media_title = self._bridge.player.title
self._attr_media_album_name = self._bridge.player.album