updater: periodo personalizzabile

This commit is contained in:
marco
2020-01-04 14:07:07 +01:00
parent 18ee76903e
commit b2b7b1fedf
6 changed files with 37 additions and 28 deletions

View File

@@ -166,21 +166,25 @@ def check():
return updated
def timer():
def timer(force=False):
import time
curTime = time.time()
file = "special://profile/addon_data/plugin.video.kod/updater_last_check.txt"
period = 10
checked = False
try:
with open(xbmc.translatePath(file), 'r') as fileC:
lastCheck = float(fileC.read())
if curTime - lastCheck > period:
check()
checked = True
except:
period = float(addon.getSetting('addon_update_timer')) * 3600
if force:
check()
checked = True
else:
checked = False
try:
with open(xbmc.translatePath(file), 'r') as fileC:
lastCheck = float(fileC.read())
if curTime - lastCheck > period:
check()
checked = True
except:
check()
checked = True
if checked:
with open(xbmc.translatePath(file), 'w') as fileC:
fileC.write(str(curTime))

View File

@@ -5035,7 +5035,7 @@ msgid "To avoid waiting too long when a server does not respond:"
msgstr ""
msgctxt "#70579"
msgid "Settings of urgent updates of KOD modules (Quick Fixes):"
msgid "Settings of KoD updates:"
msgstr ""
msgctxt "#70580"
@@ -5043,11 +5043,11 @@ msgid "Timeout (maximum waiting time)"
msgstr ""
msgctxt "#70581"
msgid "Check for updates when kodi starts"
msgid "Check for updates"
msgstr ""
msgctxt "#70582"
msgid "Do you want to see messages about the updates?"
msgid "Do you want to be notified?"
msgstr ""
msgctxt "#70583"
@@ -5765,4 +5765,7 @@ msgstr ""
msgctxt "#707415"
msgid "You have not selected any choice, the cloudflare DNS will be used."
msgstr ""
# end DNS
msgctxt "#707416"
msgid "how often you want to check for updates? (hours)"
msgstr ""

View File

@@ -5034,20 +5034,20 @@ msgid "To avoid waiting too long when a server does not respond:"
msgstr "Per evitare di aspettare troppo a lungo quando un server non risponde:"
msgctxt "#70579"
msgid "Settings of urgent updates of KOD modules (Quick Fixes):"
msgstr "Impostazioni per gli aggiornamenti urgenti dei moduli di KOD (Quick Fixes)"
msgid "Settings of KoD updates:"
msgstr "Impostazioni degli aggiornamenti di KoD"
msgctxt "#70580"
msgid "Timeout (maximum waiting time)"
msgstr "Timeout (tempo massimo da aspettare)"
msgctxt "#70581"
msgid "Check for updates when kodi starts"
msgstr "Controlla gli aggiornamenti all'apertura di kodi"
msgid "Check for updates"
msgstr "Controlla gli aggiornamenti"
msgctxt "#70582"
msgid "Do you want to see messages about the updates?"
msgstr "Voi ricevere dei messaggi per quanto riguarda gli aggiornamenti?"
msgid "Do you want to be notified?"
msgstr "Voi essere notificato?"
msgctxt "#70583"
msgid "Management of updates of other addons related to KOD:"
@@ -5770,4 +5770,6 @@ msgctxt "#707415"
msgid "You have not selected any choice, the cloudflare DNS will be used."
msgstr "Non hai selezionato nessuna scelta!\nVerranno utilizzati i DNS di cloudflare."
# end DNS
msgctxt "#707416"
msgid "how often you want to check for updates? (hours)"
msgstr "Ogni quanto vuoi che vengano controllati? (ore)"

View File

@@ -170,6 +170,7 @@
<setting label="70579" type="lsep"/>
<setting id="addon_update_enabled" type="bool" label="70581" default="true"/>
<setting id="addon_update_message" type="bool" label="70582" default="true"/>
<setting id="addon_update_timer" type="labelenum" values="0.5|1|2|4|8|24" label="707416" default="1"/>
<setting label="Lista activa" type="text" id="lista_activa" default="kodfavorites-default.json" visible="false"/>

View File

@@ -311,11 +311,10 @@ def submenu_tools(item):
itemlist.append(Item(channel='custom', action='mainlist', title='Custom Channel'))
#Disabilitato il menu degli aggiornamenti
#itemlist.append(Item(channel=CHANNELNAME, action="check_quickfixes", folder=False,
# title=config.get_localized_string(30001), plot="Versión actual: %s" % config.get_addon_version() ))
itemlist.append(Item(channel=CHANNELNAME, action="update_quasar", folder=False,
title=config.get_localized_string(70569)))
itemlist.append(Item(channel=CHANNELNAME, action="check_quickfixes", folder=False,
title=config.get_localized_string(30001), plot=config.get_addon_version(with_fix=True) ))
# itemlist.append(Item(channel=CHANNELNAME, action="update_quasar", folder=False,
# title=config.get_localized_string(70569)))
itemlist.append(Item(channel=CHANNELNAME, action="", title="", folder=False,
thumbnail=get_thumb("setting_0.png")))
@@ -344,7 +343,7 @@ def check_quickfixes(item):
if not config.dev_mode():
from platformcode import updater
return updater.check()
return updater.timer(True)
else:
return False

View File

@@ -378,7 +378,7 @@ if __name__ == "__main__":
# Verificar quick-fixes al abrirse Kodi, y dejarlo corriendo como Thread
if not config.dev_mode():
from platformcode import updater
updater.check()
updater.timer(True)
# Copia Custom code a las carpetas de Alfa desde la zona de Userdata
from platformcode import custom_code