1 from Plugins.Plugin import PluginDescriptor
2 from GraphMultiEpg import GraphMultiEPG
3 from Screens.ChannelSelection import BouquetSelector
4 from enigma import eServiceCenter, eServiceReference
5 from ServiceReference import ServiceReference
14 def zapToService(service):
15 if not service is None:
16 if Servicelist.getRoot() != epg_bouquet: #already in correct bouquet?
17 Servicelist.clearPath()
18 if Servicelist.bouquet_root != epg_bouquet:
19 Servicelist.enterPath(Servicelist.bouquet_root)
20 Servicelist.enterPath(epg_bouquet)
21 Servicelist.setCurrentSelection(service) #select the service in Servicelist
24 def getBouquetServices(bouquet):
26 Servicelist = eServiceCenter.getInstance().list(bouquet)
27 if not Servicelist is None:
29 service = Servicelist.getNext()
30 if not service.valid(): #check if end of list
32 if service.flags & (eServiceReference.isDirectory | eServiceReference.isMarker): #ignore non playable services
34 services.append(ServiceReference(service))
43 def closed(ret=False):
44 closedScreen = dlg_stack.pop()
46 if bouquetSel and closedScreen == bouquetSel:
49 if ret and dlgs > 0: # recursive close wished
50 dlg_stack[dlgs-1].close(dlgs > 1)
54 def openBouquetEPG(bouquet):
55 services = getBouquetServices(bouquet)
59 dlg_stack.append(Session.openWithCallback(closed, GraphMultiEPG, services, zapToService, changeBouquetCB))
63 def changeBouquetCB(direction, epg):
69 bouquet = bouquetSel.getCurrent()
70 services = getBouquetServices(bouquet)
74 epg.setServices(services)
76 def main(session, servicelist, **kwargs):
80 Servicelist = servicelist
81 bouquets = Servicelist.getBouquetList()
86 if cnt > 1: # show bouquet list
88 bouquetSel = Session.openWithCallback(closed, BouquetSelector, bouquets, openBouquetEPG, enableWrapAround=True)
89 dlg_stack.append(bouquetSel)
91 if not openBouquetEPG(bouquets[0][1]):
94 def Plugins(**kwargs):
95 name = _("Graphical Multi EPG")
96 descr = _("A graphical EPG for all services of an specific bouquet")
97 return [ PluginDescriptor(name=name, description=descr, where = PluginDescriptor.WHERE_EVENTINFO, fnc=main),
98 PluginDescriptor(name=name, description=descr, where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main) ]