diff --git a/resources/lib/plexbmchelper/subscribers.py b/resources/lib/plexbmchelper/subscribers.py index aa3bb8ab..2db7e765 100644 --- a/resources/lib/plexbmchelper/subscribers.py +++ b/resources/lib/plexbmchelper/subscribers.py @@ -388,8 +388,8 @@ class SubscriptionMgr(object): xargs['X-Plex-Token'] = state.PLEX_TRANSIENT_TOKEN elif playqueue.plex_transient_token: xargs['X-Plex-Token'] = playqueue.plex_transient_token - elif state.PLEX_TOKEN: - xargs['X-Plex-Token'] = state.PLEX_TOKEN + elif state.PMS_TOKEN: + xargs['X-Plex-Token'] = state.PMS_TOKEN url = '%s://%s:%s/:/timeline' % (serv.get('protocol', 'http'), serv.get('server', 'localhost'), serv.get('port', '32400')) diff --git a/resources/lib/state.py b/resources/lib/state.py index f982b67c..31085897 100644 --- a/resources/lib/state.py +++ b/resources/lib/state.py @@ -75,6 +75,9 @@ AUTHENTICATED = False PLEX_USERNAME = None # Token for that user for plex.tv PLEX_TOKEN = None +# Plex token for the active PMS for the active user +# (might be diffent to PLEX_TOKEN) +PMS_TOKEN = None # Plex ID of that user (e.g. for plex.tv) as a STRING PLEX_USER_ID = None # Token passed along, e.g. if playback initiated by Plex Companion. Might be diff --git a/resources/lib/userclient.py b/resources/lib/userclient.py index 47fe4e3f..8aaec05f 100644 --- a/resources/lib/userclient.py +++ b/resources/lib/userclient.py @@ -141,7 +141,8 @@ class UserClient(Thread): 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) + window('pms_token', value=usertoken) + state.PMS_TOKEN = usertoken # This is the token for plex.tv for the current user # Is only '' if user is not signed in to plex.tv window('plex_token', value=settings('plexToken')) @@ -264,6 +265,7 @@ class UserClient(Thread): window('pms_token', clear=True) state.PLEX_TOKEN = None state.PLEX_TRANSIENT_TOKEN = None + state.PMS_TOKEN = None window('plex_token', clear=True) window('pms_server', clear=True) window('plex_machineIdentifier', clear=True)