Fix Spotify deviding None value in current progress (#76581)

This commit is contained in:
Franck Nijhof 2022-08-11 03:27:52 +02:00 committed by GitHub
parent dbfba3a951
commit 6e65cb4928
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -179,7 +179,10 @@ class SpotifyMediaPlayer(MediaPlayerEntity):
@property
def media_position(self) -> int | None:
"""Position of current playing media in seconds."""
if not self._currently_playing:
if (
not self._currently_playing
or self._currently_playing.get("progress_ms") is None
):
return None
return self._currently_playing["progress_ms"] / 1000