def getUpdatedPackages(): menu = [] try: params = {'restrictions':metrixTools.getRestrictions(), 'category_id':"%"} data = metrixCore.getWeb(metrixDefaults.URL_GET_PACKAGES,True,params) if "<exception status=""error""" in data: raise Exception("Error loading data") dom = parseString(data) for design in dom.getElementsByTagName('entry'): isinstalled = False updateavailable = False item_id = str(design.getAttributeNode('id').nodeValue) file_link = str(design.getAttributeNode('file_link').nodeValue) build = int(design.getAttributeNode('build').nodeValue) localbuild = int(metrixDefaults.cfg(metrixDefaults.CONFIG_INSTALLEDPACKAGES,item_id,"build","int")) # add when not only updates or (only updates and online build is higher) if (not localbuild == metrixDefaults.NONEINT): isinstalled = True if build > localbuild: updateavailable = True if build > localbuild: metrix_PackageTools.installPackage(file_link,True,True,item_id,build) config.plugins.MetrixUpdater.RebootRequired.value = True config.plugins.MetrixUpdater.UpdatePopup_Packages.value = True except Exception, e: metrixTools.log('Error getting packages via web',e)
def getUpdatedPackages(): menu = [] try: params = {'restriction-oe':metrixTools.getOERestriction(), 'restriction-image':metrixTools.getImageRestriction(), 'category_id':"%"} data = metrixCore.getWeb(metrixDefaults.URL_GET_PACKAGES,True,params) if "<exception status=""error""" in data: raise Exception("Error loading data") dom = parseString(data) for package in dom.getElementsByTagName('entry'): isinstalled = False updateavailable = False item_id = str(package.getAttributeNode('id').nodeValue) file_link = str(package.getAttributeNode('file_link').nodeValue) build = int(package.getAttributeNode('build').nodeValue) localbuild = int(metrixDefaults.cfg(metrixDefaults.CONFIG_INSTALLEDPACKAGES,item_id,"build","int")) # add when not only updates or (only updates and online build is higher) if (not localbuild == metrixDefaults.NONEINT): isinstalled = True if build > localbuild: updateavailable = True metrix_PackageTools.installPackage(file_link,True,True,item_id,build) config.plugins.MetrixUpdater.RebootRequired.value = True except Exception, e: metrixTools.log('Error getting packages via web',e)
def getUpdatedPackages(): menu = [] try: params = { "restriction-oe": metrixTools.getOERestriction(), "restriction-image": metrixTools.getImageRestriction(), "category_id": "%", } data = metrixCore.getWeb(metrixDefaults.URL_GET_PACKAGES, True, params) if "<exception status=" "error" "" in data: raise Exception("Error loading data") dom = parseString(data) for package in dom.getElementsByTagName("entry"): isinstalled = False updateavailable = False item_id = str(package.getAttributeNode("id").nodeValue) file_link = str(package.getAttributeNode("file_link").nodeValue) build = int(package.getAttributeNode("build").nodeValue) localbuild = int(metrixDefaults.cfg(metrixDefaults.CONFIG_INSTALLEDPACKAGES, item_id, "build", "int")) # add when not only updates or (only updates and online build is higher) if not localbuild == metrixDefaults.NONEINT: isinstalled = True if build > localbuild: updateavailable = True metrix_PackageTools.installPackage(file_link, True, True, item_id, build) config.plugins.MetrixUpdater.RebootRequired.value = True except Exception, e: metrixTools.log("Error getting packages via web", e)
def downloadPackage(self): self.updatestatus(_("Installing...")) download_link = self["menu"].l.getCurrentSelection()[0][11] item_id = self["menu"].l.getCurrentSelection()[0][0] item_build = self["menu"].l.getCurrentSelection()[0][14] type = self["menu"].l.getCurrentSelection()[0][7] if str(type) == "piconrepo": #XPicon Repository config.plugins.MyMetrix.XPiconsRepository.value = self["menu"].l.getCurrentSelection()[0][0] config.plugins.MyMetrix.XPiconsRepositoryName.value = self["menu"].l.getCurrentSelection()[0][1] config.plugins.MyMetrix.save() configfile.save() self.updatestatus(_("Repo successfully selected!")) else: try: instStatus = metrix_PackageTools.installPackage(download_link,True,True,item_id,item_build) if instStatus: self.updatestatus(_("Installation complete!")) config.plugins.MetrixUpdater.Reboot.value = 1 config.plugins.MetrixUpdater.save() configfile.save() time.sleep(2) self.getCatalog = True self.getEntry = True else: self.updatestatus(_("Error installing package!")) except: pass
def installPackage(param,actionId,isUpdate=False): params = param.split(";") packageId = params[0] metrixTools.log("Installing package "+packageId) downloadurl = metrixDefaults.URL_STORE_API + "get.xml.packagefile&file_id="+params[1]+"&token="+params[2] if isUpdate: downloadurl = metrixDefaults.URL_STORE_API + "get.xml.packagefile-update&file_id="+params[1]+"&token="+params[2] localPath = "/tmp/metrixPackage.ipk" instSuccess = metrix_PackageTools.installPackage(downloadurl,True) if instSuccess: config.plugins.MetrixUpdater.Reboot.value = 1 config.plugins.MetrixUpdater.save() configfile.save() path = metrixDefaults.pathRoot()+"packages/"+packageId if not os.path.exists(path): os.makedirs(path) showInfo(_("Package successfully installed!")) else: showInfo(_("Error installing package!"),MessageBox.TYPE_ERROR) metrixTools.log("Error installing package "+params[0])
def runAction(item_id,action,actiontype,param): #print "============ ACTIONPARAMS: "+param checkAction(item_id) if action == "install": if actiontype == "SkinPart": installSkinPart(param,item_id) elif actiontype == "MetrixColors": metrix_MetrixColorsTools.installMetrixColors(param) elif actiontype == "Package": installPackage(param,item_id) elif actiontype == "PackageURL": data = param.split(";") if len(data) == 1: metrix_PackageTools.installPackage(data[0],True) else: metrix_PackageTools.installPackage(data[0],True,False,data[1],data[2]) elif actiontype == "PiconRepo": params = param.split(";") config.plugins.MyMetrix.XPiconsRepository.value = params[0] config.plugins.MyMetrix.XPiconsRepositoryName.value = params[1] config.plugins.MyMetrix.save() configfile.save() if action == "uninstall": if actiontype == "Package": metrix_PackageTools.uninstallPackage(param) elif action == "generateSkin": generateSkin(item_id) elif action == "disable": if actiontype == "SkinPart": success = False try: metrix_SkinPartTools.disableSkinPart(config.plugins.MyMetrix.SkinPartPath.value + "screens/active/screen_"+param) postBackup() success = True except: pass try: metrix_SkinPartTools.disableSkinPart(config.plugins.MyMetrix.SkinPartPath.value + "widgets/active/widget_"+param) success = True postBackup() except: pass if success: showInfo(_("SkinPart successfully disabled!")) elif action == "enable": if actiontype == "SkinPart": success = False try: metrix_SkinPartTools.enableSkinPart(config.plugins.MyMetrix.SkinPartPath.value + "screens/active/screen_"+param) postBackup() success = True except: pass try: metrix_SkinPartTools.enableSkinPart(config.plugins.MyMetrix.SkinPartPath.value + "widgets/active/widget_"+param) postBackup() success = True except: pass if success: showInfo(_("SkinPart successfully enabled!")) elif action == "generateRestart": generateSkin(item_id) time.sleep(1) rebootGui(item_id) elif action == "restartGui": rebootGui(item_id) elif action == "command": runCommand(actiontype,param,item_id) checkAction(item_id)