from core import filetools, downloadtools, support from platformcode import config, platformtools, updater import xbmc, xbmcaddon, sys, platform host = 'https://github.com' elementum_url = host + '/elgatito/plugin.video.elementum/releases' filename = filetools.join(config.get_data_path(),'elementum.zip') addon_path = xbmc.translatePath('special://home/addons/') setting_path = xbmc.translatePath('special://profile/addon_data/') elementum_path = filetools.join(addon_path,'plugin.video.elementum') elementum_setting = filetools.join(setting_path,'plugin.video.elementum') elementum_setting_file = filetools.join(elementum_setting,'settings.xml') kod_setting_file = filetools.join(addon_path,'plugin.video.kod', 'resources', 'settings', 'elementum', 'settings.xml') def download(item=None): ret = True if filetools.exists(elementum_path): if platformtools.dialog_yesno(config.get_localized_string(70784), config.get_localized_string(70783)): addon_file = filetools.file_open(filetools.join(elementum_path,'addon.xml')).read() required = support.match(addon_file, patron=r'addon="([^"]+)').matches for r in required: xbmc.executebuiltin('InstallAddon(' + r + ')', wait=True) setting() platformtools.dialog_ok('Elementum', config.get_localized_string(70783)) else: ret = False else: if platformtools.dialog_yesno(config.get_localized_string(70784), config.get_localized_string(70782)): pform = get_platform() url = support.match(elementum_url, patron=r' 2 ** 32 and "64-bit" or "32-bit", "arch": sys.maxsize > 2 ** 32 and "x64" or "x86", "os": "", "version": platform.release(), "kodi": kodi_version, "build": build } if xbmc.getCondVisibility("system.platform.android"): ret["os"] = "android" if "arm" in platform.machine() or "aarch" in platform.machine(): ret["arch"] = "arm" if "64" in platform.machine() and ret["auto_arch"] == "64-bit": ret["arch"] = "arm64" elif xbmc.getCondVisibility("system.platform.linux"): ret["os"] = "linux" if "aarch" in platform.machine() or "arm64" in platform.machine(): if xbmc.getCondVisibility("system.platform.linux.raspberrypi"): ret["arch"] = "armv7" elif ret["auto_arch"] == "32-bit": ret["arch"] = "armv7" elif ret["auto_arch"] == "64-bit": ret["arch"] = "arm64" elif platform.architecture()[0].startswith("32"): ret["arch"] = "arm" else: ret["arch"] = "arm64" elif "armv7" in platform.machine(): ret["arch"] = "armv7" elif "arm" in platform.machine(): ret["arch"] = "arm" elif xbmc.getCondVisibility("system.platform.xbox"): ret["os"] = "windows" ret["arch"] = "x64" elif xbmc.getCondVisibility("system.platform.windows"): ret["os"] = "windows" if platform.machine().endswith('64'): ret["arch"] = "x64" elif xbmc.getCondVisibility("system.platform.osx"): ret["os"] = "darwin" ret["arch"] = "x64" elif xbmc.getCondVisibility("system.platform.ios"): ret["os"] = "ios" ret["arch"] = "arm" return ret['os'] + '_' + ret['arch']