Backend API

The backend API is the interface that must be implemented when you create a backend. If you are working on a frontend and need to access the backend, see the Core API.

Backend class

class mopidy.backends.base.Backend[source]
audio = None

Actor proxy to an instance of mopidy.audio.Audio.

Should be passed to the backend constructor as the kwarg audio, which will then set this field.

library = None

The library provider. An instance of BaseLibraryProvider, or None if the backend doesn’t provide a library.

playback = None

The playback provider. An instance of BasePlaybackProvider, or None if the backend doesn’t provide playback.

playlists = None

The playlists provider. An instance of BasePlaylistsProvider, or class:None if the backend doesn’t provide playlists.

uri_schemes = []

List of URI schemes this backend can handle.

Playback provider

class mopidy.backends.base.BasePlaybackProvider(audio, backend)[source]
Parameters:
change_track(track)[source]

Swith to provided track.

MAY be reimplemented by subclass.

Parameters:track (mopidy.models.Track) – the track to play
Return type:True if successful, else False
get_time_position()[source]

Get the current time position in milliseconds.

MAY be reimplemented by subclass.

Return type:int
pause()[source]

Pause playback.

MAY be reimplemented by subclass.

Return type:True if successful, else False
play(track)[source]

Play given track.

MAY be reimplemented by subclass.

Parameters:track (mopidy.models.Track) – the track to play
Return type:True if successful, else False
resume()[source]

Resume playback at the same time position playback was paused.

MAY be reimplemented by subclass.

Return type:True if successful, else False
seek(time_position)[source]

Seek to a given time position.

MAY be reimplemented by subclass.

Parameters:time_position (int) – time position in milliseconds
Return type:True if successful, else False
stop()[source]

Stop playback.

MAY be reimplemented by subclass.

Return type:True if successful, else False

Playlists provider

class mopidy.backends.base.BasePlaylistsProvider(backend)[source]
Parameters:backend (mopidy.backends.base.Backend) – backend the controller is a part of
create(name)[source]

See mopidy.core.PlaylistsController.create().

MUST be implemented by subclass.

delete(uri)[source]

See mopidy.core.PlaylistsController.delete().

MUST be implemented by subclass.

lookup(uri)[source]

See mopidy.core.PlaylistsController.lookup().

MUST be implemented by subclass.

playlists[source]

Currently available playlists.

Read/write. List of mopidy.models.Playlist.

refresh()[source]

See mopidy.core.PlaylistsController.refresh().

MUST be implemented by subclass.

save(playlist)[source]

See mopidy.core.PlaylistsController.save().

MUST be implemented by subclass.

Library provider

class mopidy.backends.base.BaseLibraryProvider(backend)[source]
Parameters:backend (mopidy.backends.base.Backend) – backend the controller is a part of
find_exact(query=None, uris=None)[source]

See mopidy.core.LibraryController.find_exact().

MAY be implemented by subclass.

lookup(uri)[source]

See mopidy.core.LibraryController.lookup().

MUST be implemented by subclass.

refresh(uri=None)[source]

See mopidy.core.LibraryController.refresh().

MAY be implemented by subclass.

search(query=None, uris=None)[source]

See mopidy.core.LibraryController.search().

MAY be implemented by subclass.

Backend listener

class mopidy.backends.listener.BackendListener[source]

Marker interface for recipients of events sent by the backend actors.

Any Pykka actor that mixes in this class will receive calls to the methods defined here when the corresponding events happen in the core actor. This interface is used both for looking up what actors to notify of the events, and for providing default implementations for those listeners that are not interested in all events.

Normally, only the Core actor should mix in this class.

on_event(event, **kwargs)[source]

Called on all events.

MAY be implemented by actor. By default, this method forwards the event to the specific event methods.

Parameters:
  • event (string) – the event name
  • kwargs – any other arguments to the specific event handlers
playlists_loaded()[source]

Called when playlists are loaded or refreshed.

MAY be implemented by actor.

static send(event, **kwargs)[source]

Helper to allow calling of backend listener events

Backend implementations

  • mopidy.backends.dummy
  • mopidy.backends.local
  • mopidy.backends.stream

Table Of Contents

Previous topic

Data models

Next topic

Core API

This Page