def getLcdPiconName(serviceName):
#remove the path and name fields, and replace ':' by '_'
sname = '_'.join(GetWithAlternative(serviceName).split(':', 10)[:10])
pngname = findLcdPicon(sname)
if not pngname:
fields = sname.split('_', 3)
if len(fields) > 2 and fields[2] != '1': #fallback to 1 for services with different service types
fields[2] = '1'
if len(fields) > 0 and fields[0] != '1': #fallback to 1 for other reftypes
fields[0] = '1'
pngname = findLcdPicon('_'.join(fields))
if not pngname: # picon by channel name
name = ServiceReference(serviceName).getServiceName()
name = unicodedata.normalize('NFKD', unicode(name, 'utf_8', errors='ignore')).encode('ASCII', 'ignore')
name = re.sub('[^a-z0-9]', '', name.replace('&', 'and').replace('+', 'plus').replace('*', 'star').lower())
if len(name) > 0:
pngname = findLcdPicon(name)
if not pngname and len(name) > 2 and name.endswith('hd'):
pngname = findLcdPicon(name[:-2])
return pngname
评论列表
文章目录