diff options
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/Account.py | 29 | ||||
-rw-r--r-- | module/plugins/accounts/HotfileCom.py | 3 | ||||
-rw-r--r-- | module/plugins/accounts/UploadedTo.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/HotfileCom.py | 3 |
4 files changed, 26 insertions, 11 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py index 16f2a7b92..8c400f6e5 100644 --- a/module/plugins/Account.py +++ b/module/plugins/Account.py @@ -60,10 +60,12 @@ class Account(): for user, data in self.accounts.iteritems(): self._login(user, data) - def updateAccounts(self, user, password, options): + def updateAccounts(self, user, password=None, options={}): if self.accounts.has_key(user): - self.accounts[user]["password"] = password - self.accounts[user]["options"] = options + if password: + self.accounts[user]["password"] = password + if options: + self.accounts[user]["options"].update(options) self.accounts[user]["valid"] = True else: self.accounts[user] = {"password" : password, "options": options, "valid": True} @@ -109,12 +111,18 @@ class Account(): def getAccountRequest(self, user=None): if not user: user, data = self.selectAccount() + if not user: + return None + req = self.core.requestFactory.getRequest(self.__name__, user) return req def getAccountCookies(self, user=None): if not user: user, data = self.selectAccount() + if not user: + return None + cj = self.core.requestFactory.getCookieJar(self.__name__, user) return cj @@ -126,13 +134,20 @@ class Account(): usable = [] for user,data in self.accounts.iteritems(): if not data["valid"]: continue - for option, value in data["options"]: - pass - #@TODO comparate time option + + if data["options"].has_key("time"): + time = data["options"]["time"][0] + try: + start, end = time.split("-") + if not self.core.compare_time(start.split(":"), end.split(":")): + continue + except: + self.core.log.error(_("Your Time %s has wrong format, use: 1:22-3:44") % time) + usable.append((user, data)) - if not usable: return None + if not usable: return None, None return choice(usable) def canUse(self): diff --git a/module/plugins/accounts/HotfileCom.py b/module/plugins/accounts/HotfileCom.py index 83551949d..f623e56f1 100644 --- a/module/plugins/accounts/HotfileCom.py +++ b/module/plugins/accounts/HotfileCom.py @@ -19,7 +19,6 @@ from module.plugins.Account import Account from time import strptime, mktime -from urllib import unquote import hashlib class HotfileCom(Account): @@ -69,7 +68,7 @@ class HotfileCom(Account): post.update({"action": method}) post.update({"username":user, "passwordmd5dig":pwhash, "digest":digest}) - return unquote(req.load("http://api.hotfile.com/", post=post)).strip() + return req.load("http://api.hotfile.com/", post=post) def login(self, user, data): req = self.getAccountRequest(user) diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index 9b51f5aad..4c45fb6fc 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -41,7 +41,7 @@ class UploadedTo(Account): return tmp def login(self, user, data): - req = self.getAccountRequest() + req = self.getAccountRequest(user) page = req.load("http://uploaded.to/login", post={ "email" : user, "password" : data["password"]}, cookies=True) if "Login failed!" in page: self.wrongPassword() diff --git a/module/plugins/hoster/HotfileCom.py b/module/plugins/hoster/HotfileCom.py index 3b88efe1f..228f31649 100644 --- a/module/plugins/hoster/HotfileCom.py +++ b/module/plugins/hoster/HotfileCom.py @@ -56,7 +56,7 @@ class HotfileCom(Hoster): elif self.account and login: return self.account.apiCall(method, post, self.user) post.update({"action": method}) - return unquote(self.load("http://api.hotfile.com/", post=post)).strip() + return self.load("http://api.hotfile.com/", post=post) def process(self, pyfile): self.wantReconnect = False @@ -81,6 +81,7 @@ class HotfileCom(Hoster): self.freeDownload() else: dl = self.account.apiCall("getdirectdownloadlink", {"link":self.pyfile.url}, self.user) + dl = unquote(dl).strip() self.download(dl) def downloadHTML(self): |