Rename Plex user id

This commit is contained in:
tomkat83 2017-05-17 16:15:16 +02:00
parent 9ae68b66f7
commit f7da47f2d5
4 changed files with 8 additions and 8 deletions

View file

@ -1352,13 +1352,13 @@ class LibrarySync(Thread):
# Hence must be us (since several users require plex.tv # Hence must be us (since several users require plex.tv
# token for PKC) # token for PKC)
pass pass
elif not (currSess['userId'] == state.CURRENT_USER_ID elif not (currSess['userId'] == state.PLEX_USER_ID
or or
currSess['username'] == state.PLEX_USERNAME): currSess['username'] == state.PLEX_USERNAME):
log.debug('Our username %s, userid %s did not match ' log.debug('Our username %s, userid %s did not match '
'the session username %s with userid %s' 'the session username %s with userid %s'
% (state.PLEX_USERNAME, % (state.PLEX_USERNAME,
state.CURRENT_USER_ID, state.PLEX_USER_ID,
currSess['username'], currSess['username'],
currSess['userId'])) currSess['userId']))
continue continue
@ -1397,7 +1397,7 @@ class LibrarySync(Thread):
}) })
log.debug('Update playstate for user %s with id %s: %s' log.debug('Update playstate for user %s with id %s: %s'
% (state.PLEX_USERNAME, % (state.PLEX_USERNAME,
state.CURRENT_USER_ID, state.PLEX_USER_ID,
items[-1])) items[-1]))
# Now tell Kodi where we are # Now tell Kodi where we are
for item in items: for item in items:

View file

@ -28,4 +28,4 @@ AUTHENTICATED = False
PLEX_TOKEN = None PLEX_TOKEN = None
# Plex ID of the current user (e.g. for plex.tv) as a STRING # Plex ID of the current user (e.g. for plex.tv) as a STRING
PLEX_USERNAME = None PLEX_USERNAME = None
CURRENT_USER_ID = None PLEX_USER_ID = None

View file

@ -142,7 +142,7 @@ class UserClient(threading.Thread):
return False return False
# Set to windows property # Set to windows property
state.CURRENT_USER_ID = userId or None state.PLEX_USER_ID = userId or None
state.PLEX_USERNAME = username state.PLEX_USERNAME = username
# This is the token for the current PMS (might also be '') # This is the token for the current PMS (might also be '')
window('pms_token', value=self.currToken) window('pms_token', value=self.currToken)
@ -274,7 +274,7 @@ class UserClient(threading.Thread):
window('pms_server', clear=True) window('pms_server', clear=True)
window('plex_machineIdentifier', clear=True) window('plex_machineIdentifier', clear=True)
window('plex_servername', clear=True) window('plex_servername', clear=True)
state.CURRENT_USER_ID = None state.PLEX_USER_ID = None
state.PLEX_USERNAME = None state.PLEX_USERNAME = None
window('plex_restricteduser', clear=True) window('plex_restricteduser', clear=True)
state.RESTRICTED_USER = False state.RESTRICTED_USER = False
@ -328,7 +328,7 @@ class UserClient(threading.Thread):
# Successfully authenticated and loaded a user # Successfully authenticated and loaded a user
log.info("Successfully authenticated!") log.info("Successfully authenticated!")
log.info("Current user: %s" % self.currUser) 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 self.retry = 0
state.SUSPEND_LIBRARY_THREAD = False state.SUSPEND_LIBRARY_THREAD = False
window('plex_serverStatus', clear=True) window('plex_serverStatus', clear=True)

View file

@ -221,7 +221,7 @@ class Alexa_Websocket(WebSocket):
def getUri(self): def getUri(self):
self.plex_client_Id = window('plex_client_Id') self.plex_client_Id = window('plex_client_Id')
uri = ('wss://pubsub.plex.tv/sub/websockets/%s/%s?X-Plex-Token=%s' 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)) self.plex_client_Id, state.PLEX_TOKEN))
sslopt = {} sslopt = {}
log.debug("Uri: %s, sslopt: %s" % (uri, sslopt)) log.debug("Uri: %s, sslopt: %s" % (uri, sslopt))