diff --git a/platformcode/config.py b/platformcode/config.py index a16f992f..d97d102c 100644 --- a/platformcode/config.py +++ b/platformcode/config.py @@ -16,6 +16,8 @@ __version_fix = None __dev_mode = None channels_data = dict() +changelogFile = xbmc.translatePath("special://profile/addon_data/plugin.video.kod/changelog.txt") + def get_addon_core(): return __settings__ diff --git a/platformcode/launcher.py b/platformcode/launcher.py index 0b404dcf..58645b7f 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -22,8 +22,14 @@ def start(): logger.debug() if not config.dev_mode(): - from platformcode import updater - updater.showSavedChangelog() + try: + with open(config.changelogFile, 'r') as fileC: + changelog = fileC.read() + if changelog.strip(): + platformtools.dialog_ok('Kodi on Demand', 'Aggiornamenti applicati:\n' + changelog) + os.remove(config.changelogFile) + except: + pass def run(item=None): diff --git a/platformcode/updater.py b/platformcode/updater.py index 3e70d698..b0b908cf 100644 --- a/platformcode/updater.py +++ b/platformcode/updater.py @@ -9,7 +9,6 @@ from platformcode import config, logger, platformtools import json import xbmc import re -import xbmcaddon from lib import githash try: import urllib.request as urllib @@ -18,7 +17,7 @@ except ImportError: import sys PY3 = False if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int -addon = xbmcaddon.Addon('plugin.video.kod') +addon = config.__settings__ addonname = addon.getAddonInfo('name') _hdr_pat = re.compile("^@@ -(\d+),?(\d+)? \+(\d+),?(\d+)? @@.*") @@ -29,7 +28,6 @@ repo = 'addon' addonDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) maxPage = 5 # le api restituiscono 30 commit per volta, quindi se si è rimasti troppo indietro c'è bisogno di andare avanti con le pagine trackingFile = "last_commit.txt" -changelogFile = "special://profile/addon_data/plugin.video.kod/changelog.txt" def loadCommits(page=1): @@ -162,7 +160,7 @@ def check(background=False): if background: platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80040) % commits[0]['sha'][:7], time=3000, sound=False) try: - with open(xbmc.translatePath(changelogFile), 'a+') as fileC: + with open(config.changelogFile, 'a+') as fileC: fileC.write(changelog) except: import traceback @@ -175,17 +173,6 @@ def check(background=False): return updated, serviceChanged -def showSavedChangelog(): - try: - with open(xbmc.translatePath(changelogFile), 'r') as fileC: - changelog = fileC.read() - if changelog.strip(): - platformtools.dialog_ok('Kodi on Demand', 'Aggiornamenti applicati:\n' + changelog) - os.remove(xbmc.translatePath(changelogFile)) - except: - pass - - def calcCurrHash(): treeHash = githash.tree_hash(addonDir).hexdigest() logger.info('tree hash: ' + treeHash)