Check for new downloads every 15mins
authorJason Michalski <armooo@armooo.net>
Mon, 7 Apr 2008 05:07:20 +0000 (7 00:07 -0500)
committerJason Michalski <armooo@armooo.net>
Wed, 9 Apr 2008 03:11:31 +0000 (8 22:11 -0500)
If we don't the tivo will say we have not been connecting

plugins/webvideo/webvideo.py

index 35286d2..4395dc9 100644 (file)
@@ -9,6 +9,7 @@ import urllib2
 import os.path
 import shutil
 import os.path
+import time
 import os
 import urlparse
 import urllib
@@ -31,7 +32,6 @@ class WebVideo(Video):
         self.in_progress_lock = threading.Lock()
 
         self.startXMPP()
-        self.xmpp_cdsupdate()
         self.startWorkerThreads()
 
     def startXMPP(self):
@@ -63,10 +63,14 @@ class WebVideo(Video):
 
     def startWorkerThreads(self):
         for i in range(self.download_thread_num):
-            t = threading.Thread(target=self.processDlRequest)
+            t = threading.Thread(target=self.processDlRequest, name='webvideo downloader')
             t.setDaemon(True)
             t.start()
 
+        t = threading.Thread(target=self.watchQueue, name='webvideo queue watcher')
+        t.setDaemon(True)
+        t.start()
+
     def processXMPP(self, client):
         while client.Process(3):
             pass
@@ -82,6 +86,11 @@ class WebVideo(Video):
         method = getattr(self, method_name)
         method(xmpp_action)
 
+    def watchQueue(self):
+        while True:
+            self.xmpp_cdsupdate()
+            time.sleep(60*15)
+
     def xmpp_cdsupdate(self, xml=None):
         m = mind.getMind()