From: Jason Michalski Date: Mon, 7 Apr 2008 05:07:20 +0000 (-0500) Subject: Check for new downloads every 15mins X-Git-Url: https://repo.or.cz/w/pyTivo.git/commitdiff_plain/bcdc845341716e64935c3f5371b74473b68d61d8 Check for new downloads every 15mins If we don't the tivo will say we have not been connecting --- diff --git a/plugins/webvideo/webvideo.py b/plugins/webvideo/webvideo.py index 35286d2..4395dc9 100644 --- a/plugins/webvideo/webvideo.py +++ b/plugins/webvideo/webvideo.py @@ -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()