summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-19 00:07:08 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-19 00:07:08 +0200
commit45186b775ba6cac2d659d14210f7d1c9bbcc2a89 (patch)
tree50dc8f061808af48731e902a835f3ae3c486eed6
parentEr downloaded jetzt eine Rapidshare Datei, wait muss aber noch implementiert ... (diff)
downloadpyload-45186b775ba6cac2d659d14210f7d1c9bbcc2a89.tar.xz
funzt im moment nicht, aber ich arbeite daran
-rw-r--r--Plugins/RapidshareCom.py10
-rw-r--r--Py_Load_File.py8
-rw-r--r--download_thread.py28
3 files changed, 28 insertions, 18 deletions
diff --git a/Plugins/RapidshareCom.py b/Plugins/RapidshareCom.py
index 427b43518..60095bfd5 100644
--- a/Plugins/RapidshareCom.py
+++ b/Plugins/RapidshareCom.py
@@ -57,8 +57,9 @@ class RapidshareCom(Plugin):
if re.search(r".*Currently a lot of users.*", self.html) != None:
return ('wait', 2*60)
wait_seconds = re.search(r"var c=(.*);.*", self.html).group(1)
- print "wait" ,wait_seconds
self.time_plus_wait = time() + int(wait_seconds)
+
+ print self.time_plus_wait - time()
def file_exists(self):
""" returns True or False
@@ -71,7 +72,8 @@ class RapidshareCom(Plugin):
return False
else:
return True
-
+ #The uploader has removed this file from the server.
+
def get_file_url(self):
""" returns the absolute downloadable filepath
"""
@@ -79,11 +81,9 @@ class RapidshareCom(Plugin):
self.download_html()
if (self.html_old + 5*60) > time(): # nach einiger zeit ist die file_url nicht mehr aktuell
self.download_html()
- if(time() < self.time_plus_wait):
- return ('wait', self.time_plus_wait - time())
file_url_pattern = r".*name=\"dlf\" action=\"(.*)\" method=.*"
- return ('download', (re.search(file_url_pattern, self.html).group(1), self.get_file_name()))
+ return re.search(file_url_pattern, self.html).group(1)
def get_file_name(self):
if self.html == None:
diff --git a/Py_Load_File.py b/Py_Load_File.py
index 6463379a1..1d20e05e0 100644
--- a/Py_Load_File.py
+++ b/Py_Load_File.py
@@ -9,12 +9,18 @@ class PyLoadFile:
pluginClass = getattr(plugin, plugin.__name__)
self.plugin = pluginClass(self)
self.url = url
+ self.dl = None
self.filename = "filename"
self.download_folder = ""
self.status = Status(self.id)
+
def _get_my_plugin():
plugins = parent.get_avail_plugins()
-
+ def prepareDownload(self):
+ self.status.exist = True #self.plugin.file_exists()
+ self.status.filename = self.plugin.get_file_name()
+ self.status.waituntil = self.plugin.time_plus_wait
+ self.status.dl = self.plugin.get_file_url()
diff --git a/download_thread.py b/download_thread.py
index 5fe132245..b90559650 100644
--- a/download_thread.py
+++ b/download_thread.py
@@ -73,10 +73,18 @@ class Download_Thread(threading.Thread):
self.parent.remove_thread(self)
def download(self, py_load_file):
- url = py_load_file.url
- type, params = py_load_file.plugin.get_file_url()
- status = py_load_file.status
- #missing wenn datei nicht auf server vorhanden
+ pyfile = py_load_file
+ status = pyfile.status
+ pyfile.prepareDownload()
+
+ if not status.exists:
+ return False
+
+ while (time() < status.waituntil):
+ print "waiting"
+ sleep(1)
+
+ #missing wenn datei nicht auf server vorhanden
#if type=="check":
#return params
#if type in 'missing':
@@ -89,11 +97,7 @@ class Download_Thread(threading.Thread):
# print params
# sleep(params+1)
- if type in 'download':
- print "download"
- status.type = "downloading"
- #startet downloader
- status.url, status.filename = params
- print status.url, status.filename
- urllib.urlretrieve(status.url, py_load_file.download_folder + "/" + status.filename, status)
- self.shutdown = True
+ status.type = "downloading"
+ #startet downloader
+ urllib.urlretrieve(status.dl, pyfile.download_folder + "/" + status.filename, status)
+ self.shutdown = True