summaryrefslogtreecommitdiffstats
path: root/Plugins
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-18 21:11:22 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-18 21:11:22 +0200
commitcb8c5992af74e3c6562f2e5f0a828b5223779d85 (patch)
tree45c62f97ec546182a26921520d6ca5c38f6668bc /Plugins
parentpy load file get now plugin_name (diff)
downloadpyload-cb8c5992af74e3c6562f2e5f0a828b5223779d85.tar.xz
Er downloaded jetzt eine Rapidshare Datei, wait muss aber noch implementiert werden. Alle status informationen und sonstiges sind ungetestet
Diffstat (limited to 'Plugins')
-rw-r--r--Plugins/Plugin.py4
-rw-r--r--Plugins/RapidshareCom.py13
-rw-r--r--Plugins/UploadedTo.py2
3 files changed, 11 insertions, 8 deletions
diff --git a/Plugins/Plugin.py b/Plugins/Plugin.py
index 591d32594..933c72004 100644
--- a/Plugins/Plugin.py
+++ b/Plugins/Plugin.py
@@ -19,7 +19,7 @@ class Plugin():
pluginProp ['author_email'] = "nn@nn.de"
self.pluginProp = pluginProp
self.parent = parent
- self.html = ""
+ self.html = None
self.time_plus_wait = None #time() + wait in seconds
def set_parent_status(self):
@@ -46,7 +46,7 @@ class Plugin():
self.download_html()
def get_file_name(self):
- pass
+ raise NotImplementedError
def wait_until(self):
if self.html != None:
diff --git a/Plugins/RapidshareCom.py b/Plugins/RapidshareCom.py
index 69a8cf933..427b43518 100644
--- a/Plugins/RapidshareCom.py
+++ b/Plugins/RapidshareCom.py
@@ -25,7 +25,7 @@ class RapidshareCom(Plugin):
pluginProp ['author_email'] = "nn@nn.de"
self.pluginProp = pluginProp
self.parent = parent
- self.html = ""
+ self.html = None
self.html_old = None #time() where loaded the HTML
self.time_plus_wait = None #time() + wait in seconds
@@ -47,7 +47,7 @@ class RapidshareCom(Plugin):
self.html_old = time()
file_server_url = re.search(r"<form action=\"(.*?)\"", self.html).group(1)
free_user_encode = urllib.urlencode({"dl.start" : "Free"})
- self.free_user_html = urllib2.urlopen(file_server_url, free_user_encode).read()
+ self.html = urllib2.urlopen(file_server_url, free_user_encode).read()
if re.search(r".*is already downloading.*", self.html) != None:
self.time_plus_wait = time() + 10*60
try:
@@ -57,7 +57,8 @@ 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)
- self.time_plus_wait = time() + wait_seconds
+ print "wait" ,wait_seconds
+ self.time_plus_wait = time() + int(wait_seconds)
def file_exists(self):
""" returns True or False
@@ -78,8 +79,11 @@ 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 re.search(file_url_pattern, self.html).group(1)
+ return ('download', (re.search(file_url_pattern, self.html).group(1), self.get_file_name()))
def get_file_name(self):
if self.html == None:
@@ -91,7 +95,6 @@ class RapidshareCom(Plugin):
if self.html == None:
self.download_html()
return self.time_plus_wait
-
def __call__(self):
return self.plugin_name
diff --git a/Plugins/UploadedTo.py b/Plugins/UploadedTo.py
index 0a3b7ef71..dad5db3a9 100644
--- a/Plugins/UploadedTo.py
+++ b/Plugins/UploadedTo.py
@@ -20,7 +20,7 @@ class UploadedTo(Plugin):
pluginProp ['author_email'] = "spoob@gmx.de"
self.pluginProp = pluginProp
self.parent = parent
- self.html = ""
+ self.html = None
self.html_old = None #time() where loaded the HTML
self.time_plus_wait = None #time() + wait in seconds