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

pull/76595/head
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
1 changed files with 4 additions and 1 deletions

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