AutoTimer: add "Fast Scan" support
[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                 if self.query not in self.timer.callback:
21                         self.timer.callback.append(self.query)
22                 self.timer.startLongTimer(delay)
23
24         def stop(self):
25                 if self.query in self.timer.callback:
26                         self.timer.callback.remove(self.query)
27                 self.timer.stop()
28
29         def query(self):
30                 from plugin import autotimer
31
32                 # Ignore any program errors
33                 try:
34                         autotimer.parseEPG()
35                 except Exception:
36                         # Dump error to stdout
37                         import traceback, sys
38                         traceback.print_exc(file=sys.stdout)
39
40                 self.timer.startLongTimer(config.plugins.autotimer.interval.value*3600)
41