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('userid', value=userId)
|
||||
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
|
||||
|
||||
def authenticate(self):
|
||||
|
|
|
@ -130,7 +130,6 @@
|
|||
-->
|
||||
|
||||
<category label="39073"><!-- Appearance Tweaks -->
|
||||
<setting id="connectMsg" type="bool" label="30249" default="true" />
|
||||
<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="OnDeckTvAppendShow" type="bool" label="39047" default="false" /><!--On Deck view: Append show title to episode-->
|
||||
|
|
13
service.py
13
service.py
|
@ -58,7 +58,6 @@ addonName = 'PlexKodiConnect'
|
|||
|
||||
class Service():
|
||||
|
||||
welcome_msg = True
|
||||
server_online = True
|
||||
warn_auth = True
|
||||
|
||||
|
@ -133,14 +132,13 @@ class Service():
|
|||
# Queue for background sync
|
||||
queue = Queue.Queue()
|
||||
|
||||
connectMsg = True if settings('connectMsg') == 'true' else False
|
||||
|
||||
# Initialize important threads
|
||||
user = userclient.UserClient()
|
||||
ws = wsc.WebSocket(queue)
|
||||
library = librarysync.LibrarySync(queue)
|
||||
plx = PlexAPI.PlexAPI()
|
||||
|
||||
welcome_msg = True
|
||||
counter = 0
|
||||
while not monitor.abortRequested():
|
||||
|
||||
|
@ -163,9 +161,9 @@ class Service():
|
|||
if not self.kodimonitor_running:
|
||||
# Start up events
|
||||
self.warn_auth = True
|
||||
if connectMsg and self.welcome_msg:
|
||||
if welcome_msg is True:
|
||||
# Reset authentication warnings
|
||||
self.welcome_msg = False
|
||||
welcome_msg = False
|
||||
xbmcgui.Dialog().notification(
|
||||
heading=addonName,
|
||||
message="%s %s" % (lang(33000), user.currUser),
|
||||
|
@ -226,6 +224,7 @@ class Service():
|
|||
# Suspend threads
|
||||
window('suspend_LibraryThread', value='true')
|
||||
log.error("Plex Media Server went offline")
|
||||
if settings('show_pms_offline') == 'true':
|
||||
xbmcgui.Dialog().notification(
|
||||
heading=lang(33001),
|
||||
message="%s %s"
|
||||
|
@ -250,7 +249,10 @@ class Service():
|
|||
if monitor.waitForAbort(5):
|
||||
# Abort was requested while waiting.
|
||||
break
|
||||
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),
|
||||
|
@ -258,7 +260,6 @@ class Service():
|
|||
"plexkodiconnect/icon.png",
|
||||
time=5000,
|
||||
sound=False)
|
||||
self.server_online = True
|
||||
log.info("Server %s is online and ready." % server)
|
||||
window('plex_online', value="true")
|
||||
if window('plex_authenticated') == 'true':
|
||||
|
|
Loading…
Reference in a new issue