diff options
Diffstat (limited to 'docs/plugins/hoster_plugin.rst')
-rw-r--r-- | docs/plugins/hoster_plugin.rst | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/docs/plugins/hoster_plugin.rst b/docs/plugins/hoster_plugin.rst new file mode 100644 index 000000000..55a973463 --- /dev/null +++ b/docs/plugins/hoster_plugin.rst @@ -0,0 +1,57 @@ +.. _hoster_plugin: + +Hoster - Load files to disk +=========================== + +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.plugin.Hoster import Hoster + + class MyFileHoster(Hoster): + """ + plugin code + """ + + def setup(): + #TODO + + def process(self, pyfile): + html = self.load(pyfile.url) # load the content of the orginal pyfile.url to html + + # parse the name from the site and set attribute in pyfile + pyfile.name = self.myFunctionToParseTheName(html) + parsed_url = self.myFunctionToParseUrl(html) + + # download the file, destination is determined by pyLoad + self.download(parsed_url) + +You need to know about the :class:`PyFile <pyload.PyFile.PyFile>` class, since an instance of it is given as a parameter to every pyfile. +Some tasks your plugin should handle: check if the file is online, get filename, wait if needed, download the file, etc.. + +Common Tasks +---------- + +Some hosters require you to wait a specific time. Just set the time with ``self.setWait(seconds)`` or +``self.setWait(seconds, True)`` if you want pyLoad to perform a reconnect if needed. + +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 + + +Online status fetching +---------------------- + +SimpleHoster +------------ + + +Testing +------- + + +Examples +-------- + +The best examples are the already existing plugins in :file:`pyload/plugins/`.
\ No newline at end of file |