예제 #1
0
def installSkinPart(id,
                    type,
                    author='',
                    image_id='',
                    image_token='',
                    date_modified='',
                    isActive=True):
    downloadurl = 'http://connect.mymetrix.de/store/api/?q=get.xml.skinpartxml&id='
    downloadmetaurl = 'http://connect.mymetrix.de/store/api/?q=get.xml.skinpartmeta&id='
    screenshotpath = 'http://connect.mymetrix.de/store/api/?q=get.pngresized&width=550'
    screenshotpath_v2 = 'http://connect.mymetrix.de/store/api/?q=v2.get.png&width=550&type=6'
    path = metrixDefaults.pathRoot(
    ) + 'skinparts/' + type + 's/inactive/' + type + '_' + str(id) + '/'
    if not os.path.exists(path):
        os.makedirs(path)
    datapath = metrixTools.downloadFile(
        downloadurl + str(id) + '&author=' + author, path + 'data.xml',
        'SKINPART/', '/usr/share/enigma2/MetrixHD/skinparts/' + id + '/')
    metapath = metrixTools.downloadFile(
        downloadmetaurl + str(id) + '&author=' + author, path + 'meta.xml')
    imagepath = ''
    if image_id == '':
        imagepath = metrixTools.downloadFile(screenshotpath_v2 + '&id=' + id,
                                             path + 'preview.png')
    else:
        imagepath = metrixTools.downloadFile(
            screenshotpath + '&image_id=' + image_id + '&token=' + image_token,
            path + 'preview.png')
    if isActive:
        enableSkinPart(path)
    downloadSkinPartRenderer(id)
    downloadSkinPartConverter(id)
    downloadSkinPartImages(id)
예제 #2
0
def installSkinPart(id, type, author="", image_id="", image_token="", date_modified="", isActive=True):
    downloadurl = "http://connect.mymetrix.de/store/api/?q=get.xml.skinpartxml&id="
    downloadmetaurl = "http://connect.mymetrix.de/store/api/?q=get.xml.skinpartmeta&id="
    screenshotpath = "http://connect.mymetrix.de/store/api/?q=get.pngresized&width=550"
    screenshotpath_v2 = "http://connect.mymetrix.de/store/api/?q=v2.get.png&width=550&type=6"
    path = metrixDefaults.pathRoot() + "skinparts/" + type + "s/inactive/" + type + "_" + str(id) + "/"
    if not os.path.exists(path):
        os.makedirs(path)
    datapath = metrixTools.downloadFile(
        downloadurl + str(id) + "&author=" + author,
        path + "data.xml",
        "SKINPART/",
        "/usr/share/enigma2/MetrixHD/skinparts/" + id + "/",
    )
    metapath = metrixTools.downloadFile(downloadmetaurl + str(id) + "&author=" + author, path + "meta.xml")
    imagepath = ""
    if image_id == "":
        imagepath = metrixTools.downloadFile(screenshotpath_v2 + "&id=" + id, path + "preview.png")
    else:
        imagepath = metrixTools.downloadFile(
            screenshotpath + "&image_id=" + image_id + "&token=" + image_token, path + "preview.png"
        )
    if isActive:
        enableSkinPart(path)
    downloadSkinPartRenderer(id)
    downloadSkinPartConverter(id)
    downloadSkinPartImages(id)
예제 #3
0
def installSkinPart(id,
                    sp_type,
                    author="",
                    image_link="",
                    date_modified="",
                    isActive=True,
                    isUpdate=False):
    downloadurl = metrixDefaults.URL_GET_SKINPART_XML + "&id="
    downloadmetaurl = metrixDefaults.URL_GET_SKINPART_META + "&id="
    if isUpdate:
        downloadmetaurl = metrixDefaults.URL_GET_SKINPART_META_UPDATE + "&id="

    path = config.plugins.MyMetrix.SkinPartPath.value + sp_type + "s/inactive/" + sp_type + "_" + str(
        id) + "/"
    if not os.path.exists(path):
        os.makedirs(path)
    datapath = metrixTools.downloadFile(
        downloadurl + str(id) + "&author=" + author, path + "data.xml")
    metapath = metrixTools.downloadFile(
        downloadmetaurl + str(id) + "&author=" + author, path + "meta.xml")
    imagepath = metrixTools.downloadFile(image_link + "&width=550",
                                         path + "preview.png")
    downloadSkinPartRenderer(id)
    downloadSkinPartConverter(id)
    downloadSkinPartImages(id, path)

    if isActive:
        enableSkinPart(path)
예제 #4
0
def downloadScreenshot(item_id, image_id="", image_token=""):
    screenshotpath = "http://connect.mymetrix.de/store/api/?q=get.pngresized&width=550"
    screenshotpath_v2 = "http://connect.mymetrix.de/store/api/?q=v2.get.png&width=550&type=6"
    path = ""
    if image_id == "":
        path = metrixTools.downloadFile(screenshotpath_v2 + "&id=" + item_id, path + "preview.png")
    else:
        path = metrixTools.downloadFile(
            screenshotpath + "&image_id=" + image_id + "&token=" + image_token, path + "preview.png"
        )
    return path
예제 #5
0
def downloadScreenshot(item_id, image_id='', image_token=''):
    screenshotpath = 'http://connect.mymetrix.de/store/api/?q=get.pngresized&width=550'
    screenshotpath_v2 = 'http://connect.mymetrix.de/store/api/?q=v2.get.png&width=550&type=6'
    path = ''
    if image_id == '':
        path = metrixTools.downloadFile(screenshotpath_v2 + '&id=' + item_id,
                                        path + 'preview.png')
    else:
        path = metrixTools.downloadFile(
            screenshotpath + '&image_id=' + image_id + '&token=' + image_token,
            path + 'preview.png')
    return path
예제 #6
0
 def GetPicturePath(self):
     try:
         self.image_id = str(self["menu"].l.getCurrentSelection()[0][8])
         self.item_id = str(self["menu"].l.getCurrentSelection()[0][0])
         self.image_token = str(self["menu"].l.getCurrentSelection()[0][9])
         path = ""
         if self.image_id == "":
             path = metrixTools.downloadFile(self.screenshotpath_v2 + "&id=" + self.item_id, path + "preview.png")
         else:
             path = metrixTools.downloadFile(
                 self.screenshotpath + "&image_id=" + self.image_id + "&token=" + self.image_token,
                 path + "preview.png",
             )
         return path
     except:
         pass
예제 #7
0
 def GetPicturePath(self):
     try:
         returnValue = str(self['menu'].l.getCurrentSelection()[0][0])
         path = metrixTools.downloadFile(self.screenshotpath + returnValue)
         return path
     except:
         pass
예제 #8
0
def installPackage(url,force=False,silent=False,id=0,build=0):
	downloadDir = '/tmp/openstore/'
	if not os.path.exists(downloadDir):
		os.makedirs(downloadDir)
	metrixTools.log("Installing package "+url,None,"OpenStore")
	packagefile = metrixTools.downloadFile(url,downloadDir + 'package.ipk',forceOverwrite=True)
	packagename = getPackageName(downloadDir,"package.ipk")
	if force:
		cmdStatus = runCommand("opkg install --force-overwrite '"+packagefile+"'")
	else:
		cmdStatus = runCommand("opkg install '"+packagefile+"'")
	if cmdStatus[0] == True:
		if not id == 0:
			metrixDefaults.cfgset(metrixDefaults.CONFIG_INSTALLEDPACKAGES,id,"id",id)
			try:
				metrixDefaults.cfgset(metrixDefaults.CONFIG_INSTALLEDPACKAGES,id,"name",packagename)
			except:
				pass
			metrixDefaults.cfgset(metrixDefaults.CONFIG_INSTALLEDPACKAGES,id,"build",build)
			metrixDefaults.cfgset(metrixDefaults.CONFIG_INSTALLEDPACKAGES,id,"url",url)
		config.plugins.MetrixUpdater.Reboot.value = 1
		config.plugins.MetrixUpdater.save()    
		configfile.save()
		if not silent:
			metrixConnector.showInfo(_("Package successfully installed!"))
		return True
	else:
		if not silent:
			metrixConnector.showInfo(_("Error installing Package!"),MessageBox.TYPE_ERROR)
		return False
	if os.path.exists(downloadDir):
		os.removedirs(downloadDir)
	syncPackages()
예제 #9
0
파일: metrixStore.py 프로젝트: HDMU/Skins
 def GetPicturePath(self):
     try:
         returnValue = str(self['menu'].l.getCurrentSelection()[0][0])
         path = metrixTools.downloadFile(self.screenshotpath + returnValue)
         return path
     except:
         pass
예제 #10
0
def downloadAdditionalFiles(url, target_path):
    try:
        opener = register_openers()
        params = {}
        datagen, headers = multipart_encode(params)
        request = urllib2.Request(url, datagen, headers)
        data = urllib2.urlopen(request).read()
        dom = parseString(data)
        for design in dom.getElementsByTagName("entry"):
            url = str(design.getAttributeNode("url").nodeValue)
            if not os.path.exists(target_path):
                os.makedirs(target_path)
            metrixTools.downloadFile(url, target_path + url.split("file=")[-1])

    except:
        pass
예제 #11
0
def downloadAdditionalFiles(url,
                            target_path,
                            searchpattern="",
                            replacepattern="",
                            forceOverwrite=True,
                            urlparameters=""):
    try:
        data = metrixCore.getWeb(url, True)
        #print(data)

        dom = parseString(data)

        for file in dom.getElementsByTagName('entry'):
            url = str(file.getAttributeNode('url').nodeValue) + urlparameters
            file_name = str(
                file.getAttributeNode('url').nodeValue).split('file=')[-1]
            if not os.path.exists(target_path):
                os.makedirs(target_path)
            if metrixTools.downloadFile(url, target_path + file_name,
                                        searchpattern, replacepattern,
                                        forceOverwrite) == None:
                return False
                metrixTools.log("Error downloading file!")
        return True
    except Exception, e:
        metrixTools.log("No additional files available!", e)
        return False
예제 #12
0
def downloadAdditionalFiles(url, target_path):
    try:
        opener = register_openers()
        params = {}
        datagen, headers = multipart_encode(params)
        request = urllib2.Request(url, datagen, headers)
        data = urllib2.urlopen(request).read()
        dom = parseString(data)
        for design in dom.getElementsByTagName('entry'):
            url = str(design.getAttributeNode('url').nodeValue)
            if not os.path.exists(target_path):
                os.makedirs(target_path)
            metrixTools.downloadFile(url, target_path + url.split('file=')[-1])

    except:
        pass
예제 #13
0
 def GetPicturePath(self):
     try:
         self.image_id = str(self['menu'].l.getCurrentSelection()[0][8])
         self.image_token = str(self['menu'].l.getCurrentSelection()[0][9])
         path = metrixTools.downloadFile(self.screenshotpath + '&image_id=' + self.image_id + '&token=' + self.image_token)
         return path
     except:
         pass
예제 #14
0
def getUpdatedFiles():
	data = metrixCore.getWeb(metrixDefaults.URL_GET_UPDATE_FILES,True)
	dom = parseString(data)
	for files in dom.getElementsByTagName('file'):
		update = False
		path = str(files.getAttributeNode('path').nodeValue)
		url = str(files.getAttributeNode('url').nodeValue)
		date_modified = int(files.getAttributeNode('date_modified').nodeValue)
		if not fileExists(path):
			update = True
		else:
			if int(date_modified) > int(os.path.getmtime(path)):
				update = True
		if update:
			metrixTools.downloadFile(url,path,forceOverwrite=True)
			config.plugins.MetrixUpdater.RebootRequired.value = True
			config.plugins.MetrixUpdater.UpdatePopup_Self.value = True
예제 #15
0
 def GetPicturePath(self):
     try:
         self.image_id = str(self['menu'].l.getCurrentSelection()[0][8])
         self.item_id = str(self['menu'].l.getCurrentSelection()[0][0])
         self.image_token = str(self['menu'].l.getCurrentSelection()[0][9])
         path = ''
         if self.image_id == '':
             path = metrixTools.downloadFile(
                 self.screenshotpath_v2 + '&id=' + self.item_id,
                 path + 'preview.png')
         else:
             path = metrixTools.downloadFile(
                 self.screenshotpath + '&image_id=' + self.image_id +
                 '&token=' + self.image_token, path + 'preview.png')
         return path
     except:
         pass
예제 #16
0
def installSkinPart(id,sp_type,author="",image_link="",date_modified="",isActive=True,isUpdate=False):
	downloadurl = metrixDefaults.URL_GET_SKINPART_XML + "&id="
	downloadmetaurl = metrixDefaults.URL_GET_SKINPART_META + "&id="
	if isUpdate:
		downloadmetaurl = metrixDefaults.URL_GET_SKINPART_META_UPDATE + "&id="
	
	path = config.plugins.MyMetrix.SkinPartPath.value +sp_type+"s/inactive/"+sp_type+"_"+str(id)+"/"
	if not os.path.exists(path):
		os.makedirs(path)
	datapath = metrixTools.downloadFile(downloadurl + str(id)+"&author="+author, path+"data.xml")
	metapath = metrixTools.downloadFile(downloadmetaurl + str(id)+"&author="+author, path +"meta.xml")
	imagepath = metrixTools.downloadFile(image_link+"&width=550", path +"preview.png")
	downloadSkinPartRenderer(id)
	downloadSkinPartConverter(id)
	downloadSkinPartImages(id,path)
	
	if isActive:
		enableSkinPart(path)
예제 #17
0
 def GetPicturePath(self):
     try:
         self.image_id = str(self['menu'].l.getCurrentSelection()[0][8])
         self.image_token = str(self['menu'].l.getCurrentSelection()[0][9])
         path = metrixTools.downloadFile(self.screenshotpath +
                                         '&image_id=' + self.image_id +
                                         '&token=' + self.image_token)
         return path
     except:
         pass
예제 #18
0
def downloadAdditionalFiles(url,target_path,searchpattern="",replacepattern="",forceOverwrite = True,urlparameters=""):
	try:
		data = metrixCore.getWeb(url,True)
		#print(data)
		
		dom = parseString(data)
		
		for file in dom.getElementsByTagName('entry'):
			url = str(file.getAttributeNode('url').nodeValue)+urlparameters
			file_name = str(file.getAttributeNode('url').nodeValue).split('file=')[-1]
			if not os.path.exists(target_path):
				os.makedirs(target_path)
			if metrixTools.downloadFile(url,target_path+file_name,searchpattern,replacepattern,forceOverwrite) == None:
				return False
				metrixTools.log("Error downloading file!")
		return True
	except Exception, e:
		metrixTools.log("No additional files available!",e)
		return False
예제 #19
0
def getUpdatedFiles():
	metrixTools.log("Searching update for build "+metrixDefaults.BUILD+ "...")
	data = metrixCore.getWeb(metrixDefaults.URL_GET_UPDATE_FILES,True)
	dom = parseString(data)
	for update in dom.getElementsByTagName('update'):
		build = str(update.getAttributeNode('build').nodeValue)
		metrixTools.log("Lastest release: build "+build)
		if build > metrixDefaults.BUILD:
			for files in update.getElementsByTagName('file'):
				update = False
				path = str(files.getAttributeNode('path').nodeValue)
				url = str(files.getAttributeNode('url').nodeValue)
				date_modified = int(files.getAttributeNode('date_modified').nodeValue)
				if not fileExists(path):
					update = True
				else:
					if int(date_modified) > int(os.path.getmtime(path)):
						update = True
				if update:
					metrixTools.downloadFile(url,path,forceOverwrite=True)
					config.plugins.MetrixUpdater.RebootRequired.value = True
					config.plugins.MetrixUpdater.UpdatePopup_Self.value = True
	metrixTools.downloadFile(metrixDefaults.URL_IMAGE_LOADING,metrixDefaults.URI_IMAGE_LOADING,forceOverwrite = True)
	metrixTools.downloadFile(metrixDefaults.URL_IMAGE_SPONSOR,metrixDefaults.URI_IMAGE_SPONSOR,forceOverwrite = True)
예제 #20
0
def getUpdatedFiles():
    metrixTools.log("Searching update for build " + metrixDefaults.BUILD + "...")
    data = metrixCore.getWeb(metrixDefaults.URL_GET_UPDATE_FILES, True)
    dom = parseString(data)
    for update in dom.getElementsByTagName("update"):
        build = str(update.getAttributeNode("build").nodeValue)
        metrixTools.log("Lastest release: build " + build)
        if build > metrixDefaults.BUILD:
            for files in update.getElementsByTagName("file"):
                update = False
                path = str(files.getAttributeNode("path").nodeValue)
                url = str(files.getAttributeNode("url").nodeValue)
                date_modified = int(files.getAttributeNode("date_modified").nodeValue)
                if not fileExists(path):
                    update = True
                else:
                    if int(date_modified) > int(os.path.getmtime(path)):
                        update = True
                if update:
                    metrixTools.downloadFile(url, path, forceOverwrite=True)
                    config.plugins.MetrixUpdater.RebootRequired.value = True
                    config.plugins.MetrixUpdater.UpdatePopup_Self.value = True
    metrixTools.downloadFile(metrixDefaults.URL_IMAGE_LOADING, metrixDefaults.URI_IMAGE_LOADING, forceOverwrite=True)
    metrixTools.downloadFile(metrixDefaults.URL_IMAGE_SPONSOR, metrixDefaults.URI_IMAGE_SPONSOR, forceOverwrite=True)