diff --git a/resources/lib/plex.py b/resources/lib/plex.py index 15a89fa6..c49fc5e8 100644 --- a/resources/lib/plex.py +++ b/resources/lib/plex.py @@ -282,7 +282,9 @@ def init(): while retry: retry = False if not plexapp.ACCOUNT.authToken: - token = authorize() + from .windows import background + with background.BackgroundContext(function=authorize) as d: + token = d.result if not token: LOG.info('FAILED TO AUTHORIZE') @@ -326,12 +328,6 @@ def requirePlexPass(): def authorize(): - from .windows import background - with background.BackgroundContext(function=_authorize) as win: - return win.result - - -def _authorize(): from .windows import signin, background background.setSplash(False) diff --git a/resources/lib/windows/background.py b/resources/lib/windows/background.py index 869d46a4..1d92e6a7 100644 --- a/resources/lib/windows/background.py +++ b/resources/lib/windows/background.py @@ -49,9 +49,9 @@ class BackgroundContext(object): Context Manager to open a Plex background window - in the background. This will e.g. ensure that you can capture key-presses Use like this: - with BackgroundContext(function) as win: + with BackgroundContext(function) as d: - result = win.result + result = d.result """ def __init__(self, function=None): self.window = None