コード例 #1
0
ファイル: FindPicon.py プロジェクト: ostende/EGAMI-2
def findPicon(service):
    pngname = ''
    sname = service
    s_name = sname
    if sname.startswith('1:134'):
        sname = GetWithAlternative(service)
    for protocol in ('http', 'rtmp', 'rtsp', 'mms', 'rtp'):
        pos = sname.rfind(':' + protocol)
        if pos != -1:
            sname = sname.split(protocol)[0]
            break

    pos = sname.rfind(':')
    if pos != -1:
        sname = sname[:pos].rstrip(':').replace(':', '_')
    pngname = nameCache.get(sname, '')
    if pngname == '':
        pngname = findFile(sname)
        if pngname == '':
            serviceHandler = eServiceCenter.getInstance()
            service = eServiceReference(s_name)
            if service and service is not None:
                info = serviceHandler.info(service)
                if info and info is not None:
                    service_name = info.getName(service).replace(
                        '\xc2\x86', '').replace('\xc2\x87',
                                                '').replace('/', '_')
                    print service_name
                    pngname = findFile(service_name)
        if pngname == '' and sname.startswith('4097_'):
            pngname = findFile(sname.replace('4097_', '1_', 1))
        if pngname != '':
            nameCache[sname] = pngname
    return pngname
コード例 #2
0
ファイル: FindPicon.py プロジェクト: linuxbox10/droid-e2
def findPicon(service):
    pngname = ""
    sname = service
    s_name = sname
    if sname.startswith("1:134"):
        sname = GetWithAlternative(service)
    for protocol in ("http", "rtmp", "rtsp", "mms", "rtp"):
        pos = sname.rfind(':' + protocol)
        if pos != -1:
            sname = sname.split(protocol)[0]
            break
    pos = sname.rfind(':')
    if pos != -1:
        sname = sname[:pos].rstrip(':').replace(':', '_')
    pngname = nameCache.get(sname, "")
    if pngname == "":
        pngname = findFile(sname)
        if pngname == "":
            serviceHandler = eServiceCenter.getInstance()
            service = eServiceReference(s_name)
            if service and service is not None:
                info = serviceHandler.info(service)
                if info and info is not None:
                    service_name = info.getName(service).replace(
                        '\xc2\x86', '').replace('\xc2\x87',
                                                '').replace('/', '_')
                    print service_name
                    pngname = findFile(service_name)
        if pngname == "" and sname.startswith("4097_"):
            pngname = findFile(sname.replace("4097_", "1_", 1))
        if pngname != "":
            nameCache[sname] = pngname
    return pngname
コード例 #3
0
	def changed(self, what):
		if self.instance:
			pngname = ""
			if what[0] != self.CHANGED_CLEAR:
				sname = self.source.text
				if sname.startswith("1:134"):
					sname = GetWithAlternative(self.source.text)
				pos = sname.rfind(':http')
				if pos != -1:
					sname = sname.split('http')[0]
				# strip all after last :
				pos = sname.rfind(':')
				if pos != -1:
					sname = sname[:pos].rstrip(':').replace(':','_')
				pngname = self.nameCache.get(sname, "")
				if pngname == "":
					pngname = self.findPicon(sname)
					if pngname != "":
						self.nameCache[sname] = pngname
			if pngname == "": # no XPicons for service found
				self.instance.hide()
			else:
				self.instance.show()
			if pngname != "" and self.pngname != pngname:
				self.instance.setPixmapFromFile(pngname)
				self.pngname = pngname
コード例 #4
0
ファイル: Picon.py プロジェクト: kingvuplus/test2
	def changed(self, what):
		if self.instance:
			pngname = ""
			if what[0] != self.CHANGED_CLEAR:
				sname = self.source.text
				if sname.startswith("1:134"):
					sname = GetWithAlternative(self.source.text)
				pos = sname.rfind(':http')
				if pos != -1:
					sname = sname.split('http')[0]
				# strip all after last :
				pos = sname.rfind(':')
				if pos != -1:
					sname = sname[:pos].rstrip(':').replace(':','_')
				pngname = self.nameCache.get(sname, "")
				if pngname == "":
					pngname = self.findPicon(sname)
					if pngname != "":
						self.nameCache[sname] = pngname
			if pngname == "": # no picon for service found
				self.instance.hide()
			else:
				self.instance.show()
			if pngname != "" and self.pngname != pngname:
				if config.usage.picon_scale.value:
					self.instance.setScale(2)
				else:
					self.instance.setScale(0)
				self.instance.setPixmapFromFile(pngname)
				self.pngname = pngname
コード例 #5
0
ファイル: FindPicon.py プロジェクト: OpenLD/enigma2
def findPicon(service):
	pngname = ""
	sname = service
	s_name = sname
	if sname.startswith("1:134"):
		sname = GetWithAlternative(service)
	for protocol in ("http", "rtmp", "rtsp", "mms", "rtp"):
		pos = sname.rfind(':' + protocol )
		if pos != -1:
			sname = sname.split(protocol)[0]
			break
	pos = sname.rfind(':')
	if pos != -1:
		sname = sname[:pos].rstrip(':').replace(':','_')
	pngname = nameCache.get(sname, "")
	if pngname == "":
		pngname = findFile(sname)
		if pngname == "":
			serviceHandler = eServiceCenter.getInstance()
			service = eServiceReference(s_name)
			if service and service is not None:
				info = serviceHandler.info(service)
				if info and info is not None:
					service_name = info.getName(service).replace('\xc2\x86','').replace('\xc2\x87', '').replace('/', '_')
					print service_name
					pngname = findFile(service_name)
		if pngname == "" and sname.startswith("4097_"):
			pngname = findFile(sname.replace("4097_", "1_", 1))
		if pngname != "":
			nameCache[sname] = pngname
	return pngname
コード例 #6
0
ファイル: FindPicon.py プロジェクト: kingvuplus/test2
def findPicon(service):
	pngname = ""
	sname = service
	if sname.startswith("1:134"):
		sname = GetWithAlternative(service)
	pos = sname.rfind(':http')
	if pos != -1:
		sname = sname.split('http')[0]
	pos = sname.rfind(':')
	if pos != -1:
		sname = sname[:pos].rstrip(':').replace(':','_')
	pngname = nameCache.get(sname, "")
	if pngname == "":
		pngname = findFile(sname)
		if pngname != "":
			nameCache[sname] = pngname
	return pngname
コード例 #7
0
def findPicon(service):
    pngname = ""
    sname = service
    if sname.startswith("1:134"):
        sname = GetWithAlternative(service)
    pos = sname.rfind(':http')
    if pos != -1:
        sname = sname.split('http')[0]
    pos = sname.rfind(':')
    if pos != -1:
        sname = sname[:pos].rstrip(':').replace(':', '_')
    pngname = nameCache.get(sname, "")
    if pngname == "":
        pngname = findFile(sname)
        if pngname != "":
            nameCache[sname] = pngname
    return pngname
コード例 #8
0
ファイル: iFlatPicon2.py プロジェクト: posi1/iFlatFHD-skin
    def changed(self, what):
        if self.instance:
            pngname = ''
            if what[0] != self.CHANGED_CLEAR:
                sname = self.source.text
                s_name = sname
                if sname.startswith('1:134'):
                    sname = GetWithAlternative(self.source.text)
                for protocol in ('http', 'rtmp', 'rtsp', 'mms', 'rtp'):
                    pos = sname.rfind(':' + protocol)
                    if pos != -1:
                        sname = sname.split(protocol)[0]
                        break

                pos = sname.rfind(':')
                if pos != -1:
                    sname = sname[:pos].rstrip(':').replace(':', '_')
                pngname = self.nameCache.get(sname, '')
                if pngname == '':
                    pngname = self.findPicon(sname)
                    if pngname == '':
                        serviceHandler = eServiceCenter.getInstance()
                        service = eServiceReference(s_name)
                        if service and service is not None:
                            info = serviceHandler.info(service)
                            if info and info is not None:
                                service_name = info.getName(service).replace(
                                    '\xc2\x86',
                                    '').replace('\xc2\x87',
                                                '').replace('/', '_')
                                pngname = self.findPicon(service_name)
                    if pngname == '' and sname.startswith('4097_'):
                        pngname = self.findPicon(
                            sname.replace('4097_', '1_', 1))
                    if pngname != '':
                        self.nameCache[sname] = pngname
            if pngname == '':
                self.instance.hide()
            else:
                self.instance.show()
            if pngname != '' and self.pngname != pngname:
                self.instance.setScale(2)
                self.instance.setPixmapFromFile(pngname)
                self.pngname = pngname
コード例 #9
0
def getPicon(sname):
	sname = GetWithAlternative(sname)
	if sname is not None:
		pos = sname.rfind(':')
	else:
		return "/images/default_picon.png"
		
	if pos != -1:
		sname = sname[:pos].rstrip(':').replace(':','_') + ".png"
	filename = getPiconPath() + sname
	if fileExists(filename):
		return "/picon/" + sname
	return "/images/default_picon.png"
コード例 #10
0
def getPicon(sname):
    sname = GetWithAlternative(sname)
    if sname is not None:
        pos = sname.rfind(':')
    else:
        return "/images/default_picon.png"

    if pos != -1:
        sname = sname[:pos].rstrip(':').replace(':', '_') + ".png"
    filename = getPiconPath() + sname
    if fileExists(filename):
        return "/picon/" + sname
    return "/images/default_picon.png"
コード例 #11
0
 def changed(self, what):
     if self.instance:
         pngname = ""
         if what[0] != self.CHANGED_CLEAR:
             sname = self.source.text
             pos = sname.rfind(':http')
             sname = sname.split('http')[0]
             s_name = sname
             if sname.startswith("1:134"):
                 sname = GetWithAlternative(self.source.text)
             if sname.startswith("4097:0"):
                 sname = self.source.text
                 pos = sname.rfind(':http')
                 if pos != -1:
                     sname = sname.split('http')[0]
                 pos = sname.rfind(':rtmp')
                 if pos != -1:
                     sname = sname.split('rtmp')[0]
                 pos = sname.rfind(':rtsp')
                 if pos != -1:
                     sname = sname.split('rtsp')[0]
                 pos = sname.rfind(':rtp')
                 if pos != -1:
                     sname = sname.split('rtp')[0]
                 pos = sname.rfind(':mms')
                 if pos != -1:
                     sname = sname.split('mms')[0]
             pos = sname.rfind(':')
             if pos != -1:
                 sname = sname[:pos].rstrip(':').replace(':', '_')
             pngname = self.nameCache.get(sname, "")
             if pngname == "":
                 pngname = self.findPicon(sname)
                 if pngname == "":
                     serviceHandler = eServiceCenter.getInstance()
                     service = eServiceReference(s_name)
                     if service and service is not None:
                         info = serviceHandler.info(service)
                         if info and info is not None:
                             service_name = info.getName(service).replace(
                                 '\xc2\x86',
                                 '').replace('\xc2\x87',
                                             '').replace('/', '_')
                             pngname = self.findPicon(service_name)
                 if pngname != "":
                     self.nameCache[sname] = pngname
         if pngname == "":  # no picon for service found
             self.instance.hide()
         else:
             self.instance.show()
         if pngname != "" and self.pngname != pngname:
             if config.usage.picon_scale.value:
                 self.instance.setScale(2)
             else:
                 self.instance.setScale(0)
             self.instance.setPixmapFromFile(pngname)
             self.pngname = pngname