Add warning during playback if Plex token missing (#51853)

pull/51861/head
jjlawren 2021-06-14 13:09:27 -05:00 committed by GitHub
parent 0d40ba463e
commit e929774481
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -492,6 +492,10 @@ class PlexMediaPlayer(MediaPlayerEntity):
"Client is not currently accepting playback controls: %s", self.name
)
return
if not self.plex_server.has_token:
_LOGGER.warning(
"Plex integration configured without a token, playback may fail"
)
src = json.loads(media_id)
if isinstance(src, int):

View File

@ -537,6 +537,11 @@ class PlexServer:
"""Return the plexapi PlexServer instance."""
return self._plex_server
@property
def has_token(self):
"""Return if a token is used to connect to this Plex server."""
return self._token is not None
@property
def accounts(self):
"""Return accounts associated with the Plex server."""