Skip to content
A micro-framework for Kodi mediacenter content plugins:
Python
Branch: master
Clone or download
Latest commit 8479ec8 Apr 8, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Update docs Jun 29, 2017
resources/language/English Adds tests for gettext emulator, fixes found bugs Apr 12, 2016
script.module.simpleplugin Version bump: 2.3.3 Apr 8, 2018
.checkignore Adds .checkignore Feb 14, 2016
.codecov.yml Add codecov.yml Mar 21, 2017
.gitignore Update .gitignore Feb 25, 2018
.travis.yml Remove debug option from Travis CI script Mar 24, 2017
Readme.md
setup.py Add setup.py script for installing SimplePlugin into a virtual enviro… Apr 17, 2017
tests.py Remove RoutedPlugin class Jan 1, 2018

Readme.md

SimplePlugin micro-framework for Kodi plugins

The Project Is Suspended!

Unfortunately, at this moment I have don't have time or desire to develop or maintain this project. This may change in the future but now I suspend the project until further notice. It means that from now on the project won't receive any updates and any new issues will be ignored. Fell free to do with the code whatever you like within GPL v.3 terms and conditions.

Build Status codecov.io

SimplePlugin micro-framework simplifies creating addons and content plugins for Kodi mediacenter. It was inspired by xbmcswift2 and has some similar features but SimplePlugin has different concept. Its 2 main goals are simplicity and support for both content plugins and general purpose addons. SimplePlugin consists of one module with no third-party dependencies, so you can simply include it in your plugin/addon. Or you can install it in Kodi as a library module addon.

Main Features

  • Simplified creating of content lists: each list item is defined as a dictionary and the properties of the list item are set as dictionary key: value pairs.
  • Automated plugin callback routing based on actions, that is, functions marked with a special decorator.
  • Convenience methods for simplified access to addon/plugin parameters and settings.
  • Persistent dictionary-like storage for storing addon's data.
  • Caching decorator that allows to cache function return data for a specified amount time, for example, to reduce the frequency of polling data from some website.
  • GNU Gettext emulation for simplified addon GUI localization: you can use English source strings in your Python code instead of non-obvious numeric string codes.

Minimal Plugin Example

from simpleplugin import Plugin

plugin = Plugin()

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

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


@plugin.action()
def subfolder():
    """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}]


# An action can take an optional argument that contain
# plugin call parameters parsed into a dict-like object.
# The params object allows to access parameters by key or by attribute
@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

Read the project documentation for more info about SimplePlugin and its usage.

License: GPL v.3

You can’t perform that action at this time.