From f96dd493243e2d99e68ffb5257949420c7e3dc42 Mon Sep 17 00:00:00 2001 From: Moritz Venn Date: Wed, 2 Jan 2008 17:28:58 +0000 Subject: [PATCH] provide wakeupfnc, requires more recent enigma2 (>=20080102) --- epgrefresh/CONTROL/control | 2 +- epgrefresh/src/plugin.py | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/epgrefresh/CONTROL/control b/epgrefresh/CONTROL/control index 1ab0d667..04da596b 100644 --- a/epgrefresh/CONTROL/control +++ b/epgrefresh/CONTROL/control @@ -6,5 +6,5 @@ Section: extra Priority: optional Maintainer: Moritz Venn Homepage: http://www.ritzmo.de -Depends: enigma2(>2.3cvs20070916) +Depends: enigma2(>2.3cvs20080102) Source: http://www.ritzmo.de diff --git a/epgrefresh/src/plugin.py b/epgrefresh/src/plugin.py index 2bc7b259..e5e43833 100644 --- a/epgrefresh/src/plugin.py +++ b/epgrefresh/src/plugin.py @@ -2,7 +2,7 @@ from Components.config import config, ConfigEnableDisable, ConfigInteger, ConfigSubsection, ConfigClock # Calculate default begin/end -from time import localtime, mktime +from time import time, localtime, mktime now = [x for x in localtime()] now[3] = 20 now[4] = 15 @@ -38,6 +38,23 @@ def autostart(reason, **kwargs): elif reason == 1: epgrefresh.stop() +def getNextWakeup(): + # Return invalid time if not automatically refreshing + if not config.plugins.epgrefresh.enabled.value: + return -1 + now = localtime() + begin = mktime( + (now.tm_year, now.tm_mon, now.tm_mday, + config.plugins.epgrefresh.begin.value[0], + config.plugins.epgrefresh.begin.value[1], + 0, now.tm_wday, now.tm_yday, now.tm_isdst) + ) + # todays timespan has not yet begun + if begin > time(): + return begin + # otherwise add 1 day + return begin+86400 + # Mainfunction def main(session, **kwargs): epgrefresh.stop() @@ -52,6 +69,6 @@ def doneConfiguring(session, **kwargs): def Plugins(**kwargs): return [ - PluginDescriptor(name="EPGRefresh", description = "Automated EPGRefresher", where = [PluginDescriptor.WHERE_AUTOSTART, PluginDescriptor.WHERE_SESSIONSTART], fnc = autostart), + PluginDescriptor(name="EPGRefresh", description = "Automated EPGRefresher", where = [PluginDescriptor.WHERE_AUTOSTART, PluginDescriptor.WHERE_SESSIONSTART], fnc = autostart, wakeupfnc = getNextWakeup), PluginDescriptor(name="EPGRefresh", description = "Automated EPGRefresher", where = PluginDescriptor.WHERE_PLUGINMENU, fnc = main) ] -- 2.20.1