mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Restart service upon check for updates
To reload the new objects module.
This commit is contained in:
parent
c76f19e42d
commit
1174c685e9
3 changed files with 34 additions and 13 deletions
|
@ -115,10 +115,14 @@ class Service(xbmc.Monitor):
|
|||
if update:
|
||||
self.settings['last_progress'] = datetime.today()
|
||||
|
||||
if window('emby.restart.bool'):
|
||||
window('emby.restart', clear=True)
|
||||
|
||||
raise Exception('RestartService')
|
||||
|
||||
if self.waitForAbort(1):
|
||||
break
|
||||
|
||||
window('emby_should_stop.bool', True)
|
||||
self.shutdown()
|
||||
|
||||
def start_default(self):
|
||||
|
@ -400,8 +404,12 @@ class Service(xbmc.Monitor):
|
|||
Views().get_views()
|
||||
|
||||
elif method == 'CheckUpdate':
|
||||
|
||||
if not self.check_update():
|
||||
dialog("notification", heading="{emby}", message=_(21341), icon="{emby}", sound=False)
|
||||
else:
|
||||
dialog("notification", heading="{emby}", message=_(33181), icon="{emby}", sound=False)
|
||||
window('emby.restart.bool', True)
|
||||
|
||||
def onSettingsChanged(self):
|
||||
|
||||
|
@ -448,6 +456,7 @@ class Service(xbmc.Monitor):
|
|||
def shutdown(self):
|
||||
|
||||
LOG.warn("---<[ EXITING ]")
|
||||
window('emby_should_stop.bool', True)
|
||||
|
||||
properties = [ # TODO: review
|
||||
"emby_state", "emby_serverStatus",
|
||||
|
|
|
@ -38,7 +38,7 @@ def window(key, value=None, clear=False, window_id=10000):
|
|||
if clear:
|
||||
|
||||
LOG.debug("--[ window clear: %s ]", key)
|
||||
window.clearProperty(key)
|
||||
window.clearProperty(key.replace('.json', "").replace('.bool', ""))
|
||||
elif value is not None:
|
||||
if key.endswith('.json'):
|
||||
|
||||
|
|
34
service.py
34
service.py
|
@ -45,21 +45,33 @@ if __name__ == "__main__":
|
|||
LOG.warn("-->[ service ]")
|
||||
LOG.warn("Delay startup by %s seconds.", DELAY)
|
||||
|
||||
try:
|
||||
session = Service()
|
||||
while True:
|
||||
|
||||
try:
|
||||
if DELAY and xbmc.Monitor().waitForAbort(DELAY):
|
||||
raise Exception("Aborted during startup delay")
|
||||
session = Service()
|
||||
|
||||
session.service()
|
||||
except Exception as error: # TODO, build exceptions
|
||||
try:
|
||||
if DELAY and xbmc.Monitor().waitForAbort(DELAY):
|
||||
raise Exception("Aborted during startup delay")
|
||||
|
||||
session.service()
|
||||
|
||||
break
|
||||
except Exception as error: # TODO, build exceptions
|
||||
|
||||
LOG.exception(error)
|
||||
session.shutdown()
|
||||
|
||||
if 'RestartService' not in error:
|
||||
LOG.warn("--<<[ service ]")
|
||||
|
||||
break
|
||||
|
||||
except Exception as error:
|
||||
''' Issue initializing the service.
|
||||
'''
|
||||
LOG.exception(error)
|
||||
session.shutdown()
|
||||
|
||||
except Exception as error:
|
||||
''' Issue initializing the service.
|
||||
'''
|
||||
LOG.exception(error)
|
||||
break
|
||||
|
||||
LOG.warn("--<[ service ]")
|
||||
|
|
Loading…
Reference in a new issue