diff options
| author | 2014-07-14 03:52:43 +0200 | |
|---|---|---|
| committer | 2014-07-14 03:52:43 +0200 | |
| commit | 6095d23005ad6f381d7d224609ebcd194240ce6d (patch) | |
| tree | 6e1e095ba94fd88f01b2bef7fd5c7f1f618b1194 /module/plugins | |
| parent | save_path and save_join renamed to safe_path and safe_join (diff) | |
| download | pyload-6095d23005ad6f381d7d224609ebcd194240ce6d.tar.xz | |
[Plugin] Call api faster
Diffstat (limited to 'module/plugins')
| -rw-r--r-- | module/plugins/Crypter.py | 8 | ||||
| -rw-r--r-- | module/plugins/Plugin.py | 29 | 
2 files changed, 27 insertions, 10 deletions
| diff --git a/module/plugins/Crypter.py b/module/plugins/Crypter.py index 6c73edc60..6a0fd467b 100644 --- a/module/plugins/Crypter.py +++ b/module/plugins/Crypter.py @@ -49,14 +49,14 @@ class Crypter(Plugin):              links = [x.decode("utf-8") for x in links] -            pid = self.core.api.addPackage(name, links, self.pyfile.package().queue) +            pid = self.api.addPackage(name, links, self.pyfile.package().queue)              if name != folder is not None: -                self.core.api.setPackageData(pid, {"folder": folder})  #: Due to not break API addPackage method right now +                self.api.setPackageData(pid, {"folder": folder})  #: Due to not break API addPackage method right now                  self.logDebug("Set package %(name)s folder to %(folder)s" % {"name": name, "folder": folder})              if self.pyfile.package().password: -                self.core.api.setPackageData(pid, {"password": self.pyfile.package().password}) +                self.api.setPackageData(pid, {"password": self.pyfile.package().password})          if self.urls: -            self.core.api.generateAndAddPackages(self.urls) +            self.api.generateAndAddPackages(self.urls) diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 51fa7c87c..c12a7f114 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -153,10 +153,13 @@ class Plugin(Base):      def __init__(self, pyfile):          Base.__init__(self, pyfile.m.core) +        #: engage wan reconnection          self.wantReconnect = False -        #: enables simultaneous processing of multiple downloads + +        #: enable simultaneous processing of multiple downloads          self.multiDL = True          self.limitDL = 0 +          #: chunk limit          self.chunkLimit = 1          self.resumeDownload = False @@ -165,7 +168,9 @@ class Plugin(Base):          self.waitUntil = 0          self.waiting = False -        self.ocr = None  #captcha reader instance +        #: captcha reader instance +        self.ocr = None +          #: account handler instance, see :py:class:`Account`          self.account = pyfile.m.core.accountManager.getAccountPlugin(self.__name__) @@ -174,7 +179,9 @@ class Plugin(Base):          #: username/login          self.user = None -        if self.account and not self.account.canUse(): self.account = None +        if self.account and not self.account.canUse(): +            self.account = None +          if self.account:              self.user, data = self.account.selectAccount()              #: Browser instance, see `network.Browser` @@ -190,18 +197,28 @@ class Plugin(Base):          #: associated pyfile instance, see `PyFile`          self.pyfile = pyfile +          self.thread = None # holds thread in future          #: location where the last call to download was saved          self.lastDownload = ""          #: re match of the last call to `checkDownload`          self.lastCheck = None +          #: js engine, see `JsEngine`          self.js = self.core.js -        self.cTask = None #captcha task -        self.retries = 0 # amount of retries already made -        self.html = None # some plugins store html code here +        #: captcha task +        self.cTask = None + +        #: amount of retries already made +        self.retries = 0 + +        #: some plugins store html code here +        self.html = None + +        #: quick caller for API +        self.api = self.core.api           self.init() | 
