How to execute a Addon/Plugin (ExtractArchive) via API? #4424
-
I've seen issue #4256 and wanted to implement it myself. I've set everything up, got a local instance of pyload running, made the gui changes which call an api endpoint @legacy("extractPackage")
@permission(Perms.MODIFY)
def extract_package(self, package_id):
"""
Extracts a package with the ExtractArchive plugin.
:param package_id: package id
"""
# TODO: implement but I'm now clueless on how to start the ExtractArchive plugin. The plugin works flawlessly, after a package has finished it automatically extracts the content. But how do I start this process via the API? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
After a lot of debbing I might found the solution: @legacy("extractPackage")
@permission(Perms.MODIFY)
def extract_package(self, package_id):
"""
Extracts a package with the ExtractArchive plugin.
:param package_id: package id
"""
for plugin in self.pyload.addon_manager.plugins:
if plugin.classname == 'ExtractArchive' and plugin.is_activated():
package = self.pyload.files.get_package(package_id)
plugin.package_finished(package) I iterate through all plugins and if I find a plugin |
Beta Was this translation helpful? Give feedback.
After a lot of debbing I might found the solution:
I iterate through all plugins and if I find a plugin
ExtractArchive
and it is active I get the package by its id and callpackage_finished
from the found plugin (which should be the extractor).