From 962ce6da1e867fd400d1cb8123ebf74cd6c0ed49 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Sun, 2 Jul 2017 19:00:47 +0200 Subject: [PATCH] Switch to state variables --- resources/lib/connectmanager.py | 5 +++-- resources/lib/state.py | 2 ++ resources/lib/userclient.py | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/lib/connectmanager.py b/resources/lib/connectmanager.py index 5d8018e5..1503468d 100644 --- a/resources/lib/connectmanager.py +++ b/resources/lib/connectmanager.py @@ -12,6 +12,7 @@ from utils import window, settings, tryEncode, language as lang, dialog from PlexFunctions import GetMachineIdentifier, get_pms_settings, \ check_connection import variables as v +import state ############################################################################### @@ -100,8 +101,8 @@ class ConnectManager(object): dia = ServerConnect("script-plex-connect-server.xml", *XML_PATH) kwargs = { 'connect_manager': None, # self._connect - 'username': settings('username'), - 'user_image': window('PlexUserImage'), + 'username': state.PLEX_USERNAME, + 'user_image': state.PLEX_USER_IMAGE, # 'servers': state.get('Servers') or [], # 'emby_connect': False if user else True } diff --git a/resources/lib/state.py b/resources/lib/state.py index b364f749..73f8da15 100644 --- a/resources/lib/state.py +++ b/resources/lib/state.py @@ -29,6 +29,8 @@ INDICATE_MEDIA_VERSIONS = False AUTHENTICATED = False # plex.tv username PLEX_USERNAME = None +# plex.tv image for this user +PLEX_USER_IMAGE = None # Token for that user for plex.tv PLEX_TOKEN = None # Plex ID of that user (e.g. for plex.tv) as a STRING diff --git a/resources/lib/userclient.py b/resources/lib/userclient.py index d784014d..4fa79e8d 100644 --- a/resources/lib/userclient.py +++ b/resources/lib/userclient.py @@ -111,6 +111,7 @@ class UserClient(threading.Thread): url = get_user_artwork_url(self.currUser) if url: window('PlexUserImage', value=url) + state.PLEX_USER_IMAGE = url # Set resume point max # url = "{server}/emby/System/Configuration?format=json" # result = doUtils.downloadUrl(url) @@ -282,6 +283,7 @@ class UserClient(threading.Thread): window('plex_servername', clear=True) state.PLEX_USER_ID = None state.PLEX_USERNAME = None + state.PLEX_USER_IMAGE = None window('plex_restricteduser', clear=True) state.RESTRICTED_USER = False