From a3d76f0601b065f4d9e99cc4d14799599318385f Mon Sep 17 00:00:00 2001 From: RemiRigal Date: Tue, 24 May 2022 17:05:18 +0200 Subject: [PATCH] Fix client identifier caching when requested too soon (#35) --- plex_auto_languages/alerts/playing.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plex_auto_languages/alerts/playing.py b/plex_auto_languages/alerts/playing.py index 8bd1be1..f20ebbd 100644 --- a/plex_auto_languages/alerts/playing.py +++ b/plex_auto_languages/alerts/playing.py @@ -36,10 +36,12 @@ def session_state(self): def process(self, plex: PlexServer): # Get User id and user's Plex instance if self.client_identifier not in plex.cache.user_clients: - plex.cache.user_clients[self.client_identifier] = plex.get_user_from_client_identifier(self.client_identifier) - user_id, username = plex.cache.user_clients[self.client_identifier] - if user_id is None: - return + user_id, username = plex.get_user_from_client_identifier(self.client_identifier) + if user_id is None: + return + plex.cache.user_clients[self.client_identifier] = (user_id, username) + else: + user_id, username = plex.cache.user_clients[self.client_identifier] user_plex = plex.get_plex_instance_of_user(user_id) if user_plex is None: return