1 # -*- coding: utf-8 -*-
3 # Copyright (C) 2013 Team-XBMC
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 from lib.common import log
27 __addonpath__ = lib.common.__addonpath__
29 import json as jsoninterface
31 def get_installedversion():
32 # retrieve current installed version
33 json_query = xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "method": "Application.GetProperties", "params": {"properties": ["version", "name"]}, "id": 1 }')
34 json_query = unicode(json_query, 'utf-8', errors='ignore')
35 json_query = jsoninterface.loads(json_query)
36 version_installed = []
37 if json_query.has_key('result') and json_query['result'].has_key('version'):
38 version_installed = json_query['result']['version']
39 return version_installed
41 def get_versionfilelist():
42 # retrieve versionlists from supplied version file
43 version_file = os.path.join(__addonpath__, 'resources/versions.txt')
44 # Eden didn't have xbmcvfs.File()
45 if xbmcaddon.Addon('xbmc.addon').getAddonInfo('version') < "11.9.3":
46 file = open(version_file, 'r')
48 file = xbmcvfs.File(version_file)
51 version_query = unicode(data, 'utf-8', errors='ignore')
52 version_query = jsoninterface.loads(version_query)