From f3e6ab32f68cea7c5ce2ae046ca3d1fa48adeca6 Mon Sep 17 00:00:00 2001 From: Phin <59180111+phin05@users.noreply.github.com> Date: Thu, 15 Mar 2018 01:38:42 +0530 Subject: [PATCH] Update discordRichPresencePlex.py --- discordRichPresencePlex.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/discordRichPresencePlex.py b/discordRichPresencePlex.py index 108940a..9cbdbb4 100644 --- a/discordRichPresencePlex.py +++ b/discordRichPresencePlex.py @@ -154,17 +154,21 @@ class discordRichPresencePlex(discordRichPresence): if (len(plexServerSessions) < 1): printExtraLog("Empty session list, ignoring", "red") return - else: - for session in plexServerSessions: - printExtraLog(str(session) + ", Session Key: " + colourText(session.sessionKey, "yellow") + ", Users: " + colourText(session.usernames, "yellow").replace("'", "\"")) - if (session.sessionKey == sessionKey): - printExtraLog("Found Session", "green") - if (session.usernames[0].lower() == self.listenForUser.lower()): - printExtraLog("Username \"" + session.usernames[0].lower() + "\" matches \"" + self.listenForUser.lower() + "\", continuing", "green") - break - else: - printExtraLog("Username \"" + session.usernames[0].lower() + "\" doesn't match \"" + self.listenForUser.lower() + "\", ignoring", "red") - return + for session in plexServerSessions: + printExtraLog(str(session) + ", Session Key: " + colourText(session.sessionKey, "yellow") + ", Users: " + colourText(session.usernames, "yellow").replace("'", "\"")) + sessionFound = False + if (session.sessionKey == sessionKey): + sessionFound = True + printExtraLog("Session found", "green") + if (session.usernames[0].lower() == self.listenForUser.lower()): + printExtraLog("Username \"" + session.usernames[0].lower() + "\" matches \"" + self.listenForUser.lower() + "\", continuing", "green") + break + else: + printExtraLog("Username \"" + session.usernames[0].lower() + "\" doesn't match \"" + self.listenForUser.lower() + "\", ignoring", "red") + return + if (not sessionFound): + printExtraLog("No matching session found", "red") + return if (self.stopTimer2): self.stopTimer2.cancel() self.stopTimer2 = threading.Timer(self.stopTimer2Interval, self.stopOnNoUpdate)