mirror of
https://github.com/phin05/discord-rich-presence-plex
synced 2024-11-22 01:23:02 +00:00
Update discordRichPresencePlex.py
This commit is contained in:
parent
d095d82ed6
commit
d4234733f8
1 changed files with 5 additions and 2 deletions
|
@ -12,7 +12,7 @@ import time
|
||||||
|
|
||||||
class plexConfig:
|
class plexConfig:
|
||||||
|
|
||||||
extraLogging = True
|
extraLogging = False
|
||||||
|
|
||||||
def __init__(self, serverName = "", username = "", password = "", token = "", listenForUser = ""):
|
def __init__(self, serverName = "", username = "", password = "", token = "", listenForUser = ""):
|
||||||
self.serverName = serverName
|
self.serverName = serverName
|
||||||
|
@ -123,6 +123,7 @@ class discordRichPresencePlex(discordRichPresence):
|
||||||
self.log("Listening for PlaySessionStateNotification alerts from user \"" + self.plexConfig.listenForUser + "\"")
|
self.log("Listening for PlaySessionStateNotification alerts from user \"" + self.plexConfig.listenForUser + "\"")
|
||||||
if (self.checkConnectionTimer):
|
if (self.checkConnectionTimer):
|
||||||
self.checkConnectionTimer.cancel()
|
self.checkConnectionTimer.cancel()
|
||||||
|
self.checkConnectionTimer = None
|
||||||
self.checkConnectionTimer = threading.Timer(self.checkConnectionTimerInterval, self.checkConnection)
|
self.checkConnectionTimer = threading.Timer(self.checkConnectionTimerInterval, self.checkConnection)
|
||||||
self.checkConnectionTimer.start()
|
self.checkConnectionTimer.start()
|
||||||
break
|
break
|
||||||
|
@ -142,8 +143,10 @@ class discordRichPresencePlex(discordRichPresence):
|
||||||
except:
|
except:
|
||||||
if (self.stopTimer):
|
if (self.stopTimer):
|
||||||
self.stopTimer.cancel()
|
self.stopTimer.cancel()
|
||||||
|
self.stopTimer = None
|
||||||
if (self.stopTimer2):
|
if (self.stopTimer2):
|
||||||
self.stopTimer2.cancel()
|
self.stopTimer2.cancel()
|
||||||
|
self.stopTimer2 = None
|
||||||
if (self.running):
|
if (self.running):
|
||||||
self.stop()
|
self.stop()
|
||||||
self.log("Connection to Plex lost, reconnecting")
|
self.log("Connection to Plex lost, reconnecting")
|
||||||
|
@ -153,7 +156,7 @@ class discordRichPresencePlex(discordRichPresence):
|
||||||
prefix = "[" + self.plexConfig.serverName + "/" + self.instanceID + "] "
|
prefix = "[" + self.plexConfig.serverName + "/" + self.instanceID + "] "
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
if (extra):
|
if (extra):
|
||||||
if (plexConfig.extraLogging):
|
if (self.plexConfig.extraLogging):
|
||||||
print(prefix + colourText(str(text), colour))
|
print(prefix + colourText(str(text), colour))
|
||||||
else:
|
else:
|
||||||
print(prefix + colourText(str(text), colour))
|
print(prefix + colourText(str(text), colour))
|
||||||
|
|
Loading…
Reference in a new issue