allow to force autotimer to parse epg when cleaning up (== finished with refresh)
authorMoritz Venn <ritzmo@users.schwerkraft.elitedvb.net>
Fri, 27 Mar 2009 19:14:40 +0000 (19:14 +0000)
committerMoritz Venn <ritzmo@users.schwerkraft.elitedvb.net>
Fri, 27 Mar 2009 19:14:40 +0000 (19:14 +0000)
epgrefresh/src/EPGRefresh.py
epgrefresh/src/EPGRefreshConfiguration.py
epgrefresh/src/plugin.py

index 45918c2..20ef3aa 100644 (file)
@@ -217,6 +217,28 @@ class EPGRefresh:
                config.plugins.epgrefresh.lastscan.value = int(time())
                config.plugins.epgrefresh.lastscan.save()
 
+               # Eventually force autotimer to parse epg
+               if config.plugins.epgrefresh.parse_autotimer.value:
+                       removeInstance = False
+                       try:
+                               # Import Instance
+                               from Plugins.Extensions.AutoTimer.plugin import autotimer
+
+                               if autotimer is None:
+                                       removeInstance = True
+                                       # Create an instance
+                                       from Plugins.Extensions.AutoTimer.AutoTimer import AutoTimer
+                                       autotimer = AutoTimer()
+
+                               # Parse EPG
+                               autotimer.parseEPG()
+                       except Exception, e:
+                               print "[EPGRefresh] Could not start AutoTimer:", e
+                       finally:
+                               # Remove instance if there wasn't one before
+                               if removeInstance:
+                                       autotimer = None
+
                # shutdown if we're supposed to go to deepstandby and not recording
                if not self.forcedScan and config.plugins.epgrefresh.afterevent.value \
                        and not Screens.Standby.inTryQuitMainloop:
index 84b83f4..36e88d9 100644 (file)
@@ -55,6 +55,7 @@ class EPGRefreshConfiguration(Screen, ConfigListScreen):
                        getConfigListEntry(_("Delay when not in Standby (in m)"), config.plugins.epgrefresh.delay_standby),
                        getConfigListEntry(_("Force scan even if reciever is in use"), config.plugins.epgrefresh.force),
                        getConfigListEntry(_("Inherit Services from AutoTimer if available"), config.plugins.epgrefresh.inherit_autotimer),
+                       getConfigListEntry(_("Make AutoTimer parse EPG if available"), config.plugins.epgrefresh.parse_autotimer),
                        getConfigListEntry(_("Shutdown after refresh"), config.plugins.epgrefresh.afterevent),
                ]
 
index ba07826..618602d 100644 (file)
@@ -2,7 +2,7 @@
 from . import _
 
 # Config
-from Components.config import config, ConfigEnableDisable, ConfigNumber, \
+from Components.config import config, ConfigYesNo, ConfigNumber, \
        ConfigSubsection, ConfigClock
 
 # Calculate default begin/end
@@ -18,16 +18,17 @@ end = mktime((
 )
 
 config.plugins.epgrefresh = ConfigSubsection()
-config.plugins.epgrefresh.enabled = ConfigEnableDisable(default = False)
+config.plugins.epgrefresh.enabled = ConfigYesNo(default = False)
 config.plugins.epgrefresh.begin = ConfigClock(default = int(begin))
 config.plugins.epgrefresh.end = ConfigClock(default = int(end))
 config.plugins.epgrefresh.interval = ConfigNumber(default = 2)
 config.plugins.epgrefresh.delay_standby = ConfigNumber(default = 10)
-config.plugins.epgrefresh.inherit_autotimer = ConfigEnableDisable(default = False)
-config.plugins.epgrefresh.afterevent = ConfigEnableDisable(default = False)
-config.plugins.epgrefresh.force = ConfigEnableDisable(default = False)
-config.plugins.epgrefresh.wakeup = ConfigEnableDisable(default = False)
+config.plugins.epgrefresh.inherit_autotimer = ConfigYesNo(default = False)
+config.plugins.epgrefresh.afterevent = ConfigYesNo(default = False)
+config.plugins.epgrefresh.force = ConfigYesNo(default = False)
+config.plugins.epgrefresh.wakeup = ConfigYesNo(default = False)
 config.plugins.epgrefresh.lastscan = ConfigNumber(default = 0)
+config.plugins.epgrefresh.parse_autotimer = ConfigYesNo(default = False)
 
 del now, begin, end