mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Check mpd time type before splitting it (#40139)
This commit is contained in:
parent
0bb8a49ea2
commit
30de984827
@ -138,12 +138,12 @@ class MpdDevice(MediaPlayerEntity):
|
|||||||
if position is None:
|
if position is None:
|
||||||
position = self._status.get("time")
|
position = self._status.get("time")
|
||||||
|
|
||||||
if position is not None and ":" in position:
|
if isinstance(position, str) and ":" in position:
|
||||||
position = position.split(":")[0]
|
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 = int(position)
|
self._media_position = int(float(position))
|
||||||
|
|
||||||
self._update_playlists()
|
self._update_playlists()
|
||||||
|
|
||||||
@ -159,8 +159,9 @@ class MpdDevice(MediaPlayerEntity):
|
|||||||
self._connect()
|
self._connect()
|
||||||
|
|
||||||
self._fetch_status()
|
self._fetch_status()
|
||||||
except (mpd.ConnectionError, OSError, BrokenPipeError, ValueError):
|
except (mpd.ConnectionError, OSError, BrokenPipeError, ValueError) as error:
|
||||||
# Cleanly disconnect in case connection is not in valid state
|
# Cleanly disconnect in case connection is not in valid state
|
||||||
|
_LOGGER.debug("Error updating status: %s", error)
|
||||||
self._disconnect()
|
self._disconnect()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user