rely solely on our localization
[vuplus_dvbapp-plugin] / autotimer / src / AutoPoller.py
index d22d9e9..bdfc38f 100644 (file)
@@ -8,36 +8,34 @@ class AutoPoller:
        """Automatically Poll AutoTimer"""
 
        def __init__(self):
-               # Keep track if we were launched before
-               self.shouldRun = False
-
                # Init Timer
                self.timer = eTimer()
-               self.timer.timeout.get().append(self.query)
-
-       def shouldRun(self):
-               return config.plugins.autotimer.autopoll.value
 
-       def start(self, autotimer, initial = True):
-               self.autotimer = autotimer
+       def start(self, initial = True):
                if initial:
                        delay = 2
                else:
                        delay = config.plugins.autotimer.interval.value*3600
+
+               if self.query not in self.timer.callback:
+                       self.timer.callback.append(self.query)
                self.timer.startLongTimer(delay)
 
        def stop(self):
+               if self.query in self.timer.callback:
+                       self.timer.callback.remove(self.query)
                self.timer.stop()
 
        def query(self):
-               # Ignore any exceptions
+               from plugin import autotimer
+
+               # Ignore any program errors
                try:
-                       self.autotimer.parseEPG()
-               except:
+                       autotimer.parseEPG()
+               except Exception:
                        # Dump error to stdout
                        import traceback, sys
                        traceback.print_exc(file=sys.stdout)
 
                self.timer.startLongTimer(config.plugins.autotimer.interval.value*3600)
 
-autopoller = AutoPoller()
\ No newline at end of file