Fix Spotify scopes evaluation (#42819)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
pull/40619/head^2
Kevin Hellemun 2020-11-09 00:46:26 +01:00 committed by GitHub
parent 8b998365a4
commit e929ae10cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -218,7 +218,9 @@ class SpotifyMediaPlayer(MediaPlayerEntity):
self._name = f"Spotify {name}"
self._session = session
self._spotify = spotify
self._scope_ok = set(session.token["scope"].split(" ")) == set(SPOTIFY_SCOPES)
self._scope_ok = set(session.token["scope"].split(" ")).issuperset(
SPOTIFY_SCOPES
)
self._currently_playing: Optional[dict] = {}
self._devices: Optional[List[dict]] = []
@ -474,6 +476,9 @@ class SpotifyMediaPlayer(MediaPlayerEntity):
"""Implement the websocket media browsing helper."""
if not self._scope_ok:
_LOGGER.debug(
"Spotify scopes are not set correctly, this can impact features such as media browsing"
)
raise NotImplementedError
if media_content_type in [None, "library"]: