From b44f560c3a53c073a1290e3403ff76ebbe35e91b Mon Sep 17 00:00:00 2001 From: RaNaN Date: Tue, 19 May 2009 14:26:37 +0000 Subject: =?UTF-8?q?RapidshareCom=20l=C3=A4uft=20jetzt=20wieder.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plugins/RapidshareCom.py | 66 ++++++++++++++++++++++++++++++------------------ Py_Load_File.py | 11 ++++---- download_thread.py | 3 +++ 3 files changed, 50 insertions(+), 30 deletions(-) diff --git a/Plugins/RapidshareCom.py b/Plugins/RapidshareCom.py index e075ecfc7..6f81a9549 100644 --- a/Plugins/RapidshareCom.py +++ b/Plugins/RapidshareCom.py @@ -25,7 +25,8 @@ class RapidshareCom(Plugin): pluginProp ['author_email'] = "nn@nn.de" self.pluginProp = pluginProp self.parent = parent - self.html = None + self.html = [None, None] + self.prehtml = None self.html_old = None #time() where loaded the HTML self.time_plus_wait = None #time() + wait in seconds self.want_reconnect = False @@ -33,46 +34,62 @@ class RapidshareCom(Plugin): def set_parent_status(self): """ sets all available Statusinfos about a File in self.parent.status """ - if self.html == None: + if self.html[0] == None: self.download_html() + + self.get_wait_time() self.parent.status.filename = self.get_file_name() self.parent.status.url = self.get_file_url() - self.parent.status.wait = self.wait_until() + self.parent.status.waituntil = self.wait_until() def download_html(self): """ gets the url from self.parent.url saves html in self.html and parses """ url = self.parent.url html = urllib2.urlopen(url).read() - self.html = html + self.html[0] = html self.html_old = time() - def get_wait_time(self): - file_server_url = re.search(r"
This limit is reached.

)", self.html) or \ - re.search(r"(.*is momentarily not available.*)", self.html) or \ - re.search(r"(.*The uploader has removed this file from the server.*)", self.html): + if re.search(r".*The File could not be found.*", self.html[0]) != None or \ + re.search(r"(

This limit is reached.

)", self.html[0]) or \ + re.search(r"(.*is momentarily not available.*)", self.html[0]) or \ + re.search(r"(.*The uploader has removed this file from the server.*)", self.html[0]): return False else: return True @@ -80,24 +97,23 @@ class RapidshareCom(Plugin): def get_file_url(self): """ returns the absolute downloadable filepath """ - se.get_wait_time() - if self.html == None: - self.download_html() - if (self.html_old + 5*60) > time(): # nach einiger zeit ist die file_url nicht mehr aktuell - self.download_html() + if self.html[1] == None: + self.download_serverhtml() + if (self.html_old + 5*60) < time(): # nach einiger zeit ist die file_url nicht mehr aktuell + self.download_serverhtml() if not self.want_reconnect: file_url_pattern = r".*name=\"dlf\" action=\"(.*)\" method=.*" - return re.search(file_url_pattern, self.html).group(1) + return re.search(file_url_pattern, self.html[1]).group(1) else: return False def get_file_name(self): - if self.html == None: - self.download_html() + if self.html[1] == None: + self.download_serverhtml() if not self.want_reconnect: file_name_pattern = r".*name=\"dlf\" action=\"(.*)\" method=.*" - return re.search(file_name_pattern, self.html).group(1).split('/')[-1] + return re.search(file_name_pattern, self.html[1]).group(1).split('/')[-1] else: return self.parent.url diff --git a/Py_Load_File.py b/Py_Load_File.py index dc1c2ba75..157d51bfd 100644 --- a/Py_Load_File.py +++ b/Py_Load_File.py @@ -19,9 +19,10 @@ class PyLoadFile: def prepareDownload(self): - self.status.exists = True #self.plugin.file_exists() - self.status.filename = self.plugin.get_file_name() - self.status.waituntil = self.plugin.time_plus_wait - self.status.url = self.plugin.get_file_url() - self.status.want_reconnect = self.plugin.want_reconnect + self.status.exists = self.plugin.file_exists() + if self.status.exists: + self.status.filename = self.plugin.get_file_name() + self.status.waituntil = self.plugin.time_plus_wait + self.status.url = self.plugin.get_file_url() + self.status.want_reconnect = self.plugin.want_reconnect diff --git a/download_thread.py b/download_thread.py index 2b6fafdab..672f15682 100644 --- a/download_thread.py +++ b/download_thread.py @@ -84,10 +84,13 @@ class Download_Thread(threading.Thread): if not status.exists: self.shutdown = True + return False if status.want_reconnect: print "handle reconnect" self.shutdown = True + return False + while (time() < status.waituntil): status.type = "waiting" sleep(1) #eventuell auf genaue zeit warten -- cgit v1.2.3