1 # for localized messages
5 from Components.config import config, ConfigEnableDisable, ConfigNumber, \
6 ConfigSubsection, ConfigClock
8 # Calculate default begin/end
9 from time import time, localtime, mktime
12 now.tm_year, now.tm_mon, now.tm_mday, 20, 15, \
13 0, now.tm_wday, now.tm_yday, now.tm_isdst)
16 now.tm_year, now.tm_mon, now.tm_mday, 06, 30, \
17 0, now.tm_wday, now.tm_yday, now.tm_isdst)
20 config.plugins.epgrefresh = ConfigSubsection()
21 config.plugins.epgrefresh.enabled = ConfigEnableDisable(default = False)
22 config.plugins.epgrefresh.begin = ConfigClock(default = int(begin))
23 config.plugins.epgrefresh.end = ConfigClock(default = int(end))
24 config.plugins.epgrefresh.interval = ConfigNumber(default = 2)
25 config.plugins.epgrefresh.delay_standby = ConfigNumber(default = 10)
26 config.plugins.epgrefresh.inherit_autotimer = ConfigEnableDisable(default = False)
27 config.plugins.epgrefresh.afterevent = ConfigEnableDisable(default = False)
28 config.plugins.epgrefresh.force = ConfigEnableDisable(default = False)
29 config.plugins.epgrefresh.wakeup = ConfigEnableDisable(default = False)
30 config.plugins.epgrefresh.lastscan = ConfigNumber(default = 0)
35 from EPGRefresh import epgrefresh
36 from EPGRefreshConfiguration import EPGRefreshConfiguration
37 from EPGRefreshService import EPGRefreshService
40 from Plugins.Plugin import PluginDescriptor
43 def autostart(reason, **kwargs):
44 if config.plugins.epgrefresh.enabled.value and reason == 0 \
45 and kwargs.has_key("session"):
47 epgrefresh.start(kwargs["session"])
53 # Return invalid time if not automatically refreshing
54 if not config.plugins.epgrefresh.enabled.value or \
55 not config.plugins.epgrefresh.wakeup.value:
61 (now.tm_year, now.tm_mon, now.tm_mday,
62 config.plugins.epgrefresh.begin.value[0],
63 config.plugins.epgrefresh.begin.value[1],
64 0, now.tm_wday, now.tm_yday, now.tm_isdst)
66 # todays timespan has not yet begun
73 def main(session, **kwargs):
75 session.openWithCallback(
77 EPGRefreshConfiguration
80 def doneConfiguring(session, **kwargs):
81 if config.plugins.epgrefresh.enabled.value:
82 epgrefresh.start(session)
85 def eventinfo(session, servicelist, **kwargs):
86 ref = session.nav.getCurrentlyPlayingServiceReference()
90 # strip all after last :
95 epgrefresh.services[0].add(EPGRefreshService(sref, None))
97 def Plugins(**kwargs):
101 description = _("Automated EPGRefresher"),
103 PluginDescriptor.WHERE_AUTOSTART,
104 PluginDescriptor.WHERE_SESSIONSTART
107 wakeupfnc = getNextWakeup
111 description = _("Automated EPGRefresher"),
112 where = PluginDescriptor.WHERE_PLUGINMENU,
116 name = _("Add to EPGRefresh"),
117 where = PluginDescriptor.WHERE_EVENTINFO,