Also show a pop-up if PKC searches for changed PMS address on PKC startup

This commit is contained in:
croneter 2019-02-02 13:24:31 +01:00
parent 65fe1ed399
commit b858373aeb

View file

@ -220,7 +220,7 @@ class InitialSetup(object):
verifySSL=verifySSL) verifySSL=verifySSL)
return chk return chk
def pick_pms(self, showDialog=False): def pick_pms(self, showDialog=False, inform_of_search=False):
""" """
Searches for PMS in local Lan and optionally (if self.plex_token set) Searches for PMS in local Lan and optionally (if self.plex_token set)
also on plex.tv also on plex.tv
@ -260,10 +260,10 @@ class InitialSetup(object):
if showDialog is True: if showDialog is True:
server = self._user_pick_pms() server = self._user_pick_pms()
else: else:
server = self._auto_pick_pms() server = self._auto_pick_pms(show_dialog=inform_of_search)
return server return server
def _auto_pick_pms(self): def _auto_pick_pms(self, show_dialog=False):
""" """
Will try to pick PMS based on machineIdentifier saved in file settings Will try to pick PMS based on machineIdentifier saved in file settings
but only once but only once
@ -272,6 +272,14 @@ class InitialSetup(object):
""" """
https_updated = False https_updated = False
server = None server = None
if show_dialog:
# Searching for PMS
utils.dialog('notification',
heading='{plex}',
message=utils.lang(30001),
icon='{plex}',
time=60000)
try:
while True: while True:
if https_updated is False: if https_updated is False:
serverlist = PF.discover_pms(self.plex_token) serverlist = PF.discover_pms(self.plex_token)
@ -301,6 +309,10 @@ class InitialSetup(object):
LOG.info('We found a server to automatically connect to: %s', LOG.info('We found a server to automatically connect to: %s',
server['name']) server['name'])
return server return server
finally:
if show_dialog:
executebuiltin("Dialog.Close(all, true)")
def _user_pick_pms(self): def _user_pick_pms(self):
""" """
@ -553,7 +565,7 @@ class InitialSetup(object):
if not self.plex_token and app.ACCOUNT.myplexlogin: if not self.plex_token and app.ACCOUNT.myplexlogin:
self.plex_tv_sign_in() self.plex_tv_sign_in()
server = self.pick_pms() server = self.pick_pms(inform_of_search=True)
if server is not None: if server is not None:
# Write our chosen server to Kodi settings file # Write our chosen server to Kodi settings file
self.save_pms_settings(server['baseURL'], server['token']) self.save_pms_settings(server['baseURL'], server['token'])