Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 4
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