diff options
author | mkaay <mkaay@mkaay.de> | 2010-01-04 20:35:26 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-01-04 20:35:26 +0100 |
commit | 89acc0ff595f73956572c8892ccb860c06fba33a (patch) | |
tree | 6edad5f8e0ca153b186a182b63aa5a5de815fe05 /module/thread_list.py | |
parent | fixed webserver (diff) | |
download | pyload-89acc0ff595f73956572c8892ccb860c06fba33a.tar.xz |
added hook system
Diffstat (limited to 'module/thread_list.py')
-rw-r--r-- | module/thread_list.py | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/module/thread_list.py b/module/thread_list.py index 5d0bcf53a..55b21093f 100644 --- a/module/thread_list.py +++ b/module/thread_list.py @@ -76,7 +76,7 @@ class Thread_List(object): if pyfile: self.py_downloading.append(pyfile) - self.scripts_download_preparing(pyfile.modul.__name__, pyfile.url) + self.parent.hookManager.downloadStarts(pyfile) if not pyfile.plugin.multi_dl: self.occ_plugins.append(pyfile.modul.__name__) pyfile.active = True @@ -153,7 +153,7 @@ class Thread_List(object): self.list.save() - self.scripts_download_finished(pyfile.modul.__name__, pyfile.url, pyfile.status.filename, pyfile.folder) + self.parent.hookManager.downloadFinished(pyfile) self.lock.release() return True @@ -200,6 +200,8 @@ class Thread_List(object): def reconnect(self): self.parent.logger.info("Start reconnect") + ip = re.match(".*Current IP Address: (.*)</body>.*", urllib2.urlopen("http://checkip.dyndns.org/").read()).group(1) + self.parent.hookManager.beforeReconnecting(ip) reconn = subprocess.Popen(self.parent.config['activated']['method'])#, stdout=subprocess.PIPE) reconn.wait() time.sleep(1) @@ -210,23 +212,8 @@ class Thread_List(object): except: ip = "" time.sleep(1) - self.scripts_reconnected(ip) + self.parent.hookManager.afterReconnecting(ip) self.parent.logger.info("Reconnected, new IP: " + ip) - - - def scripts_download_preparing(self, pluginname, url): - for script in self.parent.scripts['download_preparing']: - out = subprocess.Popen([script, pluginname, url], stdout=subprocess.PIPE) - out.wait() - - def scripts_download_finished(self, pluginname, url, filename, location): - map(lambda script: subprocess.Popen([script, pluginname, url, filename, location], stdout=subprocess.PIPE), self.parent.scripts['download_finished']) - - def scripts_package_finished(self, name, location): #@TODO Implement! - map(lambda script: subprocess.Popen([script, name, location], stdout=subprocess.PIPE), self.parent.scripts['download_finished']) - - def scripts_reconnected(self, ip): - map(lambda script: subprocess.Popen([script, ip], stdout=subprocess.PIPE), self.parent.scripts['download_finished']) def stopAllDownloads(self): for pyfile in self.py_downloading: |