Skip to content

Instantly share code, notes, and snippets.

@sahib
Last active December 25, 2015 05:09
Show Gist options
  • Save sahib/6922400 to your computer and use it in GitHub Desktop.
Save sahib/6922400 to your computer and use it in GitHub Desktop.
[Core]
Name = Cover
Module = movie
[Documentation]
Description = A cover plugin
Author = My very own name
Version = 0.1
Website = My very own website
[Core]
Name = Genre
Module = movie
[Documentation]
Description = A genre plugin
Author = My very own name
Version = 0.1
Website = My very own website
#!/usr/bin/env python
# encoding: utf-8
from yapsy.PluginManager import PluginManager
if __name__ == '__main__':
# Build the manager
simplePluginManager = PluginManager()
# Tell it the default place(s) where to find plugins
simplePluginManager.setPluginPlaces(["plugin"])
# Load all plugins
simplePluginManager.collectPlugins()
# Activate all loaded plugins
for pluginInfo in simplePluginManager.getAllPlugins():
simplePluginManager.activatePluginByName(pluginInfo.name)
plugin = pluginInfo.plugin_object
plugin.do_something()
from yapsy.IPlugin import IPlugin
class IGenre(IPlugin):
pass
class ICover(IPlugin):
pass
class Genre(IGenre):
def do_something(self):
print('I am a genre.')
class Cover(ICover):
def do_something(self):
print('I am a cover.')

Actual output:

I am a cover.

I am a cover.

Expected output:

I am a cover.

I am a genre.

.
├── main.py
└── plugin/
├── cover.yapsy-plugin
├── genre.yapsy-plugin
├── movie.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment