Release SimplePlugin micro-framework for Kodi content plugins
#1
SimplePlugin micro-framework simplifies creating content plugins for Kodi. It was inspired by xbmcswift2 framework for the same purpose and has similar features like defining Kodi virtual folder contents using lists of dictionaries with item properties, persistent storage and cache decorator for functions.
Unfortunately, xbmcswift2 seems to have been abandoned by its author and does not support the newest features of the Kodi plugin API, so I've decided to create my own plugin micro-framework. Initially, it was used in my private projects, but now I've decided to make a public release.

A minimal example:
PHP Code:
from simpleplugin import Plugin

plugin 
Plugin()

# Free video sample is provided by www.vidsplay.com

# Define action via decorator
@plugin.action()
def root(params):
    
"""Root virtual folder"""
    
# Create 1-item list with a link to subfolder item
    
return [{'label''Subfolder',
            
'url'plugin.get_url(action='subfolder')}]


@
plugin.action()
def subfolder(params):
    
"""Virtual subfolder"""
    
# Create 1-item list with a link to a playable video.
    
return [{'label''Ocean Birds',
            
'thumb''http://www.vidsplay.com/vids/ocean_birds.jpg',
            
'url'plugin.get_url(action='play'url='http://www.vidsplay.com/vids/ocean_birds.mp4'),
            
'is_playable'True}]


@
plugin.action()
def play(params):
    
"""Play video"""
    
# Return a string containing a playable video URL
    
return params['url']


if 
__name__ == '__main__':
    
plugin.run()  # Start plugin 

You will find more detailed info about SimplePlugin in the project documentation.

Links:

The latest release: https://github.com/romanvm/script.module...ses/latest
Source code: https://github.com/romanvm/script.module.simpleplugin
An example SimplePlugin-based video plugin: https://github.com/romanvm/plugin.video....in.example

License: GPL v.3.
Reply


Messages In This Thread
SimplePlugin micro-framework for Kodi content plugins - by Roman_V_M - 2015-09-02, 09:01
Logout Mark Read Team Forum Stats Members Help
SimplePlugin micro-framework for Kodi content plugins0