summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/AccountManager.py2
-rw-r--r--module/plugins/Account.py8
-rw-r--r--module/plugins/Plugin.py4
-rw-r--r--module/plugins/accounts/FreakshareCom.py53
-rw-r--r--module/plugins/accounts/NetloadIn.py15
-rw-r--r--module/plugins/hoster/FreakshareCom.py13
-rw-r--r--module/plugins/hoster/MegauploadCom.py15
-rw-r--r--module/plugins/hoster/RapidshareCom.py4
-rw-r--r--module/web/pyload/views.py2
9 files changed, 98 insertions, 18 deletions
diff --git a/module/AccountManager.py b/module/AccountManager.py
index 5dedacf3c..c155edfae 100644
--- a/module/AccountManager.py
+++ b/module/AccountManager.py
@@ -103,7 +103,7 @@ class AccountManager():
elif line.startswith("@"):
option = line[1:].split()
- self.accounts[plugin][name]["options"][option[0]] = [option[1]] if len(option) < 3 else option[1:]
+ self.accounts[plugin][name]["options"][option[0]] = True if len(option) < 2 else ([option[1]] if len(option) < 3 else option[1:])
elif ":" in line:
name, sep, pw = line.partition(":")
diff --git a/module/plugins/Account.py b/module/plugins/Account.py
index d93ff7e08..d0beaa8dc 100644
--- a/module/plugins/Account.py
+++ b/module/plugins/Account.py
@@ -47,11 +47,11 @@ class Account():
try:
self.login(user, data)
except WrongPassword:
- self.core.log.warning(_("Could not login with account %s | %s") % (user, _("Wrong Password")))
+ self.core.log.warning(_("Could not login with %s account %s | %s") % (self.__name__, user, _("Wrong Password")))
data["valid"] = False
except Exception, e:
- self.core.log.warning(_("Could not login with account %s | %s") % (user, e))
+ self.core.log.warning(_("Could not login with %s account %s | %s") % (self.__name__, user, e))
data["valid"] = False
if self.core.debug:
print_exc()
@@ -86,6 +86,8 @@ class Account():
self.core.log.debug("Get %s Account Info for %s" % (self.__name__, name))
try:
infos = self.loadAccountInfo(name)
+ if not type(infos) == dict:
+ raise Exception("Wrong return format")
except Exception, e:
infos = {"error": str(e)}
self.core.log.debug("Account Info: %s" % str(infos))
@@ -101,7 +103,7 @@ class Account():
#"password": self.accounts[name]["password"], #@XXX: security
"options": self.accounts[name]["options"],
"valid": self.accounts[name]["valid"],
- "trafficleft": None, # -1 for unlimited
+ "trafficleft": None, # in kb, -1 for unlimited
"maxtraffic": None,
"type": self.__name__,
}
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index 2b2ee2414..55faa37e1 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -121,7 +121,9 @@ class Plugin(object):
""" handles important things to do before starting """
self.thread = thread
- if not self.account:
+ if self.account:
+ self.multiDL = True #every hoster with account should provides multiple downloads
+ else:
self.req.clearCookies()
if self.core.config["proxy"]["activated"]:
diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py
new file mode 100644
index 000000000..ba9566522
--- /dev/null
+++ b/module/plugins/accounts/FreakshareCom.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: RaNaN
+"""
+import re
+from time import strptime, mktime
+
+from module.plugins.Account import Account
+
+class FreakshareCom(Account):
+ __name__ = "FreakshareCom"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """freakshare.com account plugin"""
+ __author_name__ = ("RaNaN")
+ __author_mail__ = ("RaNaN@pyload.org")
+
+ def loadAccountInfo(self, user):
+ req = self.getAccountRequest(user)
+ page = req.load("http://freakshare.com/")
+
+ validuntil = r"ltig bis:</td>\s*<td><b>([0-9 \-:.]+)</b></td>"
+ validuntil = re.search(validuntil, page, re.MULTILINE)
+ validuntil = validuntil.group(1).strip()
+ validuntil = mktime(strptime(validuntil, "%d.%m.%Y - %H:%M"))
+
+ traffic = r"Traffic verbleibend:</td>\s*<td>([^<]+)"
+ traffic = re.search(traffic, page, re.MULTILINE)
+ traffic = traffic.group(1).strip()
+ traffic = self.parseTraffic(traffic)
+
+ return {"validuntil": validuntil, "trafficleft": traffic}
+
+ def login(self, user, data):
+ req = self.getAccountRequest(user)
+ page = req.load("http://freakshare.com/login.html", None, { "submit" : "Login", "user" : user, "pass" : data['password']}, cookies=True)
+
+ if "Falsche Logindaten!" in page or "Wrong Username or Password!" in page:
+ self.wrongPassword()
diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py
index 28b3a1c56..16e06b688 100644
--- a/module/plugins/accounts/NetloadIn.py
+++ b/module/plugins/accounts/NetloadIn.py
@@ -18,6 +18,8 @@
"""
from module.plugins.Account import Account
+import re
+from time import time
class NetloadIn(Account):
__name__ = "NetloadIn"
@@ -26,8 +28,17 @@ class NetloadIn(Account):
__description__ = """netload.in account plugin"""
__author_name__ = ("RaNaN")
__author_mail__ = ("RaNaN@pyload.org")
+
+ def loadAccountInfo(self, user):
+ req = self.getAccountRequest(user)
+ page = req.load("http://netload.in/index.php?id=2")
+ left = r">(\d+) Tage, (\d+) Stunden<"
+ left = re.search(left, page)
+ validuntil = time() + int(left.group(1)) * 24 * 60 * 60 + int(left.group(2)) * 60 * 60
+ return {"validuntil": validuntil, "trafficleft": -1}
def login(self, user, data):
req = self.getAccountRequest(user)
- req.load("http://netload.in/index.php", None, { "txtuser" : user, "txtpass" : data['password'], "txtcheck" : "login", "txtlogin" : ""}, cookies=True)
-
+ page = req.load("http://netload.in/index.php", None, { "txtuser" : user, "txtpass" : data['password'], "txtcheck" : "login", "txtlogin" : ""}, cookies=True)
+ if "password or it might be invalid!" in page:
+ self.wrongPassword()
diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py
index 524081002..bbc22ac98 100644
--- a/module/plugins/hoster/FreakshareCom.py
+++ b/module/plugins/hoster/FreakshareCom.py
@@ -23,10 +23,16 @@ class FreakshareCom(Hoster):
def process(self, pyfile):
pyfile.url = pyfile.url.replace("freakshare.net/","freakshare.com/")
- self.prepare()
- self.get_file_url()
+ if self.account:
+ self.html = self.load(pyfile.url, cookies=False)
+ pyfile.name = self.get_file_name()
+ self.download(pyfile.url)
- self.download(self.pyfile.url, post=self.req_opts)
+ else:
+ self.prepare()
+ self.get_file_url()
+
+ self.download(self.pyfile.url, post=self.req_opts)
def prepare(self):
@@ -48,7 +54,6 @@ class FreakshareCom(Hoster):
return True
def download_html(self):
- url = self.pyfile.url.replace("freakshare.net/","freakshare.com/")
self.html = self.load(url, cookies=True)
def get_file_url(self):
diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py
index 4c851a5b2..b913976a0 100644
--- a/module/plugins/hoster/MegauploadCom.py
+++ b/module/plugins/hoster/MegauploadCom.py
@@ -76,17 +76,19 @@ class MegauploadCom(Hoster):
pyfile.name = self.get_file_name()
self.download(self.get_file_url())
+ check = self.checkDownload({"limit": "Download limit exceeded"})
+ if check == "limit":
+ wait = self.load("http://www.megaupload.com/?c=premium&l=1")
+ wait = re.search(r"Please wait (\d+) minutes", wait).group(1)
+ self.log.info(_("Megaupload: waiting %d minues") % wait)
+ self.setWait(int(wait)*60, True)
+ self.wait()
+ self.process(pyfile)
else:
self.download_api()
pyfile.name = self.get_file_name()
self.download(pyfile.url)
- check = self.checkDownload({"limit": "Download limit exceeded"}) #@TODO catch it earlier in html pages if possible
- if check == "limit":
- self.setWait(3600, True)
- self.wait()
- self.process(pyfile)
-
def download_html(self):
for i in range(5):
self.html[0] = self.load(self.pyfile.url)
@@ -117,6 +119,7 @@ class MegauploadCom(Hoster):
if re.search(r"Waiting time before each download begins", self.html[1]) is not None:
break
+ print self.html[0]
def download_api(self):
diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py
index 40fe05eeb..0e3d2e74d 100644
--- a/module/plugins/hoster/RapidshareCom.py
+++ b/module/plugins/hoster/RapidshareCom.py
@@ -212,6 +212,10 @@ class RapidshareCom(Hoster):
self.setWait(60)
self.log.info(_("Already downloading from this ip address, waiting 60 seconds"))
self.wait()
+ elif "Too many users downloading from this server right now" in result:
+ self.setWait(120)
+ self.log.info(_("RapidShareCom: No free slots"))
+ self.wait()
elif between_wait:
self.setWait(int(between_wait.group(1)))
self.wantReconnect = True
diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py
index a69e7da86..cfcd43061 100644
--- a/module/web/pyload/views.py
+++ b/module/web/pyload/views.py
@@ -28,7 +28,7 @@ def formatSize(size):
"""formats size of bytes"""
size = int(size)
steps = 0
- sizes = ["B", "KB", "MB", "GB", "TB"]
+ sizes = ["KB", "MB", "GB", "TB"]
while size > 1000:
size /= 1024.0