diff options
| -rw-r--r-- | module/AccountManager.py | 1 | ||||
| -rw-r--r-- | module/Scheduler.py | 15 | ||||
| -rw-r--r-- | module/gui/connector.py | 2 | ||||
| -rw-r--r-- | module/plugins/accounts/DepositfilesCom.py | 27 | ||||
| -rwxr-xr-x | pyLoadCore.py | 10 | 
5 files changed, 26 insertions, 29 deletions
| diff --git a/module/AccountManager.py b/module/AccountManager.py index 9234f367d..6bfb63820 100644 --- a/module/AccountManager.py +++ b/module/AccountManager.py @@ -140,7 +140,6 @@ class AccountManager():      #----------------------------------------------------------------------      def updateAccount(self, plugin , user, password, options):          """add or update account""" -        print accounts          if self.accounts.has_key(plugin):              p = self.getAccountPlugin(plugin)              p.updateAccounts(user, password, options) diff --git a/module/Scheduler.py b/module/Scheduler.py index 8c43ebae8..018b94e10 100644 --- a/module/Scheduler.py +++ b/module/Scheduler.py @@ -21,23 +21,12 @@ from time import sleep  from Queue import Queue  from threading import Thread -class Scheduler(Thread): +class Scheduler():      def __init__(self, core): -        Thread.__init__(self)          self.core = core          self.queue = Queue() -    def run(self): -        while True: -            j = self.queue.get() -            if j.call == "quit": -                break -            j.start() -         -    def stop(self): -        self.queue.put(Job(0, "quit")) -          def addJob(self, time, call, args=[], kwargs={}, done=None):          j = Job(time, call, args, kwargs, done)          self.queue.put(j) @@ -46,7 +35,7 @@ class Job(Thread):      def __init__(self, time, call, args=[], kwargs={}, done=None):          Thread.__init__(self)          self.time = float(time) -        self.interval = 0.2 +        self.interval = 0.5          self.call = call          self.done = done          self.args = args diff --git a/module/gui/connector.py b/module/gui/connector.py index 2554f4ced..5a375f459 100644 --- a/module/gui/connector.py +++ b/module/gui/connector.py @@ -16,7 +16,7 @@      @author: mkaay  """ -SERVER_VERSION = "0.4.1-dev" +SERVER_VERSION = "0.4.1"  from time import sleep  from uuid import uuid4 as uuid diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index 809381217..1410e6a37 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -30,18 +30,21 @@ class DepositfilesCom(Account):      __author_mail__ = ("mkaay@mkaay.de")      def getAccountInfo(self, user): -        req = self.core.requestFactory.getRequest(self.__name__, user) -         -        src = req.load("http://depositfiles.com/de/gold/") -        validuntil = re.search("noch den Gold-Zugriff: <b>(.*?)</b></div>", src).group(1) -         -        validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S"))) -         -        out = Account.getAccountInfo(self, user) -         -        tmp = {"validuntil":validuntil, "trafficleft":-1} -        out.update(tmp) -        return out +        try: +            req = self.core.requestFactory.getRequest(self.__name__, user) + +            src = req.load("http://depositfiles.com/de/gold/") +            validuntil = re.search("noch den Gold-Zugriff: <b>(.*?)</b></div>", src).group(1) + +            validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S"))) + +            out = Account.getAccountInfo(self, user) + +            tmp = {"validuntil":validuntil, "trafficleft":-1} +            out.update(tmp) +            return out +        except: +            return Account.getAccountInfo(self, user)      def login(self, user, data):          req = self.core.requestFactory.getRequest(self.__name__, user) diff --git a/pyLoadCore.py b/pyLoadCore.py index 263c67274..0bed53267 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -20,7 +20,7 @@      @author: mkaay      @version: v0.4.0  """ -CURRENT_VERSION = '0.4.1-dev' +CURRENT_VERSION = '0.4.1'  from getopt import GetoptError  from getopt import getopt @@ -288,7 +288,7 @@ class Core(object):                  f = open(link_file, "wb")                  f.close() -        self.scheduler.start() +        #self.scheduler.start()          self.scheduler.addJob(0, self.accountManager.cacheAccountInfos)          while True: @@ -305,6 +305,12 @@ class Core(object):              self.threadManager.work()              self.hookManager.periodical() +            try: +                j = self.scheduler.queue.get(False) +                j.start() +            except: +                pass +      def init_server(self):          try:              server_addr = (self.config['remote']['listenaddr'], int(self.config['remote']['port'])) | 
