diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/access_api.rst | 14 | ||||
-rw-r--r-- | docs/conf.py | 4 | ||||
-rw-r--r-- | docs/docs.conf | 4 | ||||
-rw-r--r-- | docs/index.rst | 2 | ||||
-rw-r--r-- | docs/module_overview.rst | 20 | ||||
-rw-r--r-- | docs/write_hooks.rst | 40 | ||||
-rw-r--r-- | docs/write_plugins.rst | 18 |
7 files changed, 51 insertions, 51 deletions
diff --git a/docs/access_api.rst b/docs/access_api.rst index ce78364b9..d83698aa3 100644 --- a/docs/access_api.rst +++ b/docs/access_api.rst @@ -13,12 +13,12 @@ First of all, you need to know what you can do with our API. It lets you do all retrieving download status, manage queue, manage accounts, modify config and so on. This document is not intended to explain every function in detail, for a complete listing -see :class:`Api <module.Api.Api>`. +see :class:`Api <pyload.Api.Api>`. Of course its possible to access the ``core.api`` attribute in plugins and hooks, but much more interesting is the possibillity to call function from different programs written in many different languages. -pyLoad uses thrift as backend and provides its :class:`Api <module.Api.Api>` as service. +pyLoad uses thrift as backend and provides its :class:`Api <pyload.Api.Api>` as service. More information about thrift can be found here http://wiki.apache.org/thrift/. @@ -26,7 +26,7 @@ Using Thrift ------------ Every thrift service has to define all data structures and declare every method which should be usable via rpc. -This file is located :file:`module/remote/thriftbackend/pyload.thrift`, its very helpful to inform about +This file is located :file:`pyload/remote/thriftbackend/pyload.thrift`, its very helpful to inform about arguments and detailed structure of return types. However it does not contain any information about what the functions does. Assuming you want to use the API in any other language than python than check if it is @@ -48,7 +48,7 @@ In case you want to use python, pyload has already all files included to access A basic script that prints out some information: :: - from module.remote.thriftbackend.ThriftClient import ThriftClient, WrongLogin + from pyload.remote.thriftbackend.ThriftClient import ThriftClient, WrongLogin try: client = ThriftClient(host="127.0.0.1", port=7227, user="User", password="yourpw") @@ -92,14 +92,14 @@ so pyLoad can authenticate you. Calling Methods =============== -In general you can use any method listed at the :class:`Api <module.Api.Api>` documentation, which is also available to +In general you can use any method listed at the :class:`Api <pyload.Api.Api>` documentation, which is also available to the thriftbackend. Access works simply via ``http://pyload-core/api/methodName``, where ``pyload-core`` is the ip address or hostname including the webinterface port. By default on local access this would be `localhost:8000`. The return value will be formatted in JSON, complex data types as dictionaries. -As mentionted above for a documentation about the return types look at the thrift specification file :file:`module/remote/thriftbackend/pyload.thrift`. +As mentionted above for a documentation about the return types look at the thrift specification file :file:`pyload/remote/thriftbackend/pyload.thrift`. ================== Passing parameters @@ -107,7 +107,7 @@ Passing parameters To pass arguments you have two choices. Either use positional arguments, eg ``http://pyload-core/api/getFileData/1``, where 1 is the FileID, or use keyword arguments -supplied via GET or POST ``http://pyload-core/api/getFileData?fid=1``. You can find the argument names in the :class:`Api <module.Api.Api>` +supplied via GET or POST ``http://pyload-core/api/getFileData?fid=1``. You can find the argument names in the :class:`Api <pyload.Api.Api>` documentation. It is important that *all* arguments are in JSON format. So ``http://pyload-core/api/getFileData/1`` is valid because diff --git a/docs/conf.py b/docs/conf.py index b5976d2fc..62ad33bb7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -16,7 +16,7 @@ from os.path import dirname, join, abspath dir_name = join(dirname(abspath(""))) sys.path.append(dir_name) -sys.path.append(join(dir_name, "module", "lib")) +sys.path.append(join(dir_name, "pyload", "lib")) # If extensions (or modules to document with autodoc) are in another directory, @@ -128,7 +128,7 @@ html_theme = 'default' # The name of an image file (relative to this directory) to place at the top # of the sidebar. -html_logo = join(dir_name, "module", "web", "media", "default", "img", "pyload-logo-edited3.5-new-font-small.png") +html_logo = join(dir_name, "pyload", "web", "media", "default", "img", "pyload-logo-edited3.5-new-font-small.png") # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 diff --git a/docs/docs.conf b/docs/docs.conf index 0f30ab89e..fd2987784 100644 --- a/docs/docs.conf +++ b/docs/docs.conf @@ -3,12 +3,12 @@ [epydoc] -modules: pyload.py, pyload-cli.py, module +modules: pyload.py, pyload-cli.py, pyload output: html target: docs docformat: restructuredtext -exclude: module\.lib|module\.remote\.thriftbackend\.thriftgen|\.pyc|\.pyo|module\.plugins\.(accounts|container|crypter|hooks|hoster|internal|ocr) +exclude: pyload\.lib|pyload\.remote\.thriftbackend\.thriftgen|\.pyc|\.pyo|pyload\.plugins\.(accounts|container|crypter|hooks|hoster|internal|ocr) name: pyLoad Documentation url: http://docs.pyload.org diff --git a/docs/index.rst b/docs/index.rst index 757fd7537..ff40ff3cb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -20,7 +20,7 @@ Contents: extend_pyload.rst module_overview.rst -.. currentmodule:: module +.. currentmodule:: pyload ================== diff --git a/docs/module_overview.rst b/docs/module_overview.rst index d51202c88..8cea3874b 100644 --- a/docs/module_overview.rst +++ b/docs/module_overview.rst @@ -4,14 +4,14 @@ Module Overview You can find an overview of some important classes here: .. autosummary:: - :toctree: module + :toctree: pyload - module.Api.Api - module.plugins.Plugin.Base - module.plugins.Plugin.Plugin - module.plugins.Crypter.Crypter - module.plugins.Account.Account - module.plugins.Hook.Hook - module.HookManager.HookManager - module.PyFile.PyFile - module.PyPackage.PyPackage + pyload.Api.Api + pyload.plugins.Plugin.Base + pyload.plugins.Plugin.Plugin + pyload.plugins.Crypter.Crypter + pyload.plugins.Account.Account + pyload.plugins.Hook.Hook + pyload.HookManager.HookManager + pyload.PyFile.PyFile + pyload.PyPackage.PyPackage diff --git a/docs/write_hooks.rst b/docs/write_hooks.rst index a088a3ed3..5508f5a0c 100644 --- a/docs/write_hooks.rst +++ b/docs/write_hooks.rst @@ -3,20 +3,20 @@ Hooks ===== -A Hook is a python file which is located at :file:`module/plugins/hooks`. -The :class:`HookManager <module.HookManager.HookManager>` will load it automatically on startup. Only one instance exists -over the complete lifetime of pyload. Your hook can interact on various events called by the :class:`HookManager <module.HookManager.HookManager>`, -do something complete autonomic and has full access to the :class:`Api <module.Api.Api>` and every detail of pyLoad. +A Hook is a python file which is located at :file:`pyload/plugins/hooks`. +The :class:`HookManager <pyload.HookManager.HookManager>` will load it automatically on startup. Only one instance exists +over the complete lifetime of pyload. Your hook can interact on various events called by the :class:`HookManager <pyload.HookManager.HookManager>`, +do something complete autonomic and has full access to the :class:`Api <pyload.Api.Api>` and every detail of pyLoad. The UpdateManager, CaptchaTrader, UnRar and many more are realised as hooks. Hook header ----------- -Your hook needs to subclass :class:`Hook <module.plugins.Hook.Hook>` and will inherit all of its method, make sure to check its documentation! +Your hook needs to subclass :class:`Hook <pyload.plugins.Hook.Hook>` and will inherit all of its method, make sure to check its documentation! All Hooks should start with something like this: :: - from module.plugins.Hook import Hook + from pyload.plugins.Hook import Hook class YourHook(Hook): __name__ = "YourHook" @@ -42,16 +42,16 @@ Interacting on Events The next step is to think about where your Hook action takes places. -The easiest way is to overwrite specific methods defined by the :class:`Hook <module.plugins.Hook.Hook>` base class. +The easiest way is to overwrite specific methods defined by the :class:`Hook <pyload.plugins.Hook.Hook>` base class. The name is indicating when the function gets called. -See :class:`Hook <module.plugins.Hook.Hook>` page for a complete listing. +See :class:`Hook <pyload.plugins.Hook.Hook>` page for a complete listing. -You should be aware of the arguments the Hooks are called with, whether its a :class:`PyFile <module.PyFile.PyFile>` -or :class:`PyPackage <module.PyPackage.PyPackage>` you should read its related documentation to know how to access her great power and manipulate them. +You should be aware of the arguments the Hooks are called with, whether its a :class:`PyFile <pyload.PyFile.PyFile>` +or :class:`PyPackage <pyload.PyPackage.PyPackage>` you should read its related documentation to know how to access her great power and manipulate them. A basic excerpt would look like: :: - from module.plugins.Hook import Hook + from pyload.plugins.Hook import Hook class YourHook(Hook): """ @@ -66,12 +66,12 @@ A basic excerpt would look like: :: Another and more flexible and powerful way is to use event listener. All hook methods exists as event and very useful additional events are dispatched by the core. For a little overview look -at :class:`HookManager <module.HookManager.HookManager>`. Keep in mind that you can define own events and other people may listen on them. +at :class:`HookManager <pyload.HookManager.HookManager>`. Keep in mind that you can define own events and other people may listen on them. For your convenience it's possible to register listeners automatical via the ``event_map`` attribute. It requires a `dict` that maps event names to function names or a `list` of function names. It's important that all names are strings :: - from module.plugins.Hook import Hook + from pyload.plugins.Hook import Hook class YourHook(Hook): """ @@ -92,7 +92,7 @@ It requires a `dict` that maps event names to function names or a `list` of func An advantage of the event listener is that you are able to register and remove the listeners at runtime. Use `self.manager.addEvent("name", function)`, `self.manager.removeEvent("name", function)` and see doc for -:class:`HookManager <module.HookManager.HookManager>`. Contrary to ``event_map``, ``function`` has to be a reference +:class:`HookManager <pyload.HookManager.HookManager>`. Contrary to ``event_map``, ``function`` has to be a reference and **not** a `string`. We introduced events because it scales better if there a a huge amount of events and hooks. So all future interaction will be exclusive @@ -102,12 +102,12 @@ available as event and not accessible through overwriting hook methods. However Providing RPC services ---------------------- -You may noticed that pyLoad has an :class:`Api <module.Api.Api>`, which can be used internal or called by clients via RPC. +You may noticed that pyLoad has an :class:`Api <pyload.Api.Api>`, which can be used internal or called by clients via RPC. So probably clients want to be able to interact with your hook to request it's state or invoke some action. Sounds complicated but is very easy to do. Just use the ``Expose`` decorator: :: - from module.plugins.Hook import Hook, Expose + from pyload.plugins.Hook import Hook, Expose class YourHook(Hook): """ @@ -118,7 +118,7 @@ Sounds complicated but is very easy to do. Just use the ``Expose`` decorator: :: def invoke(self, arg): print "Invoked with", arg -Thats all, it's available via the :class:`Api <module.Api.Api>` now. If you want to use it read :ref:`access_api`. +Thats all, it's available via the :class:`Api <pyload.Api.Api>` now. If you want to use it read :ref:`access_api`. Here is a basic example: :: #Assuming client is a ThriftClient or Api object @@ -128,11 +128,11 @@ Here is a basic example: :: Providing status information ---------------------------- -Your hook can store information in a ``dict`` that can easily be retrievied via the :class:`Api <module.Api.Api>`. +Your hook can store information in a ``dict`` that can easily be retrievied via the :class:`Api <pyload.Api.Api>`. Just store everything in ``self.info``. :: - from module.plugins.Hook import Hook + from pyload.plugins.Hook import Hook class YourHook(Hook): """ @@ -155,4 +155,4 @@ Example ------- Sorry but you won't find an example here ;-) - Look at :file:`module/plugins/hooks` and you will find plenty examples there. + Look at :file:`pyload/plugins/hooks` and you will find plenty examples there. diff --git a/docs/write_plugins.rst b/docs/write_plugins.rst index ff3be66d0..c2b25a934 100644 --- a/docs/write_plugins.rst +++ b/docs/write_plugins.rst @@ -3,11 +3,11 @@ Plugins ======= -A Plugin is a python file located at one of the subfolders in :file:`module/plugins/`. Either :file:`hoster`, :file:`crypter` +A Plugin is a python file located at one of the subfolders in :file:`pyload/plugins/`. Either :file:`hoster`, :file:`crypter` or :file:`container`, depending of it's type. There are three kinds of different plugins: **Hoster**, **Crypter**, **Container**. -All kind of plugins inherit from the base :class:`Plugin <module.plugins.Plugin.Plugin>`. You should know its +All kind of plugins inherit from the base :class:`Plugin <pyload.plugins.Plugin.Plugin>`. You should know its convenient methods, they make your work easier ;-) Every plugin defines a ``__pattern__`` and when the user adds urls, every url is matched against the pattern defined in @@ -19,7 +19,7 @@ Plugin header How basic hoster plugin header could look like: :: - from module.plugin.Hoster import Hoster + from pyload.plugin.Hoster import Hoster class MyFileHoster(Hoster): __name__ = "MyFileHoster" @@ -41,7 +41,7 @@ We head to the next important section, the ``process`` method of your plugin. In fact the ``process`` method is the only functionality your plugin has to provide, but its always a good idea to split up tasks to not produce spaghetti code. An example ``process`` function could look like this :: - from module.plugin.Hoster import Hoster + from pyload.plugin.Hoster import Hoster class MyFileHoster(Hoster): """ @@ -58,7 +58,7 @@ An example ``process`` function could look like this :: # download the file, destination is determined by pyLoad self.download(parsed_url) -You need to know about the :class:`PyFile <module.PyFile.PyFile>` class, since an instance of it is given as parameter to every pyfile. +You need to know about the :class:`PyFile <pyload.PyFile.PyFile>` class, since an instance of it is given as parameter to every pyfile. Some tasks your plugin should handle: proof if file is online, get filename, wait if needed, download the file, etc.. Wait times @@ -71,7 +71,7 @@ Captcha decrypting __________________ To handle captcha input just use ``self.decryptCaptcha(url, ...)``, it will be send to clients -or handled by :class:`Hook <module.plugins.Hook.Hook>` plugins +or handled by :class:`Hook <pyload.plugins.Hook.Hook>` plugins Crypter ------- @@ -81,7 +81,7 @@ Well, they work nearly the same, only that the function they have to provide is Example: :: - from module.plugin.Crypter import Crypter + from pyload.plugin.Crypter import Crypter class MyFileCrypter(Crypter): """ @@ -93,11 +93,11 @@ Example: :: self.packages.append(("pyLoad packages", urls, "pyLoad packages")) # urls list of urls -They can access all the methods from :class:`Plugin <module.plugins.Plugin.Plugin>`, but the important thing is they +They can access all the methods from :class:`Plugin <pyload.plugins.Plugin.Plugin>`, but the important thing is they have to append all packages they parsed to the `self.packages` list. Simply append tuples with `(name, urls, folder)`, where urls is the list of urls contained in the packages. Thats all of your work, pyLoad will know what to do with them. Examples -------- -Best examples are already existing plugins in :file:`module/plugins/`. +Best examples are already existing plugins in :file:`pyload/plugins/`. |