diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/build_docs.py | 18 | ||||
-rw-r--r-- | docs/docs.conf | 2 | ||||
-rw-r--r-- | docs/module_overview.rst | 12 | ||||
-rw-r--r-- | docs/setup.cfg | 7 | ||||
-rw-r--r-- | docs/write_addons.rst | 32 | ||||
-rw-r--r-- | docs/write_plugins.rst | 18 |
6 files changed, 51 insertions, 38 deletions
diff --git a/docs/build_docs.py b/docs/build_docs.py index 3287fce8d..d4822ef94 100644 --- a/docs/build_docs.py +++ b/docs/build_docs.py @@ -12,12 +12,18 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os -from os.path import dirname, join, abspath +import os +import platform +import sys + + +dir_name = os.path.join(os.path.dirname(os.path.abspath(""))) -dir_name = join(dirname(abspath(""))) sys.path.append(dir_name) -sys.path.append(join(dir_name, "pyload", "lib")) + +if "64" in platform.machine(): + sys.path.append(os.path.join(os.path.dirname, "lib64")) +sys.path.append(os.path.join(os.path.dirname, "lib")) # If extensions (or modules to document with autodoc) are in another directory, @@ -131,12 +137,12 @@ 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, "pyload", "web", "media", "default", "img", "pyload-logo-edited3.5-new-font-small.png") +html_logo = os.path.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 # pixels large. -html_favicon = join(dir_name, "docs", "resources", "icon.ico") +html_favicon = os.path.join(dir_name, "docs", "resources", "icon.ico") # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, diff --git a/docs/docs.conf b/docs/docs.conf index 749e09212..51bab49fb 100644 --- a/docs/docs.conf +++ b/docs/docs.conf @@ -8,7 +8,7 @@ output: html target: docs docformat: restructuredtext -exclude: pyload\.lib|pyload\.remote\.thriftbackend\.thriftgen|\.pyc|\.pyo|pyload\.plugins\.(account|addon|base|container|crypter|hook|hoster|internal|ocr) +exclude: remote\thriftbackend\thriftgen|plugin\(account|addon|container|crypter|hook|hoster|internal|ocr)|.pyc|.pyo name: pyLoad Documentation url: http://docs.pyload.org diff --git a/docs/module_overview.rst b/docs/module_overview.rst index fce9ecfca..9a2d445b6 100644 --- a/docs/module_overview.rst +++ b/docs/module_overview.rst @@ -9,11 +9,11 @@ You can find an overview of some important classes here: :toctree: pyload pyload.api.Api - pyload.plugins.Plugin.Base - pyload.plugins.Plugin.Plugin - pyload.plugins.Crypter.Crypter - pyload.plugins.Account.Account - pyload.plugins.Addon.Addon - pyload.manager.AddonManager.AddonManager + pyload.plugin.Plugin.Base + pyload.plugin.Plugin.Plugin + pyload.plugin.Crypter.Crypter + pyload.plugin.Account.Account + pyload.plugin.Addon.Addon + pyload.manager.Addon.AddonManager pyload.datatypes.PyFile.PyFile pyload.datatypes.PyPackage.PyPackage diff --git a/docs/setup.cfg b/docs/setup.cfg new file mode 100644 index 000000000..51c054a75 --- /dev/null +++ b/docs/setup.cfg @@ -0,0 +1,7 @@ +[build_sphinx] +source-dir = doc +build-dir = doc/_build +all_files = 1 + +[upload_sphinx] +upload-dir = doc/_build/html diff --git a/docs/write_addons.rst b/docs/write_addons.rst index c9f050ebc..7607560ff 100644 --- a/docs/write_addons.rst +++ b/docs/write_addons.rst @@ -3,20 +3,20 @@ Addons ====== -A Addon is a python file which is located at :file:`pyload/plugins/addon`. -The :class:`AddonManager <pyload.manager.AddonManager.AddonManager>` will load it automatically on startup. Only one instance exists -over the complete lifetime of pyload. Your addon can interact on various events called by the :class:`AddonManager <pyload.manager.AddonManager.AddonManager>`, +A Addon is a python file which is located at :file:`pyload/plugin/addon`. +The :class:`AddonManager <pyload.manager.Addon.AddonManager>` will load it automatically on startup. Only one instance exists +over the complete lifetime of pyload. Your addon can interact on various events called by the :class:`AddonManager <pyload.manager.Addon.AddonManager>`, 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 addon. Addon header ----------- -Your addon needs to subclass :class:`Addon <pyload.plugins.Addon.Addon>` and will inherit all of its method, make sure to check its documentation! +Your addon needs to subclass :class:`Addon <pyload.plugin.Addon.Addon>` and will inherit all of its method, make sure to check its documentation! All addons should start with something like this: :: - from pyload.plugins.Addon import Addon + from pyload.plugin.Addon import Addon class YourAddon(Addon): __name__ = "YourAddon" @@ -42,16 +42,16 @@ Interacting on Events The next step is to think about where your Addon action takes places. -The easiest way is to overwrite specific methods defined by the :class:`Addon <pyload.plugins.Addon.Addon>` base class. +The easiest way is to overwrite specific methods defined by the :class:`Addon <pyload.plugin.Addon.Addon>` base class. The name is indicating when the function gets called. -See :class:`Addon <pyload.plugins.Addon.Addon>` page for a complete listing. +See :class:`Addon <pyload.plugin.Addon.Addon>` page for a complete listing. -You should be aware of the arguments the Addon is called with, whether its a :class:`PyFile <pyload.datatype.PyFile.PyFile>` -or :class:`PyPackage <pyload.datatype.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 Addon is called with, whether its a :class:`PyFile <pyload.datatype.File.PyFile>` +or :class:`PyPackage <pyload.datatype.Package.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 pyload.plugins.Addon import Addon + from pyload.plugin.Addon import Addon class YourAddon(Addon): """ @@ -66,12 +66,12 @@ A basic excerpt would look like: :: Another and more flexible and powerful way is to use event listener. All addon methods exists as event and very useful additional events are dispatched by the core. For a little overview look -at :class:`AddonManager <pyload.manager.AddonManager.AddonManager>`. Keep in mind that you can define own events and other people may listen on them. +at :class:`AddonManager <pyload.manager.Addon.AddonManager>`. 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 pyload.plugins.Addon import Addon + from pyload.plugin.Addon import Addon class YourAddon(Addon): """ @@ -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:`AddonManager <pyload.manager.AddonManager.AddonManager>`. Contrary to ``event_map``, ``function`` has to be a reference +:class:`AddonManager <pyload.manager.Addon.AddonManager>`. 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 addons. So all future interaction will be exclusive @@ -107,7 +107,7 @@ So probably clients want to be able to interact with your addon to request it's Sounds complicated but is very easy to do. Just use the ``Expose`` decorator: :: - from pyload.plugins.Addon import Addon, Expose + from pyload.plugin.Addon import Addon, Expose class YourAddon(Addon): """ @@ -132,7 +132,7 @@ Your addon can store information in a ``dict`` that can easily be retrievied via Just store everything in ``self.info``. :: - from pyload.plugins.Addon import Addon + from pyload.plugin.Addon import Addon class YourAddon(Addon): """ @@ -155,4 +155,4 @@ Example ------- Sorry but you won't find an example here ;-) - Look at :file:`pyload/plugins/addon` and you will find plenty examples there. + Look at :file:`pyload/plugin/addon` and you will find plenty examples there. diff --git a/docs/write_plugins.rst b/docs/write_plugins.rst index f624b2fb5..7820e5ce6 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:`pyload/plugins/`. Either :file:`hoster`, :file:`crypter` +A Plugin is a python file located at one of the subfolders in :file:`pyload/plugin/`. 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 <pyload.plugins.Plugin.Plugin>`. You should know its +All kind of plugins inherit from the base :class:`Plugin <pyload.plugin.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 pyload.plugins.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 pyload.plugins.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 <pyload.datatype.PyFile.PyFile>` class, since an instance of it is given as parameter to every pyfile. +You need to know about the :class:`PyFile <pyload.datatype.File.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:`Addon <pyload.plugins.Addon.Addon>` plugins +or handled by :class:`Addon <pyload.plugin.Addon.Addon>` plugins Crypter ------- @@ -81,7 +81,7 @@ Well, they work nearly the same, only that the function they have to provide is Example: :: - from pyload.plugins.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 <pyload.plugins.Plugin.Plugin>`, but the important thing is they +They can access all the methods from :class:`Plugin <pyload.plugin.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:`pyload/plugins/`. +Best examples are already existing plugins in :file:`pyload/plugin/`. |