2 from Components.config import config, ConfigEnableDisable, ConfigNumber, \
3 ConfigSubsection, ConfigClock
5 # Calculate default begin/end
6 from time import time, localtime, mktime
9 now.tm_year, now.tm_mon, now.tm_mday, 20, 15, \
10 0, now.tm_wday, now.tm_yday, now.tm_isdst)
13 now.tm_year, now.tm_mon, now.tm_mday, 06, 30, \
14 0, now.tm_wday, now.tm_yday, now.tm_isdst)
17 config.plugins.epgrefresh = ConfigSubsection()
18 config.plugins.epgrefresh.enabled = ConfigEnableDisable(default = False)
19 config.plugins.epgrefresh.begin = ConfigClock(default = int(begin))
20 config.plugins.epgrefresh.end = ConfigClock(default = int(end))
21 config.plugins.epgrefresh.interval = ConfigNumber(default = 2)
22 config.plugins.epgrefresh.delay_standby = ConfigNumber(default = 10)
23 config.plugins.epgrefresh.inherit_autotimer = ConfigEnableDisable(default = False)
24 config.plugins.epgrefresh.afterevent = ConfigEnableDisable(default = False)
25 config.plugins.epgrefresh.force = ConfigEnableDisable(default = False)
26 config.plugins.epgrefresh.lastscan = ConfigNumber(default = 0)
31 from EPGRefresh import epgrefresh
32 from EPGRefreshConfiguration import EPGRefreshConfiguration
35 from Plugins.Plugin import PluginDescriptor
38 def autostart(reason, **kwargs):
39 if config.plugins.epgrefresh.enabled.value and reason == 0 \
40 and kwargs.has_key("session"):
42 epgrefresh.start(kwargs["session"])
48 # Return invalid time if not automatically refreshing
49 if not config.plugins.epgrefresh.enabled.value:
53 (now.tm_year, now.tm_mon, now.tm_mday,
54 config.plugins.epgrefresh.begin.value[0],
55 config.plugins.epgrefresh.begin.value[1],
56 0, now.tm_wday, now.tm_yday, now.tm_isdst)
58 # todays timespan has not yet begun
65 def main(session, **kwargs):
67 session.openWithCallback(
69 EPGRefreshConfiguration
72 def doneConfiguring(session, **kwargs):
73 if config.plugins.epgrefresh.enabled.value:
74 epgrefresh.start(session)
76 def Plugins(**kwargs):
80 description = "Automated EPGRefresher",
82 PluginDescriptor.WHERE_AUTOSTART,
83 PluginDescriptor.WHERE_SESSIONSTART
86 wakeupfnc = getNextWakeup
90 description = "Automated EPGRefresher",
91 where = PluginDescriptor.WHERE_PLUGINMENU,