mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16: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:
|
if update:
|
||||||
self.settings['last_progress'] = datetime.today()
|
self.settings['last_progress'] = datetime.today()
|
||||||
|
|
||||||
|
if window('emby.restart.bool'):
|
||||||
|
window('emby.restart', clear=True)
|
||||||
|
|
||||||
|
raise Exception('RestartService')
|
||||||
|
|
||||||
if self.waitForAbort(1):
|
if self.waitForAbort(1):
|
||||||
break
|
break
|
||||||
|
|
||||||
window('emby_should_stop.bool', True)
|
|
||||||
self.shutdown()
|
self.shutdown()
|
||||||
|
|
||||||
def start_default(self):
|
def start_default(self):
|
||||||
|
@ -400,8 +404,12 @@ class Service(xbmc.Monitor):
|
||||||
Views().get_views()
|
Views().get_views()
|
||||||
|
|
||||||
elif method == 'CheckUpdate':
|
elif method == 'CheckUpdate':
|
||||||
|
|
||||||
if not self.check_update():
|
if not self.check_update():
|
||||||
dialog("notification", heading="{emby}", message=_(21341), icon="{emby}", sound=False)
|
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):
|
def onSettingsChanged(self):
|
||||||
|
|
||||||
|
@ -448,6 +456,7 @@ class Service(xbmc.Monitor):
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
|
|
||||||
LOG.warn("---<[ EXITING ]")
|
LOG.warn("---<[ EXITING ]")
|
||||||
|
window('emby_should_stop.bool', True)
|
||||||
|
|
||||||
properties = [ # TODO: review
|
properties = [ # TODO: review
|
||||||
"emby_state", "emby_serverStatus",
|
"emby_state", "emby_serverStatus",
|
||||||
|
|
|
@ -38,7 +38,7 @@ def window(key, value=None, clear=False, window_id=10000):
|
||||||
if clear:
|
if clear:
|
||||||
|
|
||||||
LOG.debug("--[ window clear: %s ]", key)
|
LOG.debug("--[ window clear: %s ]", key)
|
||||||
window.clearProperty(key)
|
window.clearProperty(key.replace('.json', "").replace('.bool', ""))
|
||||||
elif value is not None:
|
elif value is not None:
|
||||||
if key.endswith('.json'):
|
if key.endswith('.json'):
|
||||||
|
|
||||||
|
|
34
service.py
34
service.py
|
@ -45,21 +45,33 @@ if __name__ == "__main__":
|
||||||
LOG.warn("-->[ service ]")
|
LOG.warn("-->[ service ]")
|
||||||
LOG.warn("Delay startup by %s seconds.", DELAY)
|
LOG.warn("Delay startup by %s seconds.", DELAY)
|
||||||
|
|
||||||
try:
|
while True:
|
||||||
session = Service()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if DELAY and xbmc.Monitor().waitForAbort(DELAY):
|
session = Service()
|
||||||
raise Exception("Aborted during startup delay")
|
|
||||||
|
|
||||||
session.service()
|
try:
|
||||||
except Exception as error: # TODO, build exceptions
|
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)
|
LOG.exception(error)
|
||||||
session.shutdown()
|
|
||||||
|
|
||||||
except Exception as error:
|
break
|
||||||
''' Issue initializing the service.
|
|
||||||
'''
|
|
||||||
LOG.exception(error)
|
|
||||||
|
|
||||||
LOG.warn("--<[ service ]")
|
LOG.warn("--<[ service ]")
|
||||||
|
|
Loading…
Reference in a new issue