diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-10-03 20:53:22 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-10-03 20:53:22 +0200 |
commit | 405aa7a9953481a39a4f08f3677fbe9e1523f997 (patch) | |
tree | a62686503ac94118b2f282c34c00512dabff0339 /module/plugins/Account.py | |
parent | shareonline expire date fix (diff) | |
download | pyload-405aa7a9953481a39a4f08f3677fbe9e1523f997.tar.xz |
time settings for accounts
Diffstat (limited to 'module/plugins/Account.py')
-rw-r--r-- | module/plugins/Account.py | 29 |
1 files changed, 22 insertions, 7 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): |