fix e migliorie per l'updater

This commit is contained in:
mac12m99
2019-08-03 15:14:09 +02:00
parent 155e6e0bf2
commit b76fef912c
6 changed files with 29 additions and 28 deletions

View File

@@ -17,26 +17,32 @@ __language__ = __settings__.getLocalizedString
def get_addon_core():
return __settings__
def get_addon_version(with_fix=True):
'''
Devuelve el número de versión del addon, y opcionalmente número de fix si lo hay
Trova la versione dell'addon, senza usare le funzioni di kodi perchè non si aggiornano fino al riavvio
'''
info = open(os.path.join(get_runtime_path(), 'addon.xml')).read()
ver = re.search('plugin.video.kod.*?version="([^"]+)"', info).group(1)
if with_fix:
return __settings__.getAddonInfo('version') + get_addon_version_fix()
return ver + " " + get_addon_version_fix()
else:
return __settings__.getAddonInfo('version')
return ver
def get_addon_version_fix():
try:
last_fix_json = os.path.join(get_runtime_path(), 'last_fix.json') # información de la versión fixeada del usuario
if os.path.exists(last_fix_json):
with open(last_fix_json, 'r') as f: data=f.read(); f.close()
fix = re.findall('"fix_version"\s*:\s*(\d+)', data)
if fix:
return '.fix%s' % fix[0]
except:
pass
return ''
if not dev_mode():
sha = open(os.path.join(get_runtime_path(), 'last_commit.txt')).readline()
return sha[:8]
else:
return 'DEV'
def dev_mode():
r = os.path.isdir(get_runtime_path() + '/.git')
return r
def get_platform(full_version=False):
"""