follow recent timer changes
[vuplus_dvbapp-plugin] / autotimer / src / AutoPoller.py
1 # Timer
2 from enigma import eTimer
3
4 # Config
5 from Components.config import config
6
7 class AutoPoller:
8         """Automatically Poll AutoTimer"""
9
10         def __init__(self):
11                 # Init Timer
12                 self.timer = eTimer()
13
14         def start(self, initial = True):
15                 if initial:
16                         delay = 2
17                 else:
18                         delay = config.plugins.autotimer.interval.value*3600
19
20                 self.timer.callback.append(self.query)
21                 self.timer.startLongTimer(delay)
22
23         def stop(self):
24                 self.timer.callback.remove(self.query)
25                 self.timer.stop()
26
27         def query(self):
28                 from plugin import autotimer
29
30                 # Ignore any exceptions
31                 try:
32                         autotimer.parseEPG()
33                 except:
34                         # Dump error to stdout
35                         import traceback, sys
36                         traceback.print_exc(file=sys.stdout)
37
38                 self.timer.startLongTimer(config.plugins.autotimer.interval.value*3600)