diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/access_api.rst | 18 | ||||
-rw-r--r-- | docs/conf.py | 10 | ||||
-rw-r--r-- | docs/docs.conf | 4 | ||||
-rwxr-xr-x | docs/extend_pyload.rst | 7 | ||||
-rw-r--r-- | docs/index.rst | 2 | ||||
-rw-r--r-- | docs/module_overview.rst | 22 | ||||
-rw-r--r-- | docs/plugin_licensing.rst | 18 | ||||
-rw-r--r-- | docs/resources/banner.png | bin | 0 -> 18927 bytes | |||
-rw-r--r-- | docs/resources/icon.ico | bin | 0 -> 5430 bytes | |||
-rw-r--r-- | docs/resources/logo.png | bin | 0 -> 39315 bytes | |||
-rw-r--r-- | docs/resources/logo.svg | 317 | ||||
-rw-r--r-- | docs/write_addons.rst | 158 | ||||
-rw-r--r-- | docs/write_hooks.rst | 162 | ||||
-rw-r--r-- | docs/write_plugins.rst | 22 | ||||
-rw-r--r-- | docs/write_scripts.rst | 25 |
15 files changed, 562 insertions, 203 deletions
diff --git a/docs/access_api.rst b/docs/access_api.rst index df69da8b2..1d013c2c0 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 +Of course its possible to access the ``core.api`` attribute in plugins and addons, 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 @@ -118,4 +118,4 @@ Strings are wrapped in double qoutes, because `"username"` represents a string i every container type like lists and dicts are possible. You usually don't have to convert them. just use a json encoder before using them in the HTTP request. -Please note that the data have to be urlencoded at last. (Most libaries will do that automatically)
\ No newline at end of file +Please note that the data have to be urlencoded at last. (Most libaries will do that automatically) diff --git a/docs/conf.py b/docs/conf.py index 9d2cf98f9..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, @@ -52,7 +52,7 @@ master_doc = 'index' # General information about the project. project = u'pyLoad' -copyright = u'2011, pyLoad Team' +copyright = u'2008-2014, pyLoad Team' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -66,7 +66,7 @@ cog.outl("version = '%s'" % ".".join(v[:2])) cog.outl("release = '%s'" % ".".join(v)) ]]]""" version = '0.4' -release = '0.4.9' +release = '0.4.10' # [[[end]]] @@ -128,12 +128,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, "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 # pixels large. -html_favicon = join(dir_name, "icons", "pyload2.ico") +html_favicon = 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 e197cfa43..749e09212 100644 --- a/docs/docs.conf +++ b/docs/docs.conf @@ -3,12 +3,12 @@ [epydoc] -modules: pyLoadCore.py, pyLoadCli.py, pyloadGui.py, module +modules: pyload.py, pyload-cli.py, pyload output: html target: docs docformat: restructuredtext -exclude: module\.lib|module\.remote\.thriftbackend\.thriftgen|PyQt4|\.pyc|\.pyo|module\.plugins\.(accounts|captcha|container|crypter|hooks|hoster) +exclude: pyload\.lib|pyload\.remote\.thriftbackend\.thriftgen|\.pyc|\.pyo|pyload\.plugins\.(account|addon|base|container|crypter|hook|hoster|internal|ocr) name: pyLoad Documentation url: http://docs.pyload.org diff --git a/docs/extend_pyload.rst b/docs/extend_pyload.rst index 337cb6854..ccd4ac203 100755 --- a/docs/extend_pyload.rst +++ b/docs/extend_pyload.rst @@ -1,7 +1,7 @@ .. _extend_pyload: ******************** -How to extend pyLoad +How to extend pyLoad ******************** In general there a two different plugin types. These allow everybody to write powerful, modular plugins without knowing @@ -9,5 +9,6 @@ every detail of the pyLoad core. However you should have some basic knowledge of .. toctree:: - write_hooks.rst - write_plugins.rst
\ No newline at end of file + write_addons.rst + write_plugins.rst + write_scripts.rst 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..fce9ecfca 100644 --- a/docs/module_overview.rst +++ b/docs/module_overview.rst @@ -1,17 +1,19 @@ +.. _module_overview: + 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.Addon.Addon + pyload.manager.AddonManager.AddonManager + pyload.datatypes.PyFile.PyFile + pyload.datatypes.PyPackage.PyPackage diff --git a/docs/plugin_licensing.rst b/docs/plugin_licensing.rst new file mode 100644 index 000000000..0e8590d62 --- /dev/null +++ b/docs/plugin_licensing.rst @@ -0,0 +1,18 @@ +.. _plugin_licensing: + +Plugin Licensing +================ + +According to the terms of the GNU General Public License, +pyload's plugins must be treated as an extension of the main program. +This means the plugins must be released under the GPL or a GPL-compatible +free software license, and that the terms of the GPL must be followed when +those plugins are distributed. + + * Any plugin published **without a license notice** is intend published under the **GNU GPLv3**. + * A different license can be used but it **must be GPL-compatible** and the license notice must be put in the plugin + file. + * Any plugin published **with a GPL incompatible license** will be rejected. + This includes *copyright all right reserved*. + * Is recommended to put the license notice at the top of the plugin file. + * Is recommended to **not** put the license notice when plugin is published under the GNU GPLv3. diff --git a/docs/resources/banner.png b/docs/resources/banner.png Binary files differnew file mode 100644 index 000000000..4e2d718f7 --- /dev/null +++ b/docs/resources/banner.png diff --git a/docs/resources/icon.ico b/docs/resources/icon.ico Binary files differnew file mode 100644 index 000000000..b5fb55686 --- /dev/null +++ b/docs/resources/icon.ico diff --git a/docs/resources/logo.png b/docs/resources/logo.png Binary files differnew file mode 100644 index 000000000..d20084847 --- /dev/null +++ b/docs/resources/logo.png diff --git a/docs/resources/logo.svg b/docs/resources/logo.svg new file mode 100644 index 000000000..f67815678 --- /dev/null +++ b/docs/resources/logo.svg @@ -0,0 +1,317 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="svg2"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:version="0.48.2 r9819"
+ sodipodi:version="0.32"
+ sodipodi:docname="pyload_logo.svg"
+ x="0px"
+ y="0px"
+ width="1000"
+ height="1000"
+ viewBox="0 0 1000 1000"
+ enable-background="new 0 0 1000 1000"
+ xml:space="preserve"
+ inkscape:export-filename="/Users/christian/Development/pyload/docs/resources/pyload_logo.png"
+ inkscape:export-xdpi="9.2647057"
+ inkscape:export-ydpi="9.2647057"><title
+ id="title3794">pyLoad Logo</title><metadata
+ id="metadata33"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>pyLoad Logo</dc:title><dc:creator><cc:Agent><dc:title>pyLoad Team</dc:title></cc:Agent></dc:creator><cc:license
+ rdf:resource="http://creativecommons.org/licenses/by-nc-sa/3.0/" /><dc:subject><rdf:Bag><rdf:li>pyload logo</rdf:li></rdf:Bag></dc:subject><dc:description>Official pyLoad logo with some optional filters</dc:description></cc:Work><cc:License
+ rdf:about="http://creativecommons.org/licenses/by-nc-sa/3.0/"><cc:permits
+ rdf:resource="http://creativecommons.org/ns#Reproduction" /><cc:permits
+ rdf:resource="http://creativecommons.org/ns#Distribution" /><cc:requires
+ rdf:resource="http://creativecommons.org/ns#Notice" /><cc:requires
+ rdf:resource="http://creativecommons.org/ns#Attribution" /><cc:prohibits
+ rdf:resource="http://creativecommons.org/ns#CommercialUse" /><cc:permits
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /><cc:requires
+ rdf:resource="http://creativecommons.org/ns#ShareAlike" /></cc:License></rdf:RDF></metadata><defs
+ id="defs31"><color-profile
+ name="Generic-RGB-Profile"
+ xlink:href="/System/Library/ColorSync/Profiles/Generic RGB Profile.icc"
+ id="color-profile3792" /><linearGradient
+ gradientTransform="matrix(0.5625,0,0,-0.568,125.7979,708.7776)"
+ y2="752.55798"
+ x2="783.30792"
+ y1="134.5405"
+ x1="1220.123"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3778">
+ <stop
+ id="stop3780"
+ style="stop-color:#ffd856;stop-opacity:1;"
+ offset="0" />
+ <stop
+ id="stop3782"
+ style="stop-color:#ffc836;stop-opacity:1;"
+ offset="1" />
+ </linearGradient><linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3778"
+ id="linearGradient3005"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.0266298,0,0,1,-7.2192914,0)"
+ spreadMethod="pad"
+ x1="271.09799"
+ y1="499.06601"
+ x2="1001.7615"
+ y2="499.06601" /><linearGradient
+ inkscape:collect="always"
+ xlink:href="#path1948_3_"
+ id="linearGradient3783"
+ x1="25.991835"
+ y1="239.76074"
+ x2="763.24133"
+ y2="239.76074"
+ gradientUnits="userSpaceOnUse" /><filter
+ id="filter3020"
+ inkscape:label="Drop shadow"
+ width="1.5"
+ height="1.5"
+ x="-.25"
+ y="-.25"><feGaussianBlur
+ id="feGaussianBlur3022"
+ in="SourceAlpha"
+ stdDeviation="25"
+ result="blur" /><feColorMatrix
+ id="feColorMatrix3024"
+ result="bluralpha"
+ type="matrix"
+ values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.5 0 " /><feOffset
+ id="feOffset3026"
+ in="bluralpha"
+ dx="15"
+ dy="30"
+ result="offsetBlur" /><feMerge
+ id="feMerge3028"><feMergeNode
+ id="feMergeNode3030"
+ in="offsetBlur" /><feMergeNode
+ id="feMergeNode3032"
+ in="SourceGraphic" /></feMerge></filter><filter
+ id="filter3023"
+ inkscape:label="Outline"
+ inkscape:menu="Morphology"
+ inkscape:menu-tooltip="Draws a colored outline around"
+ width="1.5"
+ height="1.5"
+ x="-0.25"
+ y="-0.25"
+ color-interpolation-filters="sRGB"><feGaussianBlur
+ id="feGaussianBlur3025"
+ in="SourceAlpha"
+ stdDeviation="10"
+ result="blur" /><feColorMatrix
+ id="feColorMatrix3027"
+ values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1 "
+ result="result4" /><feFlood
+ id="feFlood3029"
+ result="result1"
+ flood-color="rgb(0,0,0)"
+ in="blur"
+ flood-opacity="1" /><feComposite
+ id="feComposite3031"
+ in2="result4"
+ result="result2"
+ in="result1"
+ operator="atop" /><feComposite
+ id="feComposite3033"
+ in2="result2"
+ in="SourceGraphic"
+ result="result3"
+ operator="atop" /></filter><filter
+ id="filter3140"
+ inkscape:label="3D Effect"
+ inkscape:menu="Bevels"
+ inkscape:menu-tooltip="Basic specular bevel to use for building textures"
+ color-interpolation-filters="sRGB"><feGaussianBlur
+ id="feGaussianBlur3142"
+ stdDeviation="6"
+ in="SourceGraphic"
+ result="result0" /><feDiffuseLighting
+ id="feDiffuseLighting3144"
+ lighting-color="rgb(255,255,255)"
+ diffuseConstant="1"
+ surfaceScale="4"
+ result="result5"><feDistantLight
+ id="feDistantLight3146"
+ elevation="45"
+ azimuth="235" /></feDiffuseLighting><feComposite
+ id="feComposite3148"
+ in2="SourceGraphic"
+ k1="1.4"
+ in="result5"
+ result="fbSourceGraphic"
+ operator="arithmetic" /><feGaussianBlur
+ id="feGaussianBlur3150"
+ result="result0"
+ in="fbSourceGraphic"
+ stdDeviation="6" /><feSpecularLighting
+ id="feSpecularLighting3152"
+ specularExponent="25"
+ specularConstant="1"
+ surfaceScale="4"
+ lighting-color="rgb(255,255,255)"
+ result="result1"
+ in="result0"><feDistantLight
+ id="feDistantLight3154"
+ azimuth="235"
+ elevation="45" /></feSpecularLighting><feComposite
+ id="feComposite3156"
+ in2="result91"
+ k3="1"
+ k2="1"
+ operator="arithmetic"
+ result="result4"
+ in="fbSourceGraphic" /><feComposite
+ id="feComposite3158"
+ in2="SourceGraphic"
+ operator="in"
+ result="result2"
+ in="result4" /></filter></defs><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1352"
+ inkscape:window-height="766"
+ id="namedview29"
+ showgrid="false"
+ inkscape:zoom="0.5"
+ inkscape:cx="556.17192"
+ inkscape:cy="487.74566"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g2303_1_"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
+ showborder="true"
+ borderlayer="false"
+ showguides="true"
+ inkscape:guide-bbox="true" />
+<g
+ id="g2303"
+ display="none"
+ style="display:none"
+ transform="translate(-21.799529,1.0000288)">
+
+ <linearGradient
+ id="path1948_2_"
+ gradientUnits="userSpaceOnUse"
+ x1="-338.45169"
+ y1="1559.3135"
+ x2="627.55139"
+ y2="728.19678"
+ gradientTransform="matrix(0.5625,0,0,-0.568,125.7979,708.7776)">
+ <stop
+ offset="0"
+ style="stop-color:#5A9FD4"
+ id="stop5" />
+ <stop
+ offset="1"
+ style="stop-color:#306998"
+ id="stop7" />
+ </linearGradient>
+ <path
+ id="path1948"
+ display="inline"
+ d="M 493.674,-0.868 H 256.098 166.937 c -69.042,0 -129.5,41.498 -148.412,120.447 -21.813,90.495 -22.783,146.964 0,241.457 16.887,70.339 57.219,120.447 126.26,120.447 h 81.686 V 372.939 c 0,-78.413 67.856,-147.585 148.416,-147.585 h 237.298 c 66.057,0 118.787,-54.385 118.787,-120.727 L 730.846,-0.89"
+ inkscape:connector-curvature="0"
+ style="fill:url(#path1948_2_);display:inline" />
+
+ <linearGradient
+ id="path1950_2_"
+ gradientUnits="userSpaceOnUse"
+ x1="1186.2559"
+ y1="133.9731"
+ x2="749.44067"
+ y2="751.99072"
+ gradientTransform="matrix(0.5625,0,0,-0.568,125.7979,708.7776)">
+ <stop
+ offset="0"
+ style="stop-color:#FFD43B"
+ id="stop11" />
+ <stop
+ offset="1"
+ style="stop-color:#FFE873"
+ id="stop13" />
+ </linearGradient>
+ <path
+ id="path1950"
+ display="inline"
+ d="m 755.602,0.132 v 105.496 c 0,81.799 -69.346,150.631 -148.418,150.631 H 369.886 c -65.002,0 -118.788,55.632 -118.788,120.727 v 226.221 c 0,64.39 55.985,102.262 118.788,120.727 C 412.959,736.601 500,1000 500,1000 c 0,0 68.736,-264.907 107.184,-276.066 59.809,-17.313 118.787,-52.168 118.787,-120.727 V 512.666 H 488.673 V 482.483 H 725.97 844.761 c 69.049,0 94.783,-48.163 118.787,-120.447 24.809,-74.417 23.752,-145.985 0,-241.457 C 946.486,51.85 913.898,0.132 844.762,0.132 h -89.16 z M 622.137,573.026 c 24.627,0 44.578,20.179 44.578,45.137 0,25.041 -19.951,45.409 -44.578,45.409 -24.541,0 -44.58,-20.368 -44.58,-45.409 0,-24.958 20.039,-45.137 44.58,-45.137 z"
+ inkscape:connector-curvature="0"
+ style="fill:url(#path1950_2_);display:inline" />
+</g>
+<g
+ id="g2303_1_"
+ transform="translate(-21.799529,1.0000288)">
+
+ <linearGradient
+ id="path1948_3_"
+ gradientUnits="userSpaceOnUse"
+ x1="-303.33109"
+ y1="1560.5684"
+ x2="662.672"
+ y2="729.45172"
+ gradientTransform="matrix(0.57252813,0,0,-0.568,127.65196,708.7776)">
+ <stop
+ offset="0"
+ style="stop-color:#3778b0;stop-opacity:1;"
+ id="stop18" />
+ <stop
+ offset="1"
+ style="stop-color:#356b97;stop-opacity:1;"
+ id="stop20" />
+ </linearGradient>
+ <path
+ style="fill:url(#linearGradient3783);fill-opacity:1;"
+ d="M 187.6338,-0.828786 C 142.54691,-0.4970408 97.509189,20.00164 69.766894,55.506872 50.404869,79.267481 40.287236,108.86774 34.426911,138.63795 22.416163,189.64033 17.78885,242.92961 25.780677,294.93728 c 5.106096,32.23417 11.057028,64.60794 22.392916,95.27781 13.479342,35.90012 38.974607,69.46226 76.144837,82.91501 27.93718,10.93473 54.60541,6.72414 83.9641,7.53695 13.63487,0 24.96913,0 38.604,0 0.2713,-39.75457 -0.23921,-79.53817 0.7,-119.27522 4.44911,-60.56565 57.97765,-113.83582 116.49553,-129.10577 28.59598,-7.98504 58.75298,-3.97369 88.12613,-4.95196 65.78932,-0.1699 131.59413,0.33658 197.37399,-0.24727 46.56452,-2.36951 89.41253,-33.74388 105.96031,-76.7788 8.4927,-20.25194 9.04154,-42.50123 8.36849,-64.136866 -0.0327,-28.519022 -0.0719,-58.538168 -0.10062,-87.0571928 -160.2708,-0.8222611 -320.54247,-0.1692627 -480.8154,0.027 -31.78694,0.021047 -63.57472,-0.0424765 -95.36116,0.0302428 z"
+ id="path1948_1_"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccccccccccccccc" />
+
+ <linearGradient
+ id="path1950_3_"
+ gradientUnits="userSpaceOnUse"
+ x1="1220.123"
+ y1="134.5405"
+ x2="783.30792"
+ y2="752.55798"
+ gradientTransform="matrix(0.5625,0,0,-0.568,125.7979,708.7776)"
+ xlink:href="#linearGradient3778">
+ <stop
+ offset="0"
+ style="stop-color:#fae13f;stop-opacity:1;"
+ id="stop24" />
+ <stop
+ offset="1"
+ style="stop-color:#facc2b;stop-opacity:1;"
+ id="stop26" />
+ </linearGradient>
+ <path
+ id="path1950_1_"
+ d="m 789.03685,-0.868 v 105.496 c 0,81.799 -71.19267,150.631 -152.37034,150.631 H 393.0493 c -66.73298,0 -121.9513,55.632 -121.9513,120.727 v 226.221 c 0,64.39 255.53022,396.793 255.53022,396.793 0,0 231.98858,-328.234 231.98858,-396.793 V 511.666 H 515.00061 V 481.483 H 758.6168 880.57116 c 70.88777,0 97.30706,-48.163 121.95034,-120.447 25.4697,-74.417 24.3844,-145.985 0,-241.457 C 985.00406,50.85 951.54825,-0.868 880.57116,-0.868 H 789.03685 z M 652.0177,572.026 c 25.28282,0 45.76511,20.179 45.76511,45.137 0,25.041 -20.48229,45.409 -45.76511,45.409 -25.19452,0 -45.76716,-20.368 -45.76716,-45.409 0,-24.958 20.57264,-45.137 45.76716,-45.137 z"
+ style="fill:url(#linearGradient3005);fill-opacity:1;"
+ inkscape:connector-curvature="0" />
+</g>
+</svg>
\ No newline at end of file diff --git a/docs/write_addons.rst b/docs/write_addons.rst new file mode 100644 index 000000000..c9f050ebc --- /dev/null +++ b/docs/write_addons.rst @@ -0,0 +1,158 @@ +.. _write_addons: + +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>`, +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! + +All addons should start with something like this: :: + + from pyload.plugins.Addon import Addon + + class YourAddon(Addon): + __name__ = "YourAddon" + __version__ = "0.1" + __description__ = "Does really cool stuff" + __config__ = [ ("activated" , "bool" , "Activated" , "True" ) ] + __author_name__ = ("Me") + __author_mail__ = ("me@has-no-mail.com") + +All meta-data is defined in the header, you need at least one option at ``__config__`` so the user can toggle your +addon on and off. Dont't overwrite the ``init`` method if not neccesary, use ``setup`` instead. + +Using the Config +---------------- + +We are taking a closer look at the ``__config__`` parameter. +You can add more config values as desired by adding tuples of the following format to the config list: ``("name", "type", "description", "default value")``. +When everything went right you can access the config values with ``self.getConfig(name)`` and ``self.setConfig(name, value``. + + +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 name is indicating when the function gets called. +See :class:`Addon <pyload.plugins.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. + +A basic excerpt would look like: :: + + from pyload.plugins.Addon import Addon + + class YourAddon(Addon): + """ + Your Addon code here. + """ + + def activate(self): + print "Yay, the core is ready let's do some work." + + def downloadFinished(self, pyfile): + print "A Download just finished." + +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. + +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 + + class YourAddon(Addon): + """ + Your Addon code here. + """ + event_map = {'downloadFinished': "doSomeWork", + 'allDownloadsFnished': "someMethod", + 'activate': "initialize"} + + def initialize(self): + print "Initialized." + + def doSomeWork(self, pyfile): + print "This is equivalent to the above example." + + def someMethod(self): + print "The underlying event (allDownloadsFinished) for this method is not available through the base class" + +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 +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 +available as event and not accessible through overwriting addon methods. However you can safely do this, it will not be removed and is easier to implement. + + +Providing RPC services +---------------------- + +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 addon to request it's state or invoke some action. + +Sounds complicated but is very easy to do. Just use the ``Expose`` decorator: :: + + from pyload.plugins.Addon import Addon, Expose + + class YourAddon(Addon): + """ + Your Addon code here. + """ + + @Expose + def invoke(self, arg): + print "Invoked with", arg + +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 + + print client.getServices() + print client.call(ServiceCall("YourAddon", "invoke", "an argument")) + +Providing status information +---------------------------- +Your addon 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 pyload.plugins.Addon import Addon + + class YourAddon(Addon): + """ + Your Addon code here. + """ + + def setup(self): + self.info = {'running': False} + + def activate(self): + self.info['running'] = True + +Usable with: :: + + #Assuming client is a ThriftClient or Api object + + print client.getAllInfo() + +Example +------- + Sorry but you won't find an example here ;-) + + Look at :file:`pyload/plugins/addon` and you will find plenty examples there. diff --git a/docs/write_hooks.rst b/docs/write_hooks.rst deleted file mode 100644 index dd60367b7..000000000 --- a/docs/write_hooks.rst +++ /dev/null @@ -1,162 +0,0 @@ -.. _write_hooks: - -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. -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! - -All Hooks should start with something like this: :: - - from module.plugins.Hook import Hook - - class YourHook(Hook): - __name__ = "YourHook" - __version__ = "0.1" - __description__ = "Does really cool stuff" - __config__ = [ ("activated" , "bool" , "Activated" , "True" ) ] - __threaded__ = ["downloadFinished"] - __author_name__ = ("Me") - __author_mail__ = ("me@has-no-mail.com") - -All meta-data is defined in the header, you need at least one option at ``__config__`` so the user can toggle your -hook on and off. Dont't overwrite the ``init`` method if not neccesary, use ``setup`` instead. - -Using the Config ----------------- - -We are taking a closer look at the ``__config__`` parameter. -You can add more config values as desired by adding tuples of the following format to the config list: ``("name", "type", "description", "default value")``. -When everything went right you can access the config values with ``self.getConfig(name)`` and ``self.setConfig(name,value``. - - -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 name is indicating when the function gets called. -See :class:`Hook <module.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. - -A basic excerpt would look like: :: - - from module.plugins.Hook import Hook - - class YourHook(Hook): - """ - Your Hook code here. - """ - - def coreReady(self): - print "Yay, the core is ready let's do some work." - - def downloadFinished(self, pyfile): - print "A Download just finished." - -Another important feature to mention can be seen at the ``__threaded__`` parameter. Function names listed will be executed -in a thread, in order to not block the main thread. This should be used for all kind of longer processing tasks. - -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. - -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 - - class YourHook(Hook): - """ - Your Hook code here. - """ - event_map = {"downloadFinished" : "doSomeWork", - "allDownloadsFnished": "someMethod", - "coreReady": "initialize"} - - def initialize(self): - print "Initialized." - - def doSomeWork(self, pyfile): - print "This is equivalent to the above example." - - def someMethod(self): - print "The underlying event (allDownloadsFinished) for this method is not available through the base class" - -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 -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 -available as event and not accessible through overwriting hook methods. However you can safely do this, it will not be removed and is easier to implement. - - -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. -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 - - class YourHook(Hook): - """ - Your Hook code here. - """ - - @Expose - 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`. -Here is a basic example: :: - - #Assuming client is a ThriftClient or Api object - - print client.getServices() - print client.call(ServiceCall("YourHook", "invoke", "an argument")) - -Providing status information ----------------------------- -Your hook can store information in a ``dict`` that can easily be retrievied via the :class:`Api <module.Api.Api>`. - -Just store everything in ``self.info``. :: - - from module.plugins.Hook import Hook - - class YourHook(Hook): - """ - Your Hook code here. - """ - - def setup(self): - self.info = {"running": False} - - def coreReady(self): - self.info["running"] = True - -Usable with: :: - - #Assuming client is a ThriftClient or Api object - - print client.getAllInfo() - -Example -------- - Sorry but you won't find an example here ;-) - - Look at :file:`module/plugins/hooks` and you will find plenty examples there. diff --git a/docs/write_plugins.rst b/docs/write_plugins.rst index b513a5978..f624b2fb5 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.plugins.Hoster import Hoster class MyFileHoster(Hoster): __name__ = "MyFileHoster" @@ -30,7 +30,7 @@ How basic hoster plugin header could look like: :: You have to define these meta-data, ``__pattern__`` has to be a regexp that sucessfully compiles with ``re.compile(__pattern__)``. -Just like :ref:`write_hooks` you can add and use config values exatly the same way. +Just like :ref:`write_addons` you can add and use config values exatly the same way. If you want a Crypter or Container plugin, just replace the word Hoster with your desired plugin type. @@ -41,13 +41,13 @@ 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.plugins.Hoster import Hoster class MyFileHoster(Hoster): """ plugin code """ - + def process(self, pyfile): html = self.load(pyfile.url) # load the content of the orginal pyfile.url to html @@ -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.datatype.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:`Addon <pyload.plugins.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 module.plugin.Crypter import Crypter + from pyload.plugins.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/`.
\ No newline at end of file +Best examples are already existing plugins in :file:`pyload/plugins/`. diff --git a/docs/write_scripts.rst b/docs/write_scripts.rst new file mode 100644 index 000000000..55c0e1665 --- /dev/null +++ b/docs/write_scripts.rst @@ -0,0 +1,25 @@ +.. _write_scripts: + +Scripts +======= + +pyLoad is able to start any kind of scripts at given events. +Simply put your script in a suitable folder and pyLoad will execute it at the given events and pass some arguments to them. + + +***Note:*** +**Every script starting with symbol `#` will be ignored!** (ex.: `#converter.sh`) + +***Note:*** +You have to restart pyload when you change script names or locations. + + +Below you see the list of arguments, which are passed to the scripts. + +### Argument list ### + + - `download_preparing`: **`pluginname` `url`** + - `download_finished`: **`pluginname` `url` `filename` `filelocation`** + - `package_finshed`: **`packagename` `packagelocation`** + - `before_reconnect`: **`oldip`** + - `after_reconnect`: **`newip`** |