Revert "Revert "Also check authentication via state""
This reverts commit 05aa97c0ad
.
This commit is contained in:
parent
ba9a24d70e
commit
2615ecfd79
4 changed files with 7 additions and 2 deletions
|
@ -17,6 +17,7 @@ import variables as v
|
|||
from downloadutils import DownloadUtils
|
||||
from PKC_listitem import convert_PKC_to_listitem
|
||||
import plexdb_functions as plexdb
|
||||
import state
|
||||
|
||||
###############################################################################
|
||||
log = logging.getLogger("PLEX."+__name__)
|
||||
|
@ -39,7 +40,7 @@ class Playback_Starter(Thread):
|
|||
"""
|
||||
log.info("Process_play called with plex_id %s, kodi_id %s"
|
||||
% (plex_id, kodi_id))
|
||||
if window('plex_authenticated') != "true":
|
||||
if not state.AUTHENTICATED:
|
||||
log.error('Not yet authenticated for PMS, abort starting playback')
|
||||
# Todo: Warn user with dialog
|
||||
return
|
||||
|
|
|
@ -19,4 +19,6 @@ SUSPEND_USER_CLIENT = False
|
|||
# Plex home user? Then "False". Along with window('plex_restricteduser')
|
||||
RESTRICTED_USER = False
|
||||
|
||||
# Along with window('plex_authenticated')
|
||||
AUTHENTICATED = False
|
||||
PLEX_TOKEN = None
|
||||
|
|
|
@ -159,6 +159,7 @@ class UserClient(threading.Thread):
|
|||
window('plex_machineIdentifier', value=self.machineIdentifier)
|
||||
window('plex_servername', value=self.servername)
|
||||
window('plex_authenticated', value='true')
|
||||
state.AUTHENTICATED = True
|
||||
|
||||
window('useDirectPaths', value='true'
|
||||
if settings('useDirectPaths') == "1" else 'false')
|
||||
|
@ -266,6 +267,7 @@ class UserClient(threading.Thread):
|
|||
self.doUtils.stopSession()
|
||||
|
||||
window('plex_authenticated', clear=True)
|
||||
state.AUTHENTICATED = False
|
||||
window('pms_token', clear=True)
|
||||
state.PLEX_TOKEN = None
|
||||
window('plex_token', clear=True)
|
||||
|
|
|
@ -303,7 +303,7 @@ class Service():
|
|||
sound=False)
|
||||
log.info("Server %s is online and ready." % server)
|
||||
window('plex_online', value="true")
|
||||
if window('plex_authenticated') == 'true':
|
||||
if state.AUTHENTICATED:
|
||||
# Server got offline when we were authenticated.
|
||||
# Hence resume threads
|
||||
state.SUSPEND_LIBRARY_THREAD = False
|
||||
|
|
Loading…
Reference in a new issue