From f7da47f2d5588d51cb94b315802669f2a7d9514a Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Wed, 17 May 2017 16:15:16 +0200 Subject: [PATCH] Rename Plex user id --- resources/lib/librarysync.py | 6 +++--- resources/lib/state.py | 2 +- resources/lib/userclient.py | 6 +++--- resources/lib/websocket_client.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index 4f67d542..336d5d5e 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -1352,13 +1352,13 @@ class LibrarySync(Thread): # Hence must be us (since several users require plex.tv # token for PKC) pass - elif not (currSess['userId'] == state.CURRENT_USER_ID + elif not (currSess['userId'] == state.PLEX_USER_ID or currSess['username'] == state.PLEX_USERNAME): log.debug('Our username %s, userid %s did not match ' 'the session username %s with userid %s' % (state.PLEX_USERNAME, - state.CURRENT_USER_ID, + state.PLEX_USER_ID, currSess['username'], currSess['userId'])) continue @@ -1397,7 +1397,7 @@ class LibrarySync(Thread): }) log.debug('Update playstate for user %s with id %s: %s' % (state.PLEX_USERNAME, - state.CURRENT_USER_ID, + state.PLEX_USER_ID, items[-1])) # Now tell Kodi where we are for item in items: diff --git a/resources/lib/state.py b/resources/lib/state.py index 684e1aad..24fc2522 100644 --- a/resources/lib/state.py +++ b/resources/lib/state.py @@ -28,4 +28,4 @@ AUTHENTICATED = False PLEX_TOKEN = None # Plex ID of the current user (e.g. for plex.tv) as a STRING PLEX_USERNAME = None -CURRENT_USER_ID = None +PLEX_USER_ID = None diff --git a/resources/lib/userclient.py b/resources/lib/userclient.py index fa6d9a51..ca90ab1b 100644 --- a/resources/lib/userclient.py +++ b/resources/lib/userclient.py @@ -142,7 +142,7 @@ class UserClient(threading.Thread): return False # Set to windows property - state.CURRENT_USER_ID = userId or None + state.PLEX_USER_ID = userId or None state.PLEX_USERNAME = username # This is the token for the current PMS (might also be '') window('pms_token', value=self.currToken) @@ -274,7 +274,7 @@ class UserClient(threading.Thread): window('pms_server', clear=True) window('plex_machineIdentifier', clear=True) window('plex_servername', clear=True) - state.CURRENT_USER_ID = None + state.PLEX_USER_ID = None state.PLEX_USERNAME = None window('plex_restricteduser', clear=True) state.RESTRICTED_USER = False @@ -328,7 +328,7 @@ class UserClient(threading.Thread): # Successfully authenticated and loaded a user log.info("Successfully authenticated!") log.info("Current user: %s" % self.currUser) - log.info("Current userId: %s" % state.CURRENT_USER_ID) + log.info("Current userId: %s" % state.PLEX_USER_ID) self.retry = 0 state.SUSPEND_LIBRARY_THREAD = False window('plex_serverStatus', clear=True) diff --git a/resources/lib/websocket_client.py b/resources/lib/websocket_client.py index 93bed8f0..0ae40da8 100644 --- a/resources/lib/websocket_client.py +++ b/resources/lib/websocket_client.py @@ -221,7 +221,7 @@ class Alexa_Websocket(WebSocket): def getUri(self): self.plex_client_Id = window('plex_client_Id') uri = ('wss://pubsub.plex.tv/sub/websockets/%s/%s?X-Plex-Token=%s' - % (state.CURRENT_USER_ID, + % (state.PLEX_USER_ID, self.plex_client_Id, state.PLEX_TOKEN)) sslopt = {} log.debug("Uri: %s, sslopt: %s" % (uri, sslopt))