diff options
Diffstat (limited to 'module/plugins')
| -rw-r--r-- | module/plugins/Account.py | 31 | ||||
| -rw-r--r-- | module/plugins/Plugin.py | 2 | 
2 files changed, 10 insertions, 23 deletions
| diff --git a/module/plugins/Account.py b/module/plugins/Account.py index 7c8beec76..91636bc5d 100644 --- a/module/plugins/Account.py +++ b/module/plugins/Account.py @@ -17,7 +17,7 @@      @author: mkaay  """ -from random import randrange +from random import choice  import re  class Account(): @@ -28,19 +28,19 @@ class Account():      __author_name__ = ("mkaay")      __author_mail__ = ("mkaay@mkaay.de") -    def __init__(self, manager): +    def __init__(self, manager, accounts):          self.manager = manager          self.core = manager.core -        self.configParser = self.core.parser_plugins +        self.accounts = accounts -        self.accounts = [] -        self.register = {} -        self.loadAccounts() -          def login(self):          pass -    def getAccountInfo(self, name): +    def setAccounts(self, accounts): +        #@TODO improve +        self.accounts = accounts +     +    def getAccountInfo(self, namepass):          return {              "validuntil": None,              "login": name, @@ -49,26 +49,13 @@ class Account():          }      def getAllAccounts(self): -        return map(lambda t: self.getAccountInfo(t[0]), self.accounts) +        pass      def getAccountRequest(self, plugin):          account = self.getAccountData(plugin)          req = self.core.requestFactory.getRequest(self.__name__, account[0])          return req -     -    def loadAccounts(self): -        usernames = self.configParser.get(self.__name__, "username") -        passwords = self.configParser.get(self.__name__, "password") -         -        data = zip(usernames.split("\n"), passwords.split("\n")) -        self.accounts = [] -        for acc in data: -            t = (acc[0].strip(), acc[1].strip()) -            if t[0] and t[1]: -                self.accounts.append(t) -        self.login() -          def getAccountData(self, plugin):          if not len(self.accounts):              return None diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index de29dfc4e..19b5983a6 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -78,7 +78,7 @@ class Plugin(object):          self.premium = False          self.ocr = None  # captcha reader instance -        self.account = pyfile.m.core.accountManager.getAccount(self.__name__) # account handler instance +        self.account = pyfile.m.core.accountManager.getAccountPlugin(self.__name__) # account handler instance          self.req = pyfile.m.core.requestFactory.getRequest(self.__name__, self.account)          self.log = logging.getLogger("log") | 
