make use of eventinfo hook
authorMoritz Venn <ritzmo@users.schwerkraft.elitedvb.net>
Mon, 8 Dec 2008 19:14:57 +0000 (19:14 +0000)
committerMoritz Venn <ritzmo@users.schwerkraft.elitedvb.net>
Mon, 8 Dec 2008 19:14:57 +0000 (19:14 +0000)
autotimer/src/AutoTimerEditor.py
autotimer/src/plugin.py

index 750b0d6..58b4c28 100644 (file)
@@ -6,6 +6,7 @@ from . import _
 from Screens.Screen import Screen
 from Components.ConfigList import ConfigListScreen
 from Screens.ChannelSelection import SimpleChannelSelection
+from Screens.EpgSelection import EPGSelection
 from Screens.MessageBox import MessageBox
 from Screens.ChoiceBox import ChoiceBox
 
@@ -76,7 +77,24 @@ class SimpleBouquetSelection(SimpleChannelSelection):
                        # Asking the user if this is what he wants might be better though
                        self.close(self.servicePath[-1])
 
-class AutoTimerEditorBase():
+class AutoTimerEPGSelection(EPGSelection):
+       def __init__(self, *args):
+               EPGSelection.__init__(*args)
+               self.skinName = "EPGSelection"
+
+       def infoKeyPressed(self):
+               self.timerAdd()
+
+       def timerAdd(self):
+               cur = self["list"].getCurrent()
+               evt = cur[0]
+               sref = cur[1]
+               if not evt:
+                       return
+
+               addAutotimerFromEvent(self.session, evt = evt, service = sref)
+
+class AutoTimerEditorBase:
        """ Base Class for all Editors """
        def __init__(self, timer, editingDefaults = False):
                # Keep Timer
@@ -971,7 +989,7 @@ def addAutotimerFromEvent(session, evt = None, service = None):
 
                sref = ServiceReference(service)
        if evt:
-                # timespan defaults to +- 1h
+               # timespan defaults to +- 1h
                begin = evt.getBeginTime()-3600
                end = begin + evt.getDuration()+7200
        else:
index 5f4324e..47c90b2 100644 (file)
@@ -132,6 +132,12 @@ def movielist(session, service, **kwargs):
        from AutoTimerEditor import addAutotimerFromService
        addAutotimerFromService(session, service)
 
+# Event Info
+def eventinfo(session, servicelist, **kwargs):
+       from AutoTimerEditor import AutoTimerEPGSelection
+       ref = session.nav.getCurrentlyPlayingServiceReference()
+       session.open(AutoTimerEPGSelection, ref)
+
 def Plugins(**kwargs):
        from Plugins.Plugin import PluginDescriptor
 
@@ -139,6 +145,7 @@ def Plugins(**kwargs):
                PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart),
                PluginDescriptor(name="AutoTimer", description = _("Edit Timers and scan for new Events"), where = PluginDescriptor.WHERE_PLUGINMENU, icon = "plugin.png", fnc = main),
                PluginDescriptor(name="AutoTimer", description = _("Edit Timers and scan for new Events"), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc = main),
-               PluginDescriptor(name="AutoTimer", description= _("Add AutoTimer..."), where = PluginDescriptor.WHERE_MOVIELIST, fnc = movielist)
+               PluginDescriptor(name="AutoTimer", description= _("Add AutoTimer..."), where = PluginDescriptor.WHERE_MOVIELIST, fnc = movielist),
+               PluginDescriptor(name="AutoTimer", description= _("Add AutoTimer..."), where = PluginDescriptor.WHERE_EVENTINFO, fnc = eventinfo),
        ]