mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Detect when media position is stale in vlc_telnet (#48434)
PR extracted from #44776.
This commit is contained in:
parent
4487565232
commit
48c0cfb25c
@ -36,6 +36,7 @@ from homeassistant.const import (
|
|||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -141,7 +142,12 @@ class VlcDevice(MediaPlayerEntity):
|
|||||||
|
|
||||||
if self._state != STATE_IDLE:
|
if self._state != STATE_IDLE:
|
||||||
self._media_duration = self._vlc.get_length()
|
self._media_duration = self._vlc.get_length()
|
||||||
self._media_position = self._vlc.get_time()
|
vlc_position = self._vlc.get_time()
|
||||||
|
|
||||||
|
# Check if current position is stale.
|
||||||
|
if vlc_position != self._media_position:
|
||||||
|
self._media_position_updated_at = dt_util.utcnow()
|
||||||
|
self._media_position = vlc_position
|
||||||
|
|
||||||
info = self._vlc.info()
|
info = self._vlc.info()
|
||||||
_LOGGER.debug("Info: %s", info)
|
_LOGGER.debug("Info: %s", info)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user