Extension API

If you want to learn how to make Mopidy extensions, read Extension development.

class mopidy.ext.Extension[source]

Base class for Mopidy extensions

dist_name = None

The extension’s distribution name, as registered on PyPI

Example: Mopidy-Soundspot

ext_name = None

The extension’s short name, as used in setup.py and as config section name

Example: soundspot

get_backend_classes()[source]

List of backend actor classes

Mopidy will take care of starting the actors.

Returns:list of Backend subclasses
get_command()[source]

Command to expose to command line users running mopidy.

Returns:Instance of a Command class.
get_config_schema()[source]

The extension’s config validation schema

Returns:ExtensionConfigSchema
get_default_config()[source]

The extension’s default config as a bytestring

Returns:bytes or unicode
get_frontend_classes()[source]

List of frontend actor classes

Mopidy will take care of starting the actors.

Returns:list of pykka.Actor subclasses
get_library_updaters()[source]

List of library updater classes

Returns:list of BaseLibraryUpdateProvider subclasses
register_gstreamer_elements()[source]

Hook for registering custom GStreamer elements

Register custom GStreamer elements by implementing this method. Example:

def register_gstreamer_elements(self):
    from .mixer import SoundspotMixer
    gobject.type_register(SoundspotMixer)
    gst.element_register(
        SoundspotMixer, 'soundspotmixer', gst.RANK_MARGINAL)
Returns:None
validate_environment()[source]

Checks if the extension can run in the current environment

For example, this method can be used to check if all dependencies that are needed are installed.

Raises:ExtensionError
Returns:None
version = None

The extension’s version

Should match the __version__ attribute on the extension’s main Python module and the version registered on PyPI.

mopidy.ext.load_extensions()[source]

Find all installed extensions.

Returns:list of installed extensions
mopidy.ext.register_gstreamer_elements(enabled_extensions)[source]

Registers custom GStreamer elements from extensions.

Parameters:enabled_extensions – list of enabled extensions
mopidy.ext.validate_extension(extension)[source]

Verify extension’s dependencies and environment.

Parameters:extensions – an extension to check
Returns:if extension should be run

Previous topic

Commands API

Next topic

Config API

This Page