1 from enigma import iPlayableService
2 from Source import Source
3 from Components.PerServiceDisplay import PerServiceBase
5 class FrontendInfo(Source, PerServiceBase):
6 def __init__(self, service_source = None, frontend_source = None, navcore = None):
10 PerServiceBase.__init__(self, navcore,
12 iPlayableService.evTunedIn: self.updateFrontendData,
13 iPlayableService.evEnd: self.serviceEnd
15 self.service_source = service_source
16 self.frontend_source = frontend_source
17 self.updateFrontendData()
22 self.slot_number = self.frontend_type = None
23 self.changed((self.CHANGED_CLEAR, ))
25 def updateFrontendData(self):
26 data = self.getFrontendData()
28 self.slot_number = self.frontend_type = None
30 self.slot_number = data.get("tuner_number")
31 self.frontend_type = data.get("tuner_type")
32 self.changed((self.CHANGED_ALL, ))
34 def getFrontendData(self):
35 if self.frontend_source:
36 frontend = self.frontend_source()
39 frontend.getFrontendData(dict)
41 elif self.service_source:
42 service = self.navcore and self.service_source()
43 feinfo = service and service.frontendInfo()
44 return feinfo and feinfo.getFrontendData()
46 service = self.navcore.getCurrentService()
47 feinfo = service and service.frontendInfo()
48 return feinfo and feinfo.getFrontendData()
53 if not self.frontend_source and not self.service_source:
54 PerServiceBase.destroy(self)