Skip to content

How to execute a Addon/Plugin (ExtractArchive) via API? #4424

Answered by henrydatei
henrydatei asked this question in Help
Discussion options

You must be logged in to vote

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 ExtractArchive and it is active I get the package by its id and call package_finished from the found plugin (which should be the extractor).

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by henrydatei
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant