diff options
author | Rechi <Rechi@users.noreply.github.com> | 2017-10-30 12:35:33 +0100 |
---|---|---|
committer | Rechi <Rechi@users.noreply.github.com> | 2017-10-30 12:35:33 +0100 |
commit | 49fb64518333fd15bb96dba0d3870b849e94470c (patch) | |
tree | a4fddb88a65672dc6fa0b850d05975bbfdf84783 | |
parent | 5c9080b0f45bf1da5d327c20117e5cff5a0edfa1 (diff) |
[addons] sync versioncheck with repo
-rw-r--r-- | addons/service.xbmc.versioncheck/README.md | 2 | ||||
-rw-r--r-- | addons/service.xbmc.versioncheck/addon.xml | 2 | ||||
-rw-r--r-- | addons/service.xbmc.versioncheck/changelog.txt | 9 | ||||
-rw-r--r-- | addons/service.xbmc.versioncheck/lib/__init__.py | 2 | ||||
-rw-r--r-- | addons/service.xbmc.versioncheck/lib/aptdaemonhandler.py (renamed from addons/service.xbmc.versioncheck/lib/aptdeamonhandler.py) | 4 | ||||
-rw-r--r-- | addons/service.xbmc.versioncheck/lib/common.py | 35 | ||||
-rw-r--r-- | addons/service.xbmc.versioncheck/lib/jsoninterface.py | 14 | ||||
-rw-r--r-- | addons/service.xbmc.versioncheck/lib/shellhandlerapt.py | 2 | ||||
-rw-r--r-- | addons/service.xbmc.versioncheck/lib/versions.py | 8 | ||||
-rw-r--r-- | addons/service.xbmc.versioncheck/lib/viewer.py | 14 | ||||
-rw-r--r-- | addons/service.xbmc.versioncheck/resources/language/Hebrew/strings.po | 2 | ||||
-rw-r--r-- | addons/service.xbmc.versioncheck/resources/language/Korean/strings.po | 2 | ||||
-rw-r--r-- | addons/service.xbmc.versioncheck/resources/versions.txt | 87 | ||||
-rw-r--r-- | addons/service.xbmc.versioncheck/service.py | 20 |
14 files changed, 158 insertions, 45 deletions
diff --git a/addons/service.xbmc.versioncheck/README.md b/addons/service.xbmc.versioncheck/README.md index 1442d6f532..5f8cbc56e5 100644 --- a/addons/service.xbmc.versioncheck/README.md +++ b/addons/service.xbmc.versioncheck/README.md @@ -3,4 +3,4 @@ XBMC Versioncheck This service checks the installed XBMC version against the next available one and notifies you if there is a new version available. When a new version comes out the versions.txt should be updated to reflect the latest version available. -When updating the version.txt always put latest release at the top since the list is read in chronilogical order. +When updating the version.txt always put latest release at the top since the list is read in chronological order. diff --git a/addons/service.xbmc.versioncheck/addon.xml b/addons/service.xbmc.versioncheck/addon.xml index 2601eb69fe..811aace538 100644 --- a/addons/service.xbmc.versioncheck/addon.xml +++ b/addons/service.xbmc.versioncheck/addon.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <addon id="service.xbmc.versioncheck" name="Version Check" - version="0.3.17" + version="0.3.25" provider-name="Team Kodi"> <requires> <import addon="xbmc.python" version="2.1.0"/> diff --git a/addons/service.xbmc.versioncheck/changelog.txt b/addons/service.xbmc.versioncheck/changelog.txt index 5e6e7bd660..c5775f48f7 100644 --- a/addons/service.xbmc.versioncheck/changelog.txt +++ b/addons/service.xbmc.versioncheck/changelog.txt @@ -1,10 +1,7 @@ -v0.3.17 -- Update version list - -v0.3.16 -- Update version list +v0.3.25 +- fix issue with the older python2.6 -v0.3.15 +v0.3.5 to v0.3.24 - Update version list v0.3.14 diff --git a/addons/service.xbmc.versioncheck/lib/__init__.py b/addons/service.xbmc.versioncheck/lib/__init__.py index 4b0dc39c7f..55e5f844b4 100644 --- a/addons/service.xbmc.versioncheck/lib/__init__.py +++ b/addons/service.xbmc.versioncheck/lib/__init__.py @@ -1 +1 @@ -from common import * +from .common import * diff --git a/addons/service.xbmc.versioncheck/lib/aptdeamonhandler.py b/addons/service.xbmc.versioncheck/lib/aptdaemonhandler.py index 012312758c..1e09b56100 100644 --- a/addons/service.xbmc.versioncheck/lib/aptdeamonhandler.py +++ b/addons/service.xbmc.versioncheck/lib/aptdaemonhandler.py @@ -16,7 +16,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # import xbmc -from common import * +from .common import * try: #import apt @@ -26,7 +26,7 @@ try: except: log('python apt import error') -class AptdeamonHandler: +class AptdaemonHandler: def __init__(self): self.aptclient = client.AptClient() diff --git a/addons/service.xbmc.versioncheck/lib/common.py b/addons/service.xbmc.versioncheck/lib/common.py index 1aa62a3dee..69e70786d6 100644 --- a/addons/service.xbmc.versioncheck/lib/common.py +++ b/addons/service.xbmc.versioncheck/lib/common.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # +import sys import os import xbmc @@ -25,8 +26,12 @@ import xbmcvfs ADDON = xbmcaddon.Addon() ADDONVERSION = ADDON.getAddonInfo('version') ADDONNAME = ADDON.getAddonInfo('name') -ADDONPATH = ADDON.getAddonInfo('path').decode('utf-8') -ADDONPROFILE = xbmc.translatePath( ADDON.getAddonInfo('profile') ).decode('utf-8') +if sys.version_info[0] >= 3: + ADDONPATH = ADDON.getAddonInfo('path') + ADDONPROFILE = xbmc.translatePath( ADDON.getAddonInfo('profile') ) +else: + ADDONPATH = ADDON.getAddonInfo('path').decode('utf-8') + ADDONPROFILE = xbmc.translatePath( ADDON.getAddonInfo('profile') ).decode('utf-8') ICON = ADDON.getAddonInfo('icon') monitor = xbmc.Monitor() @@ -34,7 +39,10 @@ monitor = xbmc.Monitor() # Fixes unicode problems def string_unicode(text, encoding='utf-8'): try: - text = unicode( text, encoding ) + if sys.version_info[0] >= 3: + text = str( text ) + else: + text = unicode( text, encoding ) except: pass return text @@ -51,10 +59,13 @@ def localise(id): return string def log(txt): - if isinstance (txt,str): - txt = txt.decode("utf-8") - message = u'%s: %s' % ("Version Check", txt) - xbmc.log(msg=message.encode("utf-8"), level=xbmc.LOGDEBUG) + if sys.version_info[0] >= 3: + message = '%s: %s' % ("Version Check", txt.encode('utf-8')) + else: + if isinstance (txt,str): + txt = txt.decode("utf-8") + message = (u'%s: %s' % ("Version Check", txt)).encode("utf-8") + xbmc.log(msg=message, level=xbmc.LOGDEBUG) def get_password_from_user(): keyboard = xbmc.Keyboard("", ADDONNAME + "," +localise(32022), True) @@ -89,7 +100,7 @@ def upgrade_message(msg, oldversion, upgrade, msg_current, msg_available): #ADDON.setSetting("lastnotified_version", ADDONVERSION) else: log("Already notified one time for upgrading.") - + def upgrade_message2( version_installed, version_available, version_stable, oldversion, upgrade,): # shorten releasecandidate to rc if version_installed['tag'] == 'releasecandidate': @@ -117,7 +128,7 @@ def upgrade_message2( version_installed, version_available, version_stable, oldv # People will find out once they visit the website. # For stable only notify once and when there's a newer stable available. # Ignore any add-on updates as those only count for != stable - if oldversion == 'stable' and ADDON.getSetting("lastnotified_stable") != msg_stable: + if oldversion == 'stable' and ADDON.getSetting("lastnotified_stable") != msg_stable: if xbmcaddon.Addon('xbmc.addon').getAddonInfo('version') < "13.9.0": xbmcgui.Dialog().ok(ADDONNAME, msg, @@ -129,7 +140,7 @@ def upgrade_message2( version_installed, version_available, version_stable, oldv localise(32032), localise(32033)) ADDON.setSetting("lastnotified_stable", msg_stable) - + elif oldversion != 'stable' and ADDON.getSetting("lastnotified_version") != msg_available: if xbmcaddon.Addon('xbmc.addon').getAddonInfo('version') < "13.9.0": # point them to xbmc.org @@ -157,7 +168,7 @@ def upgrade_message2( version_installed, version_available, version_stable, oldv #ADDON.setSetting("lastnotified_version", ADDONVERSION) ''' ADDON.setSetting("lastnotified_version", msg_available) - + else: log("Already notified one time for upgrading.") @@ -173,4 +184,4 @@ def wait_for_end_of_video(): if monitor.waitForAbort(1): # Abort was requested while waiting. We should exit break - i += 1
\ No newline at end of file + i += 1 diff --git a/addons/service.xbmc.versioncheck/lib/jsoninterface.py b/addons/service.xbmc.versioncheck/lib/jsoninterface.py index 32395e890b..6f0f7acb91 100644 --- a/addons/service.xbmc.versioncheck/lib/jsoninterface.py +++ b/addons/service.xbmc.versioncheck/lib/jsoninterface.py @@ -31,13 +31,16 @@ import json as jsoninterface def get_installedversion(): # retrieve current installed version json_query = xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "method": "Application.GetProperties", "params": {"properties": ["version", "name"]}, "id": 1 }') - json_query = unicode(json_query, 'utf-8', errors='ignore') + if sys.version_info[0] >= 3: + json_query = str(json_query) + else: + json_query = unicode(json_query, 'utf-8', errors='ignore') json_query = jsoninterface.loads(json_query) version_installed = [] - if json_query.has_key('result') and json_query['result'].has_key('version'): + if 'result' in json_query and 'version' in json_query['result']: version_installed = json_query['result']['version'] return version_installed - + def get_versionfilelist(): # retrieve versionlists from supplied version file version_file = os.path.join(ADDONPATH, 'resources/versions.txt') @@ -48,6 +51,9 @@ def get_versionfilelist(): file = xbmcvfs.File(version_file) data = file.read() file.close() - version_query = unicode(data, 'utf-8', errors='ignore') + if sys.version_info[0] >= 3: + version_query = str(data) + else: + version_query = unicode(data, 'utf-8', errors='ignore') version_query = jsoninterface.loads(version_query) return version_query diff --git a/addons/service.xbmc.versioncheck/lib/shellhandlerapt.py b/addons/service.xbmc.versioncheck/lib/shellhandlerapt.py index b09ed1c269..9fbb0b5e5b 100644 --- a/addons/service.xbmc.versioncheck/lib/shellhandlerapt.py +++ b/addons/service.xbmc.versioncheck/lib/shellhandlerapt.py @@ -16,7 +16,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # import xbmc -from common import * +from .common import * try: from subprocess import check_output diff --git a/addons/service.xbmc.versioncheck/lib/versions.py b/addons/service.xbmc.versioncheck/lib/versions.py index 6ffa16611c..514136e5fe 100644 --- a/addons/service.xbmc.versioncheck/lib/versions.py +++ b/addons/service.xbmc.versioncheck/lib/versions.py @@ -24,7 +24,7 @@ def compare_version(version_installed, versionlist): versionlist_rc = versionlist['releases']['releasecandidate'] versionlist_beta = versionlist['releases']['beta'] versionlist_alpha = versionlist['releases']['alpha'] - versionlist_prealpha = versionlist['releases']['prealpha'] + versionlist_prealpha = versionlist['releases']['prealpha'] log('Version installed %s' %version_installed) ### Check to upgrade to newest available stable version # check on smaller major version. Smaller version than available always notify @@ -56,11 +56,11 @@ def compare_version(version_installed, versionlist): else: log('Version available %s' %versionlist_stable[0]) log('There is no newer stable available') - + # Already skipped a possible newer stable build. Let's continue with non stable builds. # Check also 'oldversion' hasn't been set to 'stable' or true by previous checks because if so, # those part need to be skipped - + #check for RC builds if not oldversion and version_installed['tag'] in ['releasecandidate']: # check if you are using a RC build lower than current available RC @@ -122,6 +122,6 @@ def compare_version(version_installed, versionlist): version_available = versionlist_alpha[0] oldversion = True log('Version available %s' %versionlist_alpha[0]) - log('You are running an older non alpha version') + log('You are running an older non alpha version') version_stable = versionlist_stable[0] return oldversion, version_installed, version_available, version_stable
\ No newline at end of file diff --git a/addons/service.xbmc.versioncheck/lib/viewer.py b/addons/service.xbmc.versioncheck/lib/viewer.py index 58a3f379b3..4a43156a33 100644 --- a/addons/service.xbmc.versioncheck/lib/viewer.py +++ b/addons/service.xbmc.versioncheck/lib/viewer.py @@ -28,8 +28,12 @@ import xbmcaddon ADDON = xbmcaddon.Addon('service.xbmc.versioncheck') ADDONVERSION = ADDON.getAddonInfo('version') ADDONNAME = ADDON.getAddonInfo('name') -ADDONPATH = ADDON.getAddonInfo('path').decode('utf-8') -ADDONPROFILE = xbmc.translatePath( ADDON.getAddonInfo('profile') ).decode('utf-8') +if sys.version_info[0] >= 3: + ADDONPATH = ADDON.getAddonInfo('path') + ADDONPROFILE = xbmc.translatePath( ADDON.getAddonInfo('profile') ) +else: + ADDONPATH = ADDON.getAddonInfo('path').decode('utf-8') + ADDONPROFILE = xbmc.translatePath( ADDON.getAddonInfo('profile') ).decode('utf-8') ICON = ADDON.getAddonInfo('icon') class Viewer: @@ -61,7 +65,7 @@ class Viewer: try: if sys.argv[ 1 ] == "gotham-alpha_notice": return "Call to Gotham alpha users", self.readFile(os.path.join(ADDONPATH , "resources/gotham-alpha_notice.txt")) - except Exception, e: + except Exception as e: xbmc.log(ADDONNAME + ': ' + str(e), xbmc.LOGERROR) return "", "" @@ -79,7 +83,7 @@ class WebBrowser: xbmc.sleep(100) # launch url self.launchUrl(url) - except Exception, e: + except Exception as e: xbmc.log(ADDONNAME + ': ' + str(e), xbmc.LOGERROR) def launchUrl(self, url): @@ -92,7 +96,7 @@ def Main(): WebBrowser() else: Viewer() - except Exception, e: + except Exception as e: xbmc.log(ADDONNAME + ': ' + str(e), xbmc.LOGERROR) if (__name__ == "__main__"): diff --git a/addons/service.xbmc.versioncheck/resources/language/Hebrew/strings.po b/addons/service.xbmc.versioncheck/resources/language/Hebrew/strings.po index a32554a939..704289a898 100644 --- a/addons/service.xbmc.versioncheck/resources/language/Hebrew/strings.po +++ b/addons/service.xbmc.versioncheck/resources/language/Hebrew/strings.po @@ -94,7 +94,7 @@ msgstr "בקר ב-http://kodi.tv למידע נוסף." msgctxt "#32034" msgid "Using %s while %s is available." -msgstr "שימוש בs% בעוד s% זמין." +msgstr "שימוש ב%s בעוד %s זמין." msgctxt "#32035" msgid "It is recommended that you to upgrade to a newer version." diff --git a/addons/service.xbmc.versioncheck/resources/language/Korean/strings.po b/addons/service.xbmc.versioncheck/resources/language/Korean/strings.po index bc32baf5a5..6fb8be9140 100644 --- a/addons/service.xbmc.versioncheck/resources/language/Korean/strings.po +++ b/addons/service.xbmc.versioncheck/resources/language/Korean/strings.po @@ -94,7 +94,7 @@ msgstr "자세한 정보는 http://kodi.tv를 방문하세요." msgctxt "#32034" msgid "Using %s while %s is available." -msgstr "현재 사용 중인 버전은 %s 이며 최신 버전 % 을(를) 사용할 수 있습니다" +msgstr "현재 사용 중인 버전은 %s 이며 최신 버전 %s 을(를) 사용할 수 있습니다" msgctxt "#32035" msgid "It is recommended that you to upgrade to a newer version." diff --git a/addons/service.xbmc.versioncheck/resources/versions.txt b/addons/service.xbmc.versioncheck/resources/versions.txt index bf23890763..9e4251f845 100644 --- a/addons/service.xbmc.versioncheck/resources/versions.txt +++ b/addons/service.xbmc.versioncheck/resources/versions.txt @@ -3,6 +3,60 @@ "releases": { "stable": [ { + "major": "17", + "minor": "4", + "tag": "stable", + "tagversion":"", + "revision": "20170822-7fc6da0", + "extrainfo": "final", + "addon_support": "yes" + }, + { + "major": "17", + "minor": "3", + "tag": "stable", + "tagversion":"", + "revision": "20170524-147cec4", + "extrainfo": "final", + "addon_support": "yes" + }, + { + "major": "17", + "minor": "1", + "tag": "stable", + "tagversion":"", + "revision": "20170320-fc1619b", + "extrainfo": "final", + "addon_support": "yes" + }, + { + "major": "17", + "minor": "0", + "tag": "stable", + "tagversion":"", + "revision": "20170201-a10c504", + "extrainfo": "final", + "addon_support": "yes" + }, + { + "major": "16", + "minor": "1", + "tag": "stable", + "tagversion":"", + "revision": "20160424-c327c53", + "extrainfo": "final", + "addon_support": "yes" + }, + { + "major": "16", + "minor": "0", + "tag": "stable", + "tagversion":"", + "revision": "20160220-a5f3a99", + "extrainfo": "final", + "addon_support": "yes" + }, + { "major": "15", "minor": "2", "tag": "stable", @@ -149,6 +203,15 @@ ], "releasecandidate": [ { + "major": "17", + "minor": "0", + "tag": "releasecandidate", + "tagversion":"3", + "revision": "20170111-4d93228", + "extrainfo": "RC3", + "addon_support": "yes" + }, + { "major": "16", "minor": "0", "tag": "releasecandidate", @@ -322,6 +385,14 @@ ], "beta": [ { + "major": "17", + "minor": "0", + "tag": "beta", + "tagversion":"6", + "revision": "20161130-654f1b7", + "addon_support": "yes" + }, + { "major": "16", "minor": "0", "tag": "beta", @@ -564,6 +635,22 @@ ], "alpha": [ { + "major": "17", + "minor": "0", + "tag": "alpha", + "tagversion":"2", + "revision": "", + "addon_support": "yes" + }, + { + "major": "17", + "minor": "0", + "tag": "alpha", + "tagversion":"1", + "revision": "", + "addon_support": "yes" + }, + { "major": "16", "minor": "0", "tag": "alpha", diff --git a/addons/service.xbmc.versioncheck/service.py b/addons/service.xbmc.versioncheck/service.py index 7537ff3faf..7f85bedefe 100644 --- a/addons/service.xbmc.versioncheck/service.py +++ b/addons/service.xbmc.versioncheck/service.py @@ -31,11 +31,16 @@ ADDONPATH = lib.common.ADDONPATH ICON = lib.common.ICON oldversion = False +monitor = xbmc.Monitor() + class Main: def __init__(self): linux = False packages = [] - xbmc.sleep(5000) + + if monitor.waitForAbort(5): + sys.exit(0) + if xbmc.getCondVisibility('System.Platform.Linux') and ADDON.getSetting("upgrade_apt") == 'true': packages = ['kodi'] _versionchecklinux(packages) @@ -62,9 +67,9 @@ def _versionchecklinux(packages): handler = False result = False try: - # try aptdeamon first - from lib.aptdeamonhandler import AptdeamonHandler - handler = AptdeamonHandler() + # try aptdaemon first + from lib.aptdaemonhandler import AptdaemonHandler + handler = AptdaemonHandler() except: # fallback to shell # since we need the user password, ask to check for new version first @@ -100,5 +105,8 @@ def _versionchecklinux(packages): if (__name__ == "__main__"): - log('Version %s started' % ADDONVERSION) - Main() + if ADDON.getSetting("versioncheck_enable") == "false": + log("Disabled") + else: + log('Version %s started' % ADDONVERSION) + Main() |