summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/UploadedTo.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-10-02 22:14:08 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-10-02 22:14:08 +0200
commit5a679eeada699b74e29bf8947d25ae3e83289180 (patch)
tree61ee647b97ecf14a7d3516f29962507e70b3a560 /module/plugins/accounts/UploadedTo.py
parenturlencode fix (diff)
downloadpyload-5a679eeada699b74e29bf8947d25ae3e83289180.tar.xz
improved accountmanager
Diffstat (limited to 'module/plugins/accounts/UploadedTo.py')
-rw-r--r--module/plugins/accounts/UploadedTo.py34
1 files changed, 12 insertions, 22 deletions
diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py
index 99141f20a..a783d9154 100644
--- a/module/plugins/accounts/UploadedTo.py
+++ b/module/plugins/accounts/UploadedTo.py
@@ -29,27 +29,17 @@ class UploadedTo(Account):
__author_name__ = ("mkaay")
__author_mail__ = ("mkaay@mkaay.de")
- def getAccountInfo(self, user):
- try:
- data = None
- for account in self.accounts.items():
- if account[0] == user:
- data = account[1]
- if not data:
- raise Exception
- req = self.core.requestFactory.getRequest(self.__name__, user)
- html = req.load("http://uploaded.to/?setlang=en", cookies=True)
- raw_traffic = re.search(r"Traffic left: </span><span class=.*?>(.*?)</span>", html).group(1)
- raw_valid = re.search(r"Valid until: </span> <span class=.*?>(.*?)</span>", html).group(1)
- traffic = int(self.parseTraffic(raw_traffic))
- validuntil = int(mktime(strptime(raw_valid.strip(), "%d-%m-%Y %H:%M")))
- out = Account.getAccountInfo(self, user)
- tmp = {"validuntil":validuntil, "trafficleft":traffic, "maxtraffic":100*1024*1024}
- out.update(tmp)
- return out
- except:
- return Account.getAccountInfo(self, user)
-
+ def loadAccountInfo(self, user):
+ req = self.getAccountRequest(user)
+ html = req.load("http://uploaded.to/?setlang=en", cookies=True)
+ raw_traffic = re.search(r"Traffic left: </span><span class=.*?>(.*?)</span>", html).group(1)
+ raw_valid = re.search(r"Valid until: </span> <span class=.*?>(.*?)</span>", html).group(1)
+ traffic = int(self.parseTraffic(raw_traffic))
+ validuntil = int(mktime(strptime(raw_valid.strip(), "%d-%m-%Y %H:%M")))
+
+ tmp = {"validuntil":validuntil, "trafficleft":traffic, "maxtraffic":100*1024*1024}
+ return tmp
+
def login(self, user, data):
- req = self.core.requestFactory.getRequest(self.__name__, user)
+ req = self.getAccountRequest()
req.load("http://uploaded.to/login", post={ "email" : user, "password" : data["password"]}, cookies=True)