mirror of
https://github.com/home-assistant/core.git
synced 2025-08-13 09:35:20 +02:00
Improve mpd media position handling (#39390)
* improve mpd media position handling * Update media_player.py * Update media_player.py * Update media_player.py
This commit is contained in:
@@ -133,10 +133,17 @@ class MpdDevice(MediaPlayerEntity):
|
|||||||
self._status = self._client.status()
|
self._status = self._client.status()
|
||||||
self._currentsong = self._client.currentsong()
|
self._currentsong = self._client.currentsong()
|
||||||
|
|
||||||
position = self._status.get("time")
|
position = self._status.get("elapsed")
|
||||||
|
|
||||||
|
if position is None:
|
||||||
|
position = self._status.get("time")
|
||||||
|
|
||||||
|
if position is not None and ":" in position:
|
||||||
|
position = position.split(":")[0]
|
||||||
|
|
||||||
if position is not None and self._media_position != position:
|
if position is not None and self._media_position != position:
|
||||||
self._media_position_updated_at = dt_util.utcnow()
|
self._media_position_updated_at = dt_util.utcnow()
|
||||||
self._media_position = position
|
self._media_position = int(position)
|
||||||
|
|
||||||
self._update_playlists()
|
self._update_playlists()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user