allow to import from epg (context menu in overview)
authorMoritz Venn <ritzmo@users.schwerkraft.elitedvb.net>
Mon, 19 Jan 2009 12:30:03 +0000 (12:30 +0000)
committerMoritz Venn <ritzmo@users.schwerkraft.elitedvb.net>
Mon, 19 Jan 2009 12:30:03 +0000 (12:30 +0000)
autotimer/src/AutoTimerEditor.py
autotimer/src/AutoTimerOverview.py

index bb603ce..6ac6e49 100644 (file)
@@ -31,8 +31,8 @@ from time import localtime, mktime
 # Show ServiceName instead of ServiceReference
 from ServiceReference import ServiceReference
 
-# addAutotimerFromService
-from enigma import eServiceCenter, iServiceInformation
+# addAutotimerFromService, AutoTimerChannelSelection
+from enigma import eServiceCenter, eServiceReference, iServiceInformation
 
 # Default Record Directory
 from Tools import Directories
@@ -71,7 +71,7 @@ class SimpleBouquetSelection(SimpleChannelSelection):
                SimpleChannelSelection.__init__(self, session, title)
                self.skinName = "SimpleChannelSelection"
 
-       def channelSelected(self): # just return selected service
+       def channelSelected(self):
                ref = self.getCurrentSelection()
                if (ref.flags & 7) == 7:
                        self.close(ref)
@@ -80,6 +80,28 @@ class SimpleBouquetSelection(SimpleChannelSelection):
                        # Asking the user if this is what he wants might be better though
                        self.close(self.servicePath[-1])
 
+class AutoTimerChannelSelection(SimpleChannelSelection):
+       def __init__(self, session, autotimer):
+               SimpleChannelSelection.__init__(self, session, _("Channel Selection"))
+               self.skinName = "SimpleChannelSelection"
+               self.autotimer = autotimer
+
+               self["ChannelSelectEPGActions"] = ActionMap(["ChannelSelectEPGActions"],
+                       {
+                               "showEPGList": self.channelSelected
+                       }
+               )
+
+       def channelSelected(self):
+               ref = self.getCurrentSelection()
+               if (ref.flags & 7) == 7:
+                       self.enterPath(ref)
+               elif not (ref.flags & eServiceReference.isMarker):
+                       self.session.open(
+                               AutoTimerEPGSelection,
+                               ref
+                       )
+
 class AutoTimerEPGSelection(EPGSelection):
        def __init__(self, *args):
                EPGSelection.__init__(self, *args)
index 3fdfe64..f749aad 100644 (file)
@@ -6,7 +6,7 @@ from Screens.Screen import Screen
 from Screens.HelpMenu import HelpableScreen
 from Screens.MessageBox import MessageBox
 from Screens.ChoiceBox import ChoiceBox
-from AutoTimerEditor import AutoTimerEditor
+from AutoTimerEditor import AutoTimerEditor, AutoTimerChannelSelection
 from AutoTimerSettings import AutoTimerSettings
 from AutoTimerPreview import AutoTimerPreview
 from AutoTimerImporter import AutoTimerImportSelector
@@ -168,7 +168,8 @@ class AutoTimerOverview(Screen, HelpableScreen):
        def menu(self):
                list = [
                        (_("Preview"), "preview"),
-                       (_("Import"), "import"),
+                       (_("Import existing Timer"), "import"),
+                       (_("Import from EPG"), "import_epg"),
                        (_("Setup"), "setup"),
                        (_("Edit new timer defaults"), "defaults"),
                ]
@@ -202,6 +203,11 @@ class AutoTimerOverview(Screen, HelpableScreen):
                                        AutoTimerImportSelector,
                                        newTimer
                                )
+                       elif ret == "import_epg":
+                               self.session.open(
+                                       AutoTimerChannelSelection,
+                                       self.autotimer
+                               )
                        elif ret == "setup":
                                self.session.open(
                                        AutoTimerSettings