1 from Components.PerServiceDisplay import PerServiceBase
2 from Components.Element import cached
3 from enigma import iPlayableService, iServiceInformation, eServiceReference, eEPGCache
4 from Source import Source
6 class EventInfo(PerServiceBase, Source, object):
10 def __init__(self, navcore, now_or_next):
12 PerServiceBase.__init__(self, navcore,
14 iPlayableService.evStart: self.gotEvent,
15 iPlayableService.evUpdatedEventInfo: self.gotEvent,
16 iPlayableService.evEnd: self.gotEvent
18 self.now_or_next = now_or_next
19 self.epgQuery = eEPGCache.getInstance().lookupEventTime
23 service = self.navcore.getCurrentService()
24 info = service and service.info()
25 ret = info and info.getEvent(self.now_or_next)
27 refstr = info.getInfoString(iServiceInformation.sServiceref)
28 ret = self.epgQuery(eServiceReference(refstr), -1, self.now_or_next and 1 or 0)
31 event = property(getEvent)
33 def gotEvent(self, what):
34 if what == iPlayableService.evEnd:
35 self.changed((self.CHANGED_CLEAR,))
37 self.changed((self.CHANGED_ALL,))
40 PerServiceBase.destroy(self)