diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-07-01 17:48:52 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-07-01 17:48:52 +0200 |
commit | c0d3b2d6dd9f34dcf53db7047defdcc2c214eb79 (patch) | |
tree | 44a552faaa4d119e1a547a1e74fef54e853a110e /module | |
parent | new api class + documentation (diff) | |
download | pyload-c0d3b2d6dd9f34dcf53db7047defdcc2c214eb79.tar.xz |
sphinx documentation
Diffstat (limited to 'module')
-rw-r--r-- | module/Api.py | 5 | ||||
-rw-r--r-- | module/PyFile.py | 4 | ||||
-rw-r--r-- | module/PyPackage.py | 12 | ||||
-rw-r--r-- | module/plugins/Account.py | 5 | ||||
-rw-r--r-- | module/plugins/Hook.py | 3 | ||||
-rw-r--r-- | module/plugins/Plugin.py | 41 |
6 files changed, 45 insertions, 25 deletions
diff --git a/module/Api.py b/module/Api.py index 85e3d233a..d4dae3966 100644 --- a/module/Api.py +++ b/module/Api.py @@ -31,11 +31,12 @@ from module.utils import freeSpace, compare_time class Api(Iface): """ - ===pyLoads API=== + **pyLoads API** + + This is accessible either internal via core.api or via thrift backend. see Thrift specification file remote/thriftbackend/pyload.thrift\ for information about data structures and what methods are usuable with rpc. - """ def __init__(self, core): diff --git a/module/PyFile.py b/module/PyFile.py index b5384c399..b230f9e0b 100644 --- a/module/PyFile.py +++ b/module/PyFile.py @@ -48,7 +48,9 @@ def setSize(self, value): self._size = int(value) class PyFile(object): - + """ + Represents a file object at runtime + """ __slots__ = ("m", "id", "url", "name", "size", "_size", "status", "pluginname", "packageid", "error", "order", "lock", "plugin", "waitUntil", "active", "abort", "reconnected", "progress", "pluginmodule", "pluginclass") diff --git a/module/PyPackage.py b/module/PyPackage.py index 42fa129f9..bc9b8094f 100644 --- a/module/PyPackage.py +++ b/module/PyPackage.py @@ -20,6 +20,9 @@ from module.PullEvents import UpdateEvent class PyPackage(): + """ + Represents a package object at runtime + """ def __init__(self, manager, id, name, folder, site, password, queue, order, priority): self.m = manager self.m.packageCache[int(id)] = self @@ -37,14 +40,9 @@ class PyPackage(): self.setFinished = False def toDict(self): - """return data as dict - - format: - - { - id: {'name': name ... 'links': {} } } - } + """ Returns a dictionary representation of the data. + :return: dict: {id: { attr: value }} """ return { self.id: { 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 |