add ServiceReference to ServiceName converter, event id to EventName (patch by reichi)
[enigma2.git] / lib / python / Components / Converter / ServiceName.py
index cffe494..fcabe42 100644 (file)
@@ -1,14 +1,19 @@
+# -*- coding: utf-8 -*-
 from Components.Converter.Converter import Converter
 from enigma import iServiceInformation, iPlayableService
+from Components.Element import cached
 
 class ServiceName(Converter, object):
        NAME = 0
        PROVIDER = 1
+       REFERENCE = 2
 
        def __init__(self, type):
                Converter.__init__(self, type)
                if type == "Provider":
                        self.type = self.PROVIDER
+               elif type == "Reference":
+                       self.type = self.REFERENCE
                else:
                        self.type = self.NAME
 
@@ -18,6 +23,7 @@ class ServiceName(Converter, object):
                        return "N/A"
                return info.getInfoString(what)
 
+       @cached
        def getText(self):
                service = self.source.service
                info = service and service.info()
@@ -25,10 +31,12 @@ class ServiceName(Converter, object):
                        return ""
                
                if self.type == self.NAME:
-                       return info.getName()
+                       return info.getName().replace('\xc2\x86', '').replace('\xc2\x87', '')
                elif self.type == self.PROVIDER:
                        return self.getServiceInfoValue(info, iServiceInformation.sProvider)
-
+               elif self.type == self.REFERENCE:
+                       return self.getServiceInfoValue(info, iServiceInformation.sServiceref)
+               
        text = property(getText)
 
        def changed(self, what):