From 1bb6ebf544b43cacf7c0755c5a8608b79b95e2d6 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sat, 7 Jan 2012 20:11:16 +0100 Subject: MultiHoster plugin type, some fixes, new documentation structure --- docs/plugins/crypter_plugin.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docs/plugins/crypter_plugin.rst (limited to 'docs/plugins/crypter_plugin.rst') diff --git a/docs/plugins/crypter_plugin.rst b/docs/plugins/crypter_plugin.rst new file mode 100644 index 000000000..d910ec412 --- /dev/null +++ b/docs/plugins/crypter_plugin.rst @@ -0,0 +1,5 @@ +.. _crypter_plugin: + +Crypter - Extract links from pages +================================== + -- cgit v1.2.3 From 180a9ee57a6f4eaa5f4bdd7a272057231f6a5c88 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 29 Jan 2012 20:09:11 +0100 Subject: doc for base plugin --- docs/plugins/crypter_plugin.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'docs/plugins/crypter_plugin.rst') diff --git a/docs/plugins/crypter_plugin.rst b/docs/plugins/crypter_plugin.rst index d910ec412..639d58abf 100644 --- a/docs/plugins/crypter_plugin.rst +++ b/docs/plugins/crypter_plugin.rst @@ -3,3 +3,23 @@ Crypter - Extract links from pages ================================== +What about Decrypter and Container plugins? +Well, they work nearly the same, only that the function they have to provide is named ``decrypt`` + +Example: :: + + from module.plugin.Crypter import Crypter + + class MyFileCrypter(Crypter): + """ + plugin code + """ + def decrypt(self, pyfile): + + urls = ["http://get.pyload.org/src", "http://get.pyload.org/debian", "http://get.pyload.org/win"] + + self.packages.append(("pyLoad packages", urls, "pyLoad packages")) # urls list of urls + +They can access all the methods from :class:`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. -- cgit v1.2.3 From 7df4718276a12b7f19a73d3b789c791d57bf4342 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 29 Jan 2012 22:57:41 +0100 Subject: doc for crypter plugin --- docs/plugins/crypter_plugin.rst | 54 ++++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 12 deletions(-) (limited to 'docs/plugins/crypter_plugin.rst') diff --git a/docs/plugins/crypter_plugin.rst b/docs/plugins/crypter_plugin.rst index 639d58abf..1497ced07 100644 --- a/docs/plugins/crypter_plugin.rst +++ b/docs/plugins/crypter_plugin.rst @@ -3,23 +3,53 @@ Crypter - Extract links from pages ================================== -What about Decrypter and Container plugins? -Well, they work nearly the same, only that the function they have to provide is named ``decrypt`` - -Example: :: +We are starting with the simplest plugin, the :class:`Crypter `. +It's job is it to take a url as input and generate new package or links, for example by filtering the urls or +loading a page and extracting links from the html code. You need to define the ``__pattern__`` to match +target urls and subclass from :class:`Crypter `. :: from module.plugin.Crypter import Crypter class MyFileCrypter(Crypter): - """ - plugin code - """ - def decrypt(self, pyfile): + __pattern__ = r"mycrypter.com/id/([0-9]+)" + + def decryptURL(self, url): urls = ["http://get.pyload.org/src", "http://get.pyload.org/debian", "http://get.pyload.org/win"] + return urls + +You have to overwrite at least one of ``.decryptFile``, ``.decryptURL``, ``.decryptURLs``. The first one +is only useful for container files, whereas the last is usefull when it's possible to handle a bunch of urls +at once. If in doubt, just overwrite `decryptURL`. + +Generating Packages +------------------- + +When finished with decrypting just return the urls as list and they will be added to the package. You can also +create new Packages if needed by instantiating a :class:`Package` instance, which will look like the following:: + + from module.plugin.Crypter import Crypter, Package + + class MyFileCrypter(Crypter): + + def decryptURL(self, url): + + html = self.load(url) + + # .decrypt_from_content is only a example method here and will return a list of urls + urls = self.decrypt_from_content(html) + return Package("my new package", urls) + +And that's basically all you need to know. Just as little side-note if you want to use decrypter in +your code you can use:: + + plugin = self.core.pluginManager.loadClass("crypter", "NameOfThePlugin") + # decrypted will be a list of urls + decrypted = plugin.decrypt(urls) - self.packages.append(("pyLoad packages", urls, "pyLoad packages")) # urls list of urls +Testing +------- -They can access all the methods from :class:`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. +Please append a test link at :file:`tests/crypterlinks.txt` followed by `||xy`, where xy is the number of +expected links/packages to extract. +Our testrunner will be able to check your plugin periodical for functionality. \ No newline at end of file -- cgit v1.2.3 From da4cf026ad116518fefc3429b74a8cd94aeef73f Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 5 Feb 2012 17:27:13 +0100 Subject: updated documentation + diagrams --- docs/plugins/crypter_plugin.rst | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'docs/plugins/crypter_plugin.rst') diff --git a/docs/plugins/crypter_plugin.rst b/docs/plugins/crypter_plugin.rst index 1497ced07..4e7803808 100644 --- a/docs/plugins/crypter_plugin.rst +++ b/docs/plugins/crypter_plugin.rst @@ -19,7 +19,7 @@ target urls and subclass from :class:`Crypter `. return urls You have to overwrite at least one of ``.decryptFile``, ``.decryptURL``, ``.decryptURLs``. The first one -is only useful for container files, whereas the last is usefull when it's possible to handle a bunch of urls +is only useful for container files, whereas the last is useful when it's possible to handle a bunch of urls at once. If in doubt, just overwrite `decryptURL`. Generating Packages @@ -44,8 +44,22 @@ And that's basically all you need to know. Just as little side-note if you want your code you can use:: plugin = self.core.pluginManager.loadClass("crypter", "NameOfThePlugin") + # Core instance is needed for decrypting # decrypted will be a list of urls - decrypted = plugin.decrypt(urls) + decrypted = plugin.decrypt(core, urls) + + +SimpleCrypter +------------- + +For simple crypter services there is the :class:`SimpleCrypter ` class which handles most of the workflow. Only the regexp +pattern have to be defined. + +Exmaple:: + + from module.plugins.internal.SimpleCrypter import SimpleCrypter + + class MyFileCrypter(SimpleCrypter): Testing ------- -- cgit v1.2.3 From 5a7f415a25d8e036a37851fcd5e9be81caae2804 Mon Sep 17 00:00:00 2001 From: X3n0m0rph59 Date: Sun, 22 Apr 2012 16:54:06 +0200 Subject: Fixed spelling in the documentation --- docs/plugins/crypter_plugin.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/plugins/crypter_plugin.rst') diff --git a/docs/plugins/crypter_plugin.rst b/docs/plugins/crypter_plugin.rst index 4e7803808..8c54dccb1 100644 --- a/docs/plugins/crypter_plugin.rst +++ b/docs/plugins/crypter_plugin.rst @@ -4,7 +4,7 @@ Crypter - Extract links from pages ================================== We are starting with the simplest plugin, the :class:`Crypter `. -It's job is it to take a url as input and generate new package or links, for example by filtering the urls or +It's job is to take an url as input and generate a new package or links, for example by filtering the urls or loading a page and extracting links from the html code. You need to define the ``__pattern__`` to match target urls and subclass from :class:`Crypter `. :: @@ -36,11 +36,11 @@ create new Packages if needed by instantiating a :class:`Package` instance, whic html = self.load(url) - # .decrypt_from_content is only a example method here and will return a list of urls + # .decrypt_from_content is only an example method here and will return a list of urls urls = self.decrypt_from_content(html) return Package("my new package", urls) -And that's basically all you need to know. Just as little side-note if you want to use decrypter in +And that's basically all you need to know. Just as a little side-note if you want to use decrypter in your code you can use:: plugin = self.core.pluginManager.loadClass("crypter", "NameOfThePlugin") @@ -53,7 +53,7 @@ SimpleCrypter ------------- For simple crypter services there is the :class:`SimpleCrypter ` class which handles most of the workflow. Only the regexp -pattern have to be defined. +pattern has to be defined. Exmaple:: -- cgit v1.2.3