aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2007-07-31 11:00:01 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2007-07-31 11:00:01 +0000
commitb1d4a0b06608906144928198f66062705a8041fd (patch)
treecd68fda9eb954ae6e4226fb250265cd036069d1b /lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py
parent6db060dce242cd1990ae82f518ffa0beaee74d06 (diff)
downloadenigma2-b1d4a0b06608906144928198f66062705a8041fd.tar.gz
enigma2-b1d4a0b06608906144928198f66062705a8041fd.zip
add graphical multiepg plugin (like e1)
yet it is just startable via blue button menu
Diffstat (limited to 'lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py')
-rw-r--r--lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py96
1 files changed, 96 insertions, 0 deletions
diff --git a/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py b/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py
new file mode 100644
index 00000000..a247a618
--- /dev/null
+++ b/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py
@@ -0,0 +1,96 @@
+from Plugins.Plugin import PluginDescriptor
+from GraphMultiEpg import GraphMultiEPG
+from Screens.ChannelSelection import BouquetSelector
+from enigma import eServiceCenter, eServiceReference
+from ServiceReference import ServiceReference
+
+Session = None
+Servicelist = None
+
+bouquetSel = None
+epg_bouquet = None
+dlg_stack = [ ]
+
+def zapToService(service):
+ if not service is None:
+ if Servicelist.getRoot() != epg_bouquet: #already in correct bouquet?
+ Servicelist.clearPath()
+ if Servicelist.bouquet_root != epg_bouquet:
+ Servicelist.enterPath(Servicelist.bouquet_root)
+ Servicelist.enterPath(epg_bouquet)
+ Servicelist.setCurrentSelection(service) #select the service in Servicelist
+ Servicelist.zap()
+
+def getBouquetServices(bouquet):
+ services = [ ]
+ Servicelist = eServiceCenter.getInstance().list(bouquet)
+ if not Servicelist is None:
+ while True:
+ service = Servicelist.getNext()
+ if not service.valid(): #check if end of list
+ break
+ if service.flags & (eServiceReference.isDirectory | eServiceReference.isMarker): #ignore non playable services
+ continue
+ services.append(ServiceReference(service))
+ return services
+
+def cleanup():
+ global Session
+ Session = None
+ global Servicelist
+ Servicelist = None
+
+def closed(ret=False):
+ closedScreen = dlg_stack.pop()
+ if bouquetSel and closedScreen == bouquetSel:
+ global bouquetSel
+ bouquetSel = None
+ dlgs=len(dlg_stack)
+ if ret and dlgs > 0: # recursive close wished
+ dlg_stack[dlgs-1].close(dlgs > 1)
+ if dlgs <= 0:
+ cleanup()
+
+def openBouquetEPG(bouquet):
+ services = getBouquetServices(bouquet)
+ if len(services):
+ global epg_bouquet
+ epg_bouquet = bouquet
+ dlg_stack.append(Session.openWithCallback(closed, GraphMultiEPG, services, zapToService, changeBouquetCB))
+ return True
+ return False
+
+def changeBouquetCB(direction, epg):
+ if bouquetSel:
+ if direction > 0:
+ bouquetSel.down()
+ else:
+ bouquetSel.up()
+ bouquet = bouquetSel.getCurrent()
+ services = getBouquetServices(bouquet)
+ if len(services):
+ epg_bouquet = bouquet
+ epg.setServices(services)
+
+def main(session, servicelist, **kwargs):
+ global Session
+ Session = session
+ global Servicelist
+ Servicelist = servicelist
+ bouquets = Servicelist.getBouquetList()
+ if bouquets is None:
+ cnt = 0
+ else:
+ cnt = len(bouquets)
+ if cnt > 1: # show bouquet list
+ global bouquetSel
+ bouquetSel = Session.openWithCallback(closed, BouquetSelector, bouquets, openBouquetEPG, enableWrapAround=True)
+ dlg_stack.append(bouquetSel)
+ elif cnt == 1:
+ if not openBouquetEPG(bouquets[0][1]):
+ cleanup()
+
+def Plugins(**kwargs):
+ name = _("Graphical Multi EPG")
+ descr = _("A graphical EPG for all services of an specific bouquet")
+ return [ PluginDescriptor(name=name, description=descr, where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main) ]