fix e migliorie updater

This commit is contained in:
marco
2020-01-21 22:43:54 +01:00
parent db96e414b5
commit 88fba710c1
3 changed files with 18 additions and 5 deletions
+4 -1
View File
@@ -64,6 +64,7 @@ def check(background=False):
localCommitSha = localCommitSha.replace('\n', '') # da testare localCommitSha = localCommitSha.replace('\n', '') # da testare
logger.info('Commit locale: ' + localCommitSha) logger.info('Commit locale: ' + localCommitSha)
updated = False updated = False
serviceChanged = False
pos = None pos = None
for n, c in enumerate(commits): for n, c in enumerate(commits):
@@ -105,6 +106,8 @@ def check(background=False):
logger.info(file["filename"]) logger.info(file["filename"])
if 'resources/language' in file["filename"]: if 'resources/language' in file["filename"]:
poFilesChanged = True poFilesChanged = True
if 'videolibrary_service.py' in file["filename"]:
serviceChanged = True
if file['status'] == 'modified' or file['status'] == 'added': if file['status'] == 'modified' or file['status'] == 'added':
if 'patch' in file: if 'patch' in file:
text = "" text = ""
@@ -173,7 +176,7 @@ def check(background=False):
else: else:
logger.info('Nessun nuovo aggiornamento') logger.info('Nessun nuovo aggiornamento')
return updated return updated, serviceChanged
def showSavedChangelog(): def showSavedChangelog():
+1 -1
View File
@@ -343,7 +343,7 @@ def check_quickfixes(item):
if not config.dev_mode(): if not config.dev_mode():
from platformcode import updater from platformcode import updater
if not updater.check(): if not updater.check()[0]:
platformtools.dialog_ok('Kodi on Demand', config.get_localized_string(70667)) platformtools.dialog_ok('Kodi on Demand', config.get_localized_string(70667))
else: else:
return False return False
+13 -3
View File
@@ -310,11 +310,18 @@ def monitor_update():
if not config.dev_mode(): if not config.dev_mode():
period = float(config.get_setting('addon_update_timer')) * 3600 period = float(config.get_setting('addon_update_timer')) * 3600
curTime = time.time() curTime = time.time()
lastCheck = float(config.get_setting("updater_last_check", "videolibrary", '0')) lastCheck = config.get_setting("updater_last_check", "videolibrary", '0')
if lastCheck:
lastCheck = float(lastCheck)
else:
lastCheck = 0
if curTime - lastCheck > period: if curTime - lastCheck > period:
updater.check(background=True) updated, needsReload = updater.check(background=True)
config.set_setting("updater_last_check", "videolibrary", str(curTime)) config.set_setting("updater_last_check", "videolibrary", str(curTime))
if needsReload:
xbmc.executescript(__file__)
exit(0)
# def get_channel_json(): # def get_channel_json():
# import urllib, os, xbmc # import urllib, os, xbmc
@@ -387,7 +394,10 @@ if __name__ == "__main__":
# Verificar quick-fixes al abrirse Kodi, y dejarlo corriendo como Thread # Verificar quick-fixes al abrirse Kodi, y dejarlo corriendo como Thread
if not config.dev_mode(): if not config.dev_mode():
updater.check() updated, needsReload = updater.check()
if needsReload:
xbmc.executescript(__file__)
exit(0)
# Copia Custom code a las carpetas de Alfa desde la zona de Userdata # Copia Custom code a las carpetas de Alfa desde la zona de Userdata
from platformcode import custom_code from platformcode import custom_code