summaryrefslogtreecommitdiffstats
path: root/module/plugins/Account.py
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-08-05 13:16:31 +0200
committerGravatar mkaay <mkaay@mkaay.de> 2010-08-05 13:16:31 +0200
commit869ea1524bede723e721b29a2b86a3ca66d5536f (patch)
tree82fa33395df09d1baedb379e9a833c880fd1159a /module/plugins/Account.py
parentfile version check, delete old configs! (diff)
downloadpyload-869ea1524bede723e721b29a2b86a3ca66d5536f.tar.xz
config parser fix, UploadedTo premium working
Diffstat (limited to 'module/plugins/Account.py')
-rw-r--r--module/plugins/Account.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py
index 91636bc5d..af1c4a383 100644
--- a/module/plugins/Account.py
+++ b/module/plugins/Account.py
@@ -17,12 +17,12 @@
@author: mkaay
"""
-from random import choice
+from random import randrange
import re
class Account():
__name__ = "Account"
- __version__ = "0.1"
+ __version__ = "0.2"
__type__ = "account"
__description__ = """Account Plugin"""
__author_name__ = ("mkaay")
@@ -31,16 +31,18 @@ class Account():
def __init__(self, manager, accounts):
self.manager = manager
self.core = manager.core
- self.accounts = accounts
+ self.accounts = {}
+ self.register = {}
+ self.setAccounts(accounts)
def login(self):
pass
def setAccounts(self, accounts):
- #@TODO improve
self.accounts = accounts
+ self.login()
- def getAccountInfo(self, namepass):
+ def getAccountInfo(self, name):
return {
"validuntil": None,
"login": name,
@@ -52,19 +54,24 @@ class Account():
pass
def getAccountRequest(self, plugin):
- account = self.getAccountData(plugin)
- req = self.core.requestFactory.getRequest(self.__name__, account[0])
+ user, data = self.getAccountData(plugin)
+ req = self.core.requestFactory.getRequest(self.__name__, user)
return req
def getAccountData(self, plugin):
if not len(self.accounts):
return None
if not self.register.has_key(plugin):
- account = self.accounts[randrange(0, len(self.accounts), 1)]
+ account = self.selectAccount(plugin)
+ self.register[plugin] = account
else:
account = self.register[plugin]
return account
+ def selectAccount(self, plugin):
+ account = self.accounts.items()[randrange(0, len(self.accounts), 1)]
+ return account
+
def parseTraffic(self, string): #returns kbyte
string = string.strip().lower()
p = re.compile(r"(\d+[\.,]\d+)(.*)")