diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2007-08-02 14:12:41 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2007-08-02 14:12:41 +0000 |
| commit | 8f957309b2bfb7df00c123f91ebb6d1d302848ba (patch) | |
| tree | 7df73bd51cf08d22540494b45f3b8b74cb2cb44a /lib/python/Components/Converter | |
| parent | a325761a19b1df3a10a3cc5cb0667dd95323df54 (diff) | |
| download | enigma2-8f957309b2bfb7df00c123f91ebb6d1d302848ba.tar.gz enigma2-8f957309b2bfb7df00c123f91ebb6d1d302848ba.zip | |
ServiceName converter now can handle iPlayableService's and
ServiceReference's
Diffstat (limited to 'lib/python/Components/Converter')
| -rw-r--r-- | lib/python/Components/Converter/ServiceName.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/python/Components/Converter/ServiceName.py b/lib/python/Components/Converter/ServiceName.py index fcabe427..97b81f60 100644 --- a/lib/python/Components/Converter/ServiceName.py +++ b/lib/python/Components/Converter/ServiceName.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- from Components.Converter.Converter import Converter -from enigma import iServiceInformation, iPlayableService +from enigma import iServiceInformation, iPlayableService, iPlayableServicePtr from Components.Element import cached class ServiceName(Converter, object): @@ -17,26 +17,31 @@ class ServiceName(Converter, object): else: self.type = self.NAME - def getServiceInfoValue(self, info, what): - v = info.getInfo(what) - if v != -2: + def getServiceInfoValue(self, info, what, ref=None): + v = ref and info.getInfo(ref, what) or info.getInfo(what) + if v != iServiceInformation.resIsString: return "N/A" - return info.getInfoString(what) + return ref and info.getInfoString(ref, what) or info.getInfoString(what) @cached def getText(self): service = self.source.service - info = service and service.info() + if isinstance(service, iPlayableServicePtr): + info = service and service.info() + ref = None + else: # reference + info = service and self.source.info + ref = service if info is None: return "" - if self.type == self.NAME: - return info.getName().replace('\xc2\x86', '').replace('\xc2\x87', '') + name = ref and info.getName(ref) or info.getName() + return name.replace('\xc2\x86', '').replace('\xc2\x87', '') elif self.type == self.PROVIDER: - return self.getServiceInfoValue(info, iServiceInformation.sProvider) + return self.getServiceInfoValue(info, iServiceInformation.sProvider, ref) elif self.type == self.REFERENCE: - return self.getServiceInfoValue(info, iServiceInformation.sServiceref) - + return self.getServiceInfoValue(info, iServiceInformation.sServiceref, ref) + text = property(getText) def changed(self, what): |
