Example #1
0
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
Example #2
0
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
Example #3
0
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
 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
Example #5
0
    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