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 getPackages(self): menu = [] try: params = {'restriction-oe':metrixTools.getOERestriction(), 'restriction-image':metrixTools.getImageRestriction(), 'orderby':self.orderby+" "+self.limit, 'category_id':str(self.category_id)} data = metrixCore.getWeb(self.url,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) name = str(design.getAttributeNode('name').nodeValue) author = str(design.getAttributeNode('author').nodeValue) version = str(design.getAttributeNode('version').nodeValue) rating = str(design.getAttributeNode('rating').nodeValue) date = str(design.getAttributeNode('date_created').nodeValue) date_modified = str(design.getAttributeNode('date_modified').nodeValue) item_type = str(design.getAttributeNode('type').nodeValue) file_link = str(design.getAttributeNode('file_link').nodeValue) image_link = str(design.getAttributeNode('image_link').nodeValue) icon_link = str(design.getAttributeNode('icon_link').nodeValue) downloads = str(design.getAttributeNode('downloads').nodeValue) total_votes = str(design.getAttributeNode('total_votes').nodeValue) build = int(design.getAttributeNode('build').nodeValue) description = str(design.getAttributeNode('description').nodeValue) previouspackage = str(design.getAttributeNode('previouspackage').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) or item_id == config.plugins.MyMetrix.XPiconsRepository.value: isinstalled = True if build > localbuild: updateavailable = True if (not self.onlyupdates and not self.onlyinstalled == True) or (build > localbuild and self.onlyupdates == True) or (self.onlyinstalled and isinstalled == True): menu.append(self.PackagesListEntry(item_id,name,author,rating,date,version,total_votes,item_type,image_link,icon_link,description,file_link,downloads,previouspackage,date_modified,build,isinstalled,updateavailable)) metrixTools.callOnMainThread(self.setList,menu) if len(menu) < 1: self.image = metrixDefaults.PLUGIN_DIR + "images/sponsor.png" metrixTools.callOnMainThread(self.setList,menu) except Exception, e: metrixTools.log('Error getting packages via web',e) self.image = metrixDefaults.PLUGIN_DIR + "images/sponsor.png" metrixTools.callOnMainThread(self.setList,menu)