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, bouqetref):
40 return self.getEPGNowNext(bouqetref)
42 def getEPGNext(self, bouqetref):
43 return self.getEPGNowNext(bouqetref, False)
45 def getEPGNowNext(self, bouqetref, now=True):
46 print "getting EPG NOW/NEXT", bouqetref
47 serviceHandler = eServiceCenter.getInstance()
48 list = serviceHandler.list(eServiceReference(bouqetref))
49 services = list and list.getContent('S')
52 for service in services:
54 search.append((service,0,-1))
56 search.append((service,1,-1))
58 events = self.epgcache.lookupEvent(search)
64 def getEPGofService(self, ref, options = 'IBDTSERN'):
65 print "getting EPG of Service", cmd
66 events = self.epgcache.lookupEvent([options ,(ref,0,-1,-1)]);
72 def getEPGofBouquet(self, bouqetref):
73 print "[EPG.py] getting EPG for Bouquet", bouqetref
75 serviceHandler = eServiceCenter.getInstance()
76 sl = serviceHandler.list(eServiceReference(bouqetref))
77 services = sl and sl.getContent('S')
81 for service in services:
82 search.append((service,0,-1,-1))
84 events = self.epgcache.lookupEvent(search)
92 def searchEvent(self, cmd):
93 print "getting EPG by title",cmd
94 events = self.epgcache.search(('IBDTSERN',256,eEPGCache.PARTIAL_TITLE_SEARCH,cmd,1));
100 list = property(do_func)
101 lut = {"EventID": 0, "TimeStart": 1,"Duration": 2, "Title": 3, "Description": 4, "DescriptionExtended": 5, "ServiceReference": 6, "ServiceName": 7 }