Improvements to PMS on/offline messages
This commit is contained in:
parent
43d4f69e5c
commit
373d9656ae
3 changed files with 21 additions and 34 deletions
|
@ -190,19 +190,6 @@ class UserClient(threading.Thread):
|
||||||
settings('username', value=username)
|
settings('username', value=username)
|
||||||
settings('userid', value=userId)
|
settings('userid', value=userId)
|
||||||
settings('accessToken', value=usertoken)
|
settings('accessToken', value=usertoken)
|
||||||
|
|
||||||
dialog = xbmcgui.Dialog()
|
|
||||||
if settings('connectMsg') == "true":
|
|
||||||
if username:
|
|
||||||
dialog.notification(
|
|
||||||
heading=addonName,
|
|
||||||
message="Welcome " + username,
|
|
||||||
icon="special://home/addons/plugin.video.plexkodiconnect/icon.png")
|
|
||||||
else:
|
|
||||||
dialog.notification(
|
|
||||||
heading=addonName,
|
|
||||||
message="Welcome",
|
|
||||||
icon="special://home/addons/plugin.video.plexkodiconnect/icon.png")
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def authenticate(self):
|
def authenticate(self):
|
||||||
|
|
|
@ -130,7 +130,6 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<category label="39073"><!-- Appearance Tweaks -->
|
<category label="39073"><!-- Appearance Tweaks -->
|
||||||
<setting id="connectMsg" type="bool" label="30249" default="true" />
|
|
||||||
<setting type="lsep" label="39074" /><!-- TV Shows -->
|
<setting type="lsep" label="39074" /><!-- TV Shows -->
|
||||||
<setting id="OnDeckTVextended" type="bool" label="39058" default="true" /><!-- Extend Plex TV Series "On Deck" view to all shows -->
|
<setting id="OnDeckTVextended" type="bool" label="39058" default="true" /><!-- Extend Plex TV Series "On Deck" view to all shows -->
|
||||||
<setting id="OnDeckTvAppendShow" type="bool" label="39047" default="false" /><!--On Deck view: Append show title to episode-->
|
<setting id="OnDeckTvAppendShow" type="bool" label="39047" default="false" /><!--On Deck view: Append show title to episode-->
|
||||||
|
|
41
service.py
41
service.py
|
@ -58,7 +58,6 @@ addonName = 'PlexKodiConnect'
|
||||||
|
|
||||||
class Service():
|
class Service():
|
||||||
|
|
||||||
welcome_msg = True
|
|
||||||
server_online = True
|
server_online = True
|
||||||
warn_auth = True
|
warn_auth = True
|
||||||
|
|
||||||
|
@ -133,14 +132,13 @@ class Service():
|
||||||
# Queue for background sync
|
# Queue for background sync
|
||||||
queue = Queue.Queue()
|
queue = Queue.Queue()
|
||||||
|
|
||||||
connectMsg = True if settings('connectMsg') == 'true' else False
|
|
||||||
|
|
||||||
# Initialize important threads
|
# Initialize important threads
|
||||||
user = userclient.UserClient()
|
user = userclient.UserClient()
|
||||||
ws = wsc.WebSocket(queue)
|
ws = wsc.WebSocket(queue)
|
||||||
library = librarysync.LibrarySync(queue)
|
library = librarysync.LibrarySync(queue)
|
||||||
plx = PlexAPI.PlexAPI()
|
plx = PlexAPI.PlexAPI()
|
||||||
|
|
||||||
|
welcome_msg = True
|
||||||
counter = 0
|
counter = 0
|
||||||
while not monitor.abortRequested():
|
while not monitor.abortRequested():
|
||||||
|
|
||||||
|
@ -163,9 +161,9 @@ class Service():
|
||||||
if not self.kodimonitor_running:
|
if not self.kodimonitor_running:
|
||||||
# Start up events
|
# Start up events
|
||||||
self.warn_auth = True
|
self.warn_auth = True
|
||||||
if connectMsg and self.welcome_msg:
|
if welcome_msg is True:
|
||||||
# Reset authentication warnings
|
# Reset authentication warnings
|
||||||
self.welcome_msg = False
|
welcome_msg = False
|
||||||
xbmcgui.Dialog().notification(
|
xbmcgui.Dialog().notification(
|
||||||
heading=addonName,
|
heading=addonName,
|
||||||
message="%s %s" % (lang(33000), user.currUser),
|
message="%s %s" % (lang(33000), user.currUser),
|
||||||
|
@ -226,13 +224,14 @@ class Service():
|
||||||
# Suspend threads
|
# Suspend threads
|
||||||
window('suspend_LibraryThread', value='true')
|
window('suspend_LibraryThread', value='true')
|
||||||
log.error("Plex Media Server went offline")
|
log.error("Plex Media Server went offline")
|
||||||
xbmcgui.Dialog().notification(
|
if settings('show_pms_offline') == 'true':
|
||||||
heading=lang(33001),
|
xbmcgui.Dialog().notification(
|
||||||
message="%s %s"
|
heading=lang(33001),
|
||||||
% (addonName, lang(33002)),
|
message="%s %s"
|
||||||
icon="special://home/addons/plugin.video."
|
% (addonName, lang(33002)),
|
||||||
"plexkodiconnect/icon.png",
|
icon="special://home/addons/plugin.video."
|
||||||
sound=False)
|
"plexkodiconnect/icon.png",
|
||||||
|
sound=False)
|
||||||
counter += 1
|
counter += 1
|
||||||
# Periodically check if the IP changed, e.g. per minute
|
# Periodically check if the IP changed, e.g. per minute
|
||||||
if counter > 20:
|
if counter > 20:
|
||||||
|
@ -250,15 +249,17 @@ class Service():
|
||||||
if monitor.waitForAbort(5):
|
if monitor.waitForAbort(5):
|
||||||
# Abort was requested while waiting.
|
# Abort was requested while waiting.
|
||||||
break
|
break
|
||||||
# Alert the user that server is online.
|
|
||||||
xbmcgui.Dialog().notification(
|
|
||||||
heading=addonName,
|
|
||||||
message=lang(33003),
|
|
||||||
icon="special://home/addons/plugin.video."
|
|
||||||
"plexkodiconnect/icon.png",
|
|
||||||
time=5000,
|
|
||||||
sound=False)
|
|
||||||
self.server_online = True
|
self.server_online = True
|
||||||
|
# Alert the user that server is online.
|
||||||
|
if (welcome_msg is False and
|
||||||
|
settings('show_pms_offline') == 'true'):
|
||||||
|
xbmcgui.Dialog().notification(
|
||||||
|
heading=addonName,
|
||||||
|
message=lang(33003),
|
||||||
|
icon="special://home/addons/plugin.video."
|
||||||
|
"plexkodiconnect/icon.png",
|
||||||
|
time=5000,
|
||||||
|
sound=False)
|
||||||
log.info("Server %s is online and ready." % server)
|
log.info("Server %s is online and ready." % server)
|
||||||
window('plex_online', value="true")
|
window('plex_online', value="true")
|
||||||
if window('plex_authenticated') == 'true':
|
if window('plex_authenticated') == 'true':
|
||||||
|
|
Loading…
Reference in a new issue