summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-08-18 22:39:07 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-08-18 22:39:07 +0200
commitab22498f73ba6376d0242c4f0a706b312cf6cdb6 (patch)
treed8d9e3051e5e8048157c852c7412d7ca0d4ffee6
parentfixes, missing file (diff)
downloadpyload-ab22498f73ba6376d0242c4f0a706b312cf6cdb6.tar.xz
account fixes
-rw-r--r--module/plugins/accounts/FileserveCom.py33
-rw-r--r--module/plugins/accounts/HotfileCom.py43
-rw-r--r--module/plugins/accounts/RapidshareCom.py5
-rw-r--r--module/plugins/accounts/UploadedTo.py2
-rw-r--r--module/web/pyload/views.py1
5 files changed, 44 insertions, 40 deletions
diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py
index 2862e5ab0..a9b222a6a 100644
--- a/module/plugins/accounts/FileserveCom.py
+++ b/module/plugins/accounts/FileserveCom.py
@@ -31,21 +31,24 @@ class FileserveCom(Account):
__author_mail__ = ("mkaay@mkaay.de")
def getAccountInfo(self, user):
- req = self.core.requestFactory.getRequest(self.__name__, user)
-
- src = req.load("http://fileserve.com/dashboard.php", cookies=True)
-
- out = Account.getAccountInfo(self, user)
-
- m = re.search(r"<td><h4>Premium Until</h4></th> <td><h5>(.*?) E(.)T</h5></td>", src)
- if m:
- zone = -5 if m.group(2) == "S" else -4
- validuntil = int(mktime(strptime(m.group(1), "%d %B %Y"))) + 24*3600 + (zone*3600)
- tmp = {"validuntil":validuntil, "trafficleft":-1}
- else:
- tmp = {"trafficleft":-1}
- out.update(tmp)
- return out
+ try:
+ req = self.core.requestFactory.getRequest(self.__name__, user)
+
+ src = req.load("http://fileserve.com/dashboard.php", cookies=True)
+
+ out = Account.getAccountInfo(self, user)
+
+ m = re.search(r"<td><h4>Premium Until</h4></th> <td><h5>(.*?) E(.)T</h5></td>", src)
+ if m:
+ zone = -5 if m.group(2) == "S" else -4
+ validuntil = int(mktime(strptime(m.group(1), "%d %B %Y"))) + 24*3600 + (zone*3600)
+ tmp = {"validuntil":validuntil, "trafficleft":-1}
+ else:
+ tmp = {"trafficleft":-1}
+ out.update(tmp)
+ return out
+ except:
+ return Account.getAccountInfo(user)
def login(self, user, data):
req = self.core.requestFactory.getRequest(self.__name__, user)
diff --git a/module/plugins/accounts/HotfileCom.py b/module/plugins/accounts/HotfileCom.py
index af38b56a3..e6e8ba517 100644
--- a/module/plugins/accounts/HotfileCom.py
+++ b/module/plugins/accounts/HotfileCom.py
@@ -31,27 +31,30 @@ class HotfileCom(Account):
__author_mail__ = ("mkaay@mkaay.de")
def getAccountInfo(self, user):
- req = self.core.requestFactory.getRequest(self.__name__, user)
-
- resp = self.apiCall("getuserinfo", user=user)
- if resp.startswith("."):
- self.core.debug("HotfileCom API Error: %s" % resp)
- return None
- info = {}
- for p in resp.split("&"):
- key, value = p.split("=")
- info[key] = value
+ try:
+ req = self.core.requestFactory.getRequest(self.__name__, user)
- info["premium_until"] = info["premium_until"].replace("T"," ")
- zone = info["premium_until"][19:]
- info["premium_until"] = info["premium_until"][:19]
- zone = int(zone[:3])
-
- validuntil = int(mktime(strptime(info["premium_until"], "%Y-%m-%d %H:%M:%S"))) + (zone*3600)
- out = Account.getAccountInfo(self, user)
- tmp = {"validuntil":validuntil, "trafficleft":-1}
- out.update(tmp)
- return out
+ resp = self.apiCall("getuserinfo", user=user)
+ if resp.startswith("."):
+ self.core.debug("HotfileCom API Error: %s" % resp)
+ raise Exception
+ info = {}
+ for p in resp.split("&"):
+ key, value = p.split("=")
+ info[key] = value
+
+ info["premium_until"] = info["premium_until"].replace("T"," ")
+ zone = info["premium_until"][19:]
+ info["premium_until"] = info["premium_until"][:19]
+ zone = int(zone[:3])
+
+ validuntil = int(mktime(strptime(info["premium_until"], "%Y-%m-%d %H:%M:%S"))) + (zone*3600)
+ out = Account.getAccountInfo(self, user)
+ tmp = {"validuntil":validuntil, "trafficleft":-1}
+ out.update(tmp)
+ return out
+ except:
+ return Account.getAccountInfo(user)
def apiCall(self, method, post={}, user=None):
if user:
diff --git a/module/plugins/accounts/RapidshareCom.py b/module/plugins/accounts/RapidshareCom.py
index b656bb763..c9766cd57 100644
--- a/module/plugins/accounts/RapidshareCom.py
+++ b/module/plugins/accounts/RapidshareCom.py
@@ -34,13 +34,13 @@ class RapidshareCom(Account):
if account[0] == user:
data = account[1]
if not data:
- return
+ raise Exception
req = self.core.requestFactory.getRequest(self.__name__, user)
api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi"
api_param_prem = {"sub": "getaccountdetails_v1", "type": "prem", "login": user, "password": data["password"], "withcookie": 1}
src = req.load(api_url_base, cookies=False, get=api_param_prem)
if src.startswith("ERROR"):
- return
+ raise Exception
fields = src.split("\n")
info = {}
for t in fields:
@@ -54,7 +54,6 @@ class RapidshareCom(Account):
maxtraffic = int(info["rapids"])/14 * (5*1024*1024) + restkb
tmp = {"validuntil":int(info["billeduntil"]), "trafficleft":maxtraffic if int(info["autorefill"]) else restkb, "maxtraffic":maxtraffic}
out.update(tmp)
-
return out
except:
return Account.getAccountInfo(self, user)
diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py
index 764cc50be..1311ee809 100644
--- a/module/plugins/accounts/UploadedTo.py
+++ b/module/plugins/accounts/UploadedTo.py
@@ -36,7 +36,7 @@ class UploadedTo(Account):
if account[0] == user:
data = account[1]
if not data:
- return
+ raise Exception
req = self.core.requestFactory.getRequest(self.__name__, user)
html = req.load("http://uploaded.to/", cookies=True)
raw_traffic = re.search(r"Traffic left: </span><span class=.*?>(.*?)</span>", html).group(1)
diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py
index 8c32d36a4..615840428 100644
--- a/module/web/pyload/views.py
+++ b/module/web/pyload/views.py
@@ -341,7 +341,6 @@ def config(request):
continue
else:
continue
-
elif sec == "Accounts":
if ";" in okey:
action, name = okey.split(";")