summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-07-01 17:48:52 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-07-01 17:48:52 +0200
commitc0d3b2d6dd9f34dcf53db7047defdcc2c214eb79 (patch)
tree44a552faaa4d119e1a547a1e74fef54e853a110e /module/plugins
parentnew api class + documentation (diff)
downloadpyload-c0d3b2d6dd9f34dcf53db7047defdcc2c214eb79.tar.xz
sphinx documentation
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/Account.py5
-rw-r--r--module/plugins/Hook.py3
-rw-r--r--module/plugins/Plugin.py41
3 files changed, 34 insertions, 15 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py
index 732133d3a..adee39559 100644
--- a/module/plugins/Account.py
+++ b/module/plugins/Account.py
@@ -28,6 +28,11 @@ class WrongPassword(Exception):
class Account():
+ """
+ Base class for every Account plugin.
+ Just overwrite `login` and cookies will be stored and account becomes accessible in\
+ associated hoster plugin. Plugin should also provide `loadAccountInfo`
+ """
__name__ = "Account"
__version__ = "0.2"
__type__ = "account"
diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py
index 5c8a3384f..8a6355fcd 100644
--- a/module/plugins/Hook.py
+++ b/module/plugins/Hook.py
@@ -40,6 +40,9 @@ def threaded(f):
return run
class Hook():
+ """
+ Base class for hook plugins.
+ """
__name__ = "Hook"
__version__ = "0.2"
__type__ = "hook"
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index 9caf4d81a..4eb0ee477 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -68,6 +68,10 @@ class SkipDownload(Exception):
class Plugin(object):
+ """
+ Base plugin for hoster/crypter.
+ Overwrite `process` / `decrypt` in your subclassed plugin.
+ """
__name__ = "Plugin"
__version__ = "0.4"
__pattern__ = None
@@ -82,16 +86,20 @@ class Plugin(object):
self.core = pyfile.m.core
self.wantReconnect = False
- self.multiDL = True #: enables simultaneous processing of multiple downloads
+ #: enables simultaneous processing of multiple downloads
+ self.multiDL = True
self.limitDL = 0
+ #: chunk limit
self.chunkLimit = 1
self.resumeDownload = False
- self.waitUntil = 0 #: time() + wait in seconds
+ #: time() + wait in seconds
+ self.waitUntil = 0
self.waiting = False
self.ocr = None #captcha reader instance
- self.account = pyfile.m.core.accountManager.getAccountPlugin(self.__name__) #: account handler instance, see :py:class:`Account`
+ #: account handler instance, see :py:class:`Account`
+ self.account = pyfile.m.core.accountManager.getAccountPlugin(self.__name__)
self.premium = False
self.user = None
@@ -101,10 +109,12 @@ class Plugin(object):
self.user, data = self.account.selectAccount()
#: Browser instance, see `network.Browser`
self.req = self.account.getAccountRequest(self.user)
- self.chunkLimit = -1 #: chunk limit, -1 for unlimited
- self.resumeDownload = True #: enables resume (will be ignored if server dont accept chunks)
+ self.chunkLimit = -1 # chunk limit, -1 for unlimited
+ #: enables resume (will be ignored if server dont accept chunks)
+ self.resumeDownload = True
self.multiDL = True #every hoster with account should provide multiple downloads
- self.premium = self.account.isPremium(self.user) #: premium status
+ #: premium status
+ self.premium = self.account.isPremium(self.user)
else:
self.req = pyfile.m.core.requestFactory.getRequest(self.__name__)
@@ -113,13 +123,16 @@ class Plugin(object):
self.pyfile = pyfile
self.thread = None # holds thread in future
- self.lastDownload = "" #: location where the last call to download was saved
- self.lastCheck = None #: re match of the last call to `checkDownload`
- self.js = self.core.js #: js engine, see `JsEngine`
+ #: 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
+ self.retries = 0 # amount of retries already made
+ self.html = None # some plugins store html code here
self.init()
@@ -132,9 +145,7 @@ class Plugin(object):
return self.__name__
def init(self):
- """
- initialize the plugin (in addition to `__init__`)
- """
+ """initialize the plugin (in addition to `__init__`)"""
pass
def setup(self):
@@ -156,7 +167,7 @@ class Plugin(object):
return self.process(self.pyfile)
- #----------------------------------------------------------------------
+
def process(self, pyfile):
"""the 'main' method of every plugin, you **have to** overwrite it"""
raise NotImplementedError