From 46bac1946a3d3f8346517e9a42da457646074c44 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Thu, 12 Aug 2010 11:47:23 +0200 Subject: account fixes --- module/plugins/Account.py | 11 +++++++++-- module/plugins/accounts/RapidshareCom.py | 5 ++++- module/plugins/accounts/UploadedTo.py | 7 +++++-- 3 files changed, 18 insertions(+), 5 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/Account.py b/module/plugins/Account.py index de5fb00d6..bdbbd4c1c 100644 --- a/module/plugins/Account.py +++ b/module/plugins/Account.py @@ -43,8 +43,13 @@ class Account(): for user, data in self.accounts: self.login(user, data) - def updateAccounts(self, user, password): - self.accounts[user]["password"] if self.accounts.has_key(user) else self.accounts[user] = {"password":password} + def updateAccounts(self, user, password, options): + if self.accounts.has_key(user): + self.accounts[user]["password"] = password + self.accounts[user]["options"] = options + else: + self.accounts[user] = {"password" : password, "options": options} + self.login(user, self.accounts[user]) def removeAccount(self, user): @@ -54,6 +59,8 @@ class Account(): return { "validuntil": None, "login": name, + "password": self.accounts[name]["password"], + "options": self.accounts[name]["options"], "trafficleft": None, "type": self.__name__ } diff --git a/module/plugins/accounts/RapidshareCom.py b/module/plugins/accounts/RapidshareCom.py index 233cd9801..052470ada 100644 --- a/module/plugins/accounts/RapidshareCom.py +++ b/module/plugins/accounts/RapidshareCom.py @@ -47,7 +47,10 @@ class RapidshareCom(Account): continue k, v = t.split("=") info[k] = v - out = {"validuntil":None, "login":str(info["accountid"]), "trafficleft":int(info["tskb"]), "type":self.__name__} + + out = Account.getAccountInfo(self, user) + tmp = {"validuntil":None, "login":str(info["accountid"]), "trafficleft":int(info["tskb"]), "type":self.__name__} + out.update(tmp) return out diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index 242e6cd5e..d2aa22b22 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -42,8 +42,11 @@ class UploadedTo(Account): raw_valid = re.search(r"Valid until: (.*?)", html).group(1) traffic = int(self.parseTraffic(raw_traffic)) validuntil = int(mktime(strptime(raw_valid.strip(), "%d-%m-%Y %H:%M"))) - return {"login":user, "validuntil":validuntil, "trafficleft":traffic, "type":self.__name__} - + out = Account.getAccountInfo(self, user) + tmp = {"login":user, "validuntil":validuntil, "trafficleft":traffic, "type":self.__name__} + out.update(tmp) + return out + def login(self, user, data): req = self.core.requestFactory.getRequest(self.__name__, user) req.load("http://uploaded.to/login", None, { "email" : user, "password" : data["password"]}, cookies=True) -- cgit v1.2.3