cleanup
[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                 self.timer.timeout.get().append(self.query)
14
15         def start(self, initial = True):
16                 if initial:
17                         delay = 2
18                 else:
19                         delay = config.plugins.autotimer.interval.value*3600
20                 self.timer.startLongTimer(delay)
21
22         def stop(self):
23                 self.timer.stop()
24
25         def query(self):
26                 from plugin import autotimer
27
28                 # Ignore any exceptions
29                 try:
30                         autotimer.parseEPG()
31                 except:
32                         # Dump error to stdout
33                         import traceback, sys
34                         traceback.print_exc(file=sys.stdout)
35
36                 self.timer.startLongTimer(config.plugins.autotimer.interval.value*3600)
37
38 autopoller = AutoPoller()