1 from Components.Sources.Source import Source
2 from ServiceReference import ServiceReference
3 from enigma import eServiceCenter, eServiceReference, eEPGCache
12 def __init__(self, navcore, func=NOW):
15 self.navcore = navcore
16 self.epgcache = eEPGCache.getInstance()
19 def handleCommand(self, cmd):
23 if not self.command is None:
24 if self.func is self.TITLE:
25 func = self.searchEvent
26 elif self.func is self.SERVICE:
27 func = self.getEPGofService
28 elif self.func is self.NOW:
30 elif self.func is self.NEXT:
31 func = self.getEPGNext
32 elif self.func is self.BOUQUET:
33 func = self.getEPGofBouquet
35 return func(self.command)
39 def getEPGNow(self, ref):
40 return self.getEPGNowNext(ref)
42 def getEPGNext(self, ref):
43 return self.getEPGNowNext(ref, False)
45 def getEPGNowNext(self, ref, now=True):
46 print "getting EPG NOW/NEXT", ref
50 search.append((ref, 0, -1))
52 search.append((ref, 1, -1))
54 events = self.epgcache.lookupEvent(search)
59 serviceHandler = eServiceCenter.getInstance()
60 list = serviceHandler.list(eServiceReference(ref))
61 services = list and list.getContent('S')
64 if len(services) > 0: # It's a Bouquet
65 for service in services:
67 search.append((service,0,-1))
69 search.append((service,1,-1))
72 events = self.epgcache.lookupEvent(search)
79 def getEPGofService(self, ref, options = 'IBDTSERN'):
80 print "getting EPG of Service", ref
81 events = self.epgcache.lookupEvent([options ,(ref,0,-1,-1)]);
87 def getEPGofBouquet(self, bouqetref):
88 print "[EPG.py] getting EPG for Bouquet", bouqetref
90 serviceHandler = eServiceCenter.getInstance()
91 sl = serviceHandler.list(eServiceReference(bouqetref))
92 services = sl and sl.getContent('S')
96 for service in services:
97 search.append((service,0,-1,-1))
99 events = self.epgcache.lookupEvent(search)
107 def searchEvent(self, cmd):
108 print "getting EPG by title",cmd
109 events = self.epgcache.search(('IBDTSERN',256,eEPGCache.PARTIAL_TITLE_SEARCH,cmd,1));
115 list = property(do_func)
116 lut = {"EventID": 0, "TimeStart": 1,"Duration": 2, "Title": 3, "Description": 4, "DescriptionExtended": 5, "ServiceReference": 6, "ServiceName": 7 }