music.mopidy

Platypush documentation

music.mopidy#

Description#

This plugin allows you to track the events from a Mopidy instance and control it through the Mopidy HTTP API.

Requires:

  • A Mopidy instance running with the HTTP service enabled.

Configuration#

music.mopidy:
  # [Optional]
  # Mopidy host (default: localhost).
  # host: localhost  # type=str

  # [Optional]
  # Mopidy HTTP port (default: 6680).
  # port: 6680  # type=int

  # [Optional]
  # Set to True if the Mopidy server is running on HTTPS.
  # ssl: False  # type=bool

  # [Optional]
  # Default timeout for the Mopidy requests (default: 20s).
  # timeout: 20  # type=Optional[float]

  # [Optional]
  # How often the `RunnablePlugin.loop <https://docs.platypush.tech/platypush/plugins/.html#platypush.plugins.RunnablePlugin.loop>`_ function should be
  # executed (default: 15 seconds). *NOTE*: For back-compatibility
  # reasons, the `poll_seconds` argument is also supported, but it's
  # deprecated.
  # poll_interval: 15  # type=Optional[float]

  # [Optional]
  # How long we should wait for any running
  # threads/processes to stop before exiting (default: 5 seconds).
  # stop_timeout: 5  # type=Optional[float]

  # [Optional]
  # If set to True then the plugin will not monitor
  # for new events. This is useful if you want to run a plugin in
  # stateless mode and only leverage its actions, without triggering any
  # events. Defaults to False.
  # disable_monitor: False  # type=bool

Triggered events#

Actions#

Module reference#

exception platypush.plugins.music.mopidy.EmptyTrackException[source]#

Bases: MopidyException, ValueError

Raised when a parsed track is empty.

__init__(*args, **kwargs)#
add_note()#

Exception.add_note(note) – add a note to the exception

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class platypush.plugins.music.mopidy.MopidyStatus(state: PlayerState = PlayerState.STOP, volume: float = 0, consume: bool = False, random: bool = False, repeat: bool = False, single: bool = False, mute: bool = False, time: float | None = None, duration: float | None = None, playing_pos: int | None = None, track: MopidyTrack | None = None)[source]#

Bases: object

A dataclass to hold the status of the Mopidy client.

__init__(state: PlayerState = PlayerState.STOP, volume: float = 0, consume: bool = False, random: bool = False, repeat: bool = False, single: bool = False, mute: bool = False, time: float | None = None, duration: float | None = None, playing_pos: int | None = None, track: MopidyTrack | None = None) None#
to_dict()[source]#

Convert the Mopidy status to a dictionary.

class platypush.plugins.music.mopidy.MopidyTrack(uri: str, artist: str | None = None, title: str | None = None, album: str | None = None, artist_uri: str | None = None, album_uri: str | None = None, time: float | None = None, playlist_pos: int | None = None, track_id: int | None = None, track_no: int | None = None, date: str | None = None, genre: str | None = None, type: str = 'track')[source]#

Bases: object

Model for a Mopidy track.

__init__(uri: str, artist: str | None = None, title: str | None = None, album: str | None = None, artist_uri: str | None = None, album_uri: str | None = None, time: float | None = None, playlist_pos: int | None = None, track_id: int | None = None, track_no: int | None = None, date: str | None = None, genre: str | None = None, type: str = 'track') None#
classmethod parse(track: dict) MopidyTrack | None[source]#

Parse a Mopidy track from a dictionary received from the Mopidy API.

to_dict() dict[source]#

Convert the Mopidy track to a dictionary.

class platypush.plugins.music.mopidy.MusicMopidyPlugin(host: str = 'localhost', port: int = 6680, ssl: bool = False, timeout: float | None = 20, **kwargs)[source]#

Bases: RunnablePlugin

This plugin allows you to track the events from a Mopidy instance and control it through the Mopidy HTTP API.

Requires:

  • A Mopidy instance running with the HTTP service enabled.

__init__(host: str = 'localhost', port: int = 6680, ssl: bool = False, timeout: float | None = 20, **kwargs)[source]#
Parameters:
  • host – Mopidy host (default: localhost).

  • port – Mopidy HTTP port (default: 6680).

  • ssl – Set to True if the Mopidy server is running on HTTPS.

  • timeout – Default timeout for the Mopidy requests (default: 20s).

add(resource: str | Iterable[str], *_, position: int | None = None, **__)[source]#

Add a resource (track, album, artist, folder etc.) to the current playlist.

Parameters:
  • resource – Resource URI(s).

  • position – Position (0-based) where the track(s) will be inserted (default: end of the playlist).

Returns:

The list of tracks added to the queue. .. schema:: mopidy.MopidyTrackSchema(many=True)

add_to_playlist(playlist: str, resources: Iterable[str], position: int | None = None, allow_duplicates: bool = False, **__)[source]#

Add tracks to a playlist.

Parameters:
  • playlist – Playlist URI/name.

  • resources – List of track URIs.

  • position – Position where the tracks will be inserted (default: end of the playlist).

  • allow_duplicates – If True, the tracks will be added even if they are already present in the playlist (default: False).

Returns:

The modified playlist. .. schema:: mopidy.MopidyPlaylistSchema

back(delta: float = 10, **__)[source]#

Seek back by a given number of seconds.

Parameters:

delta – Number of seconds to seek back (default: 10s).

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

browse(uri: str | None = None)[source]#

Browse the items under the specified URI.

Parameters:

uri – URI to browse (default: root directory).

Returns:

A list of result under the specified resource, including:

  • Directories
    [
      {
        "name": "Directory name",
        "type": "Item type",
        "uri": "Directory URI"
      }
    ]
    
  • Tracks
    [
      {
        "album": "Album name",
        "album_uri": "Album URI (if available)",
        "artist": "Artist name",
        "artist_uri": "Artist URI (if available)",
        "date": "Track release date",
        "file": "Track URI, for MPD compatibility purposes",
        "genre": "Track genre",
        "playlist_pos": "Track position in the tracklist/playlist",
        "time": "Track length (in seconds)",
        "title": "Track title",
        "track_id": "Track ID in the current tracklist",
        "track_no": "Track number in the album",
        "type": "Item type",
        "uri": "Track URI"
      }
    ]
    
  • Albums
    [
      {
        "album": "Same as name - for MPD compatibility purposes",
        "artist": "Artist name",
        "artist_uri": "Artist URI",
        "date": "Album release date",
        "file": "Artist URI, for MPD compatibility purposes",
        "genre": "Album genre",
        "name": "Album name",
        "uri": "Album URI"
      }
    ]
    
  • Artists
    [
      {
        "artist": "Same as name - for MPD compatibility purposes",
        "file": "Artist URI, for MPD compatibility purposes",
        "name": "Artist name",
        "type": "Item type",
        "uri": "Artist URI"
      }
    ]
    

clear(**__)[source]#

Clear the current playlist.

consume(value: bool | None = None, **__)[source]#

Set the consume mode.

Parameters:

value – Consume mode. If not specified, it will toggle the current consume mode.

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

create_playlist(name: str, uri_scheme: str = 'm3u', **__)[source]#

Create a new playlist.

Parameters:
  • name – Playlist name.

  • uri_scheme – URI scheme for the playlist (default: m3u). You can get a full list of the available URI schemes that support playlist creation on the Mopidy instance by calling get_playlist_uri_schemes().

Returns:

{
  "last_modified": "2024-06-25T00:32:32.205311+00:00",
  "name": "Playlist name",
  "tracks": "Playlist tracks",
  "type": "Item type",
  "uri": "Playlist URI"
}

current_track(**__)[source]#

Get the current track.

Returns:

{
  "album": "Album name",
  "album_uri": "Album URI (if available)",
  "artist": "Artist name",
  "artist_uri": "Artist URI (if available)",
  "date": "Track release date",
  "file": "Track URI, for MPD compatibility purposes",
  "genre": "Track genre",
  "playlist_pos": "Track position in the tracklist/playlist",
  "time": "Track length (in seconds)",
  "title": "Track title",
  "track_id": "Track ID in the current tracklist",
  "track_no": "Track number in the album",
  "type": "Item type",
  "uri": "Track URI"
}

delete(positions: Iterable[int] | None = None, uris: Iterable[str] | None = None)[source]#

Delete tracks from the current tracklist.

Note

At least one of the positions or uris parameters must be specified.

Parameters:
  • positions – (0-based) positions of the tracks to be deleted.

  • uris – URIs of the tracks to be deleted.

delete_playlist(playlist: str, **__)[source]#

Delete a playlist.

Parameters:

playlist – Playlist URI.

Returns:

True if the playlist was deleted, False otherwise.

find(filter: dict, exact: bool = False, **__)[source]#

Alias for search(), for MPD compatibility.

Parameters:
  • filter

    {
      "album": "Album name(s)",
      "albumartist": "Album artist name(s)",
      "any": "Generic search string(s)",
      "artist": "Artist name(s)",
      "comment": "Comment(s)",
      "date": "Track release date(s)",
      "disc_no": "Disc number(s)",
      "genre": "Genre(s)",
      "musicbrainz_albumid": "MusicBrainz album ID(s)",
      "musicbrainz_artistid": "MusicBrainz artist ID(s)",
      "musicbrainz_trackid": "MusicBrainz album artist ID(s)",
      "title": "Track title(s)",
      "uris": "Filter by URIs"
    }
    

  • exact – If True, the search will only return exact matches.

Returns:

[
  {
    "album": "Album name",
    "album_uri": "Album URI (if available)",
    "artist": "Artist name",
    "artist_uri": "Artist URI (if available)",
    "date": "Track release date",
    "file": "Track URI, for MPD compatibility purposes",
    "genre": "Track genre",
    "playlist_pos": "Track position in the tracklist/playlist",
    "time": "Track length (in seconds)",
    "title": "Track title",
    "track_id": "Track ID in the current tracklist",
    "track_no": "Track number in the album",
    "type": "Item type",
    "uri": "Track URI"
  }
]

forward(delta: float = 10, **__)[source]#

Seek forward by a given number of seconds.

Parameters:

delta – Number of seconds to seek forward (default: 10s).

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

get_images(resources: Iterable[str], **__) Dict[str, str | None][source]#

Get the images for a list of URIs.

Parameters:

resources – List of URIs.

Returns:

Dictionary in the form {uri: image_url}.

get_playlist(playlist: str, **__)[source]#

Get the items in a playlist.

Parameters:
  • playlist – Playlist URI.

  • only_tracks – If True, only the tracks will be returned, otherwise the full playlist object will be returned - including name and other metadata.

Returns:

[
  {
    "album": "Album name",
    "album_uri": "Album URI (if available)",
    "artist": "Artist name",
    "artist_uri": "Artist URI (if available)",
    "date": "Track release date",
    "file": "Track URI, for MPD compatibility purposes",
    "genre": "Track genre",
    "playlist_pos": "Track position in the tracklist/playlist",
    "time": "Track length (in seconds)",
    "title": "Track title",
    "track_id": "Track ID in the current tracklist",
    "track_no": "Track number in the album",
    "type": "Item type",
    "uri": "Track URI"
  }
]

get_playlist_uri_schemes(**__)[source]#

Get the available playlist URI schemes.

Returns:

List of available playlist URI schemes.

get_playlists(**__)[source]#

Get the available playlists.

Returns:

[
  {
    "last_modified": "2024-06-25T00:32:32.205311+00:00",
    "name": "Playlist name",
    "tracks": "Playlist tracks",
    "type": "Item type",
    "uri": "Playlist URI"
  }
]

get_tracks(**__)[source]#

Get the current playlist tracks.

Returns:

[
  {
    "album": "Album name",
    "album_uri": "Album URI (if available)",
    "artist": "Artist name",
    "artist_uri": "Artist URI (if available)",
    "date": "Track release date",
    "file": "Track URI, for MPD compatibility purposes",
    "genre": "Track genre",
    "playlist_pos": "Track position in the tracklist/playlist",
    "time": "Track length (in seconds)",
    "title": "Track title",
    "track_id": "Track ID in the current tracklist",
    "track_no": "Track number in the album",
    "type": "Item type",
    "uri": "Track URI"
  }
]

load(playlist: str, play: bool = True)[source]#

Load/play a playlist.

This method will clear the current playlist and load the tracks from the given playlist.

You should usually prefer add() to this method, as it is more general-purpose (load only works with playlists). This method exists mainly for compatibility with the MPD plugin.

Parameters:
  • playlist – Playlist URI.

  • play – Start playback after loading the playlist (default: True).

lookup(resources: Iterable[str], **__)[source]#

Lookup (one or) resources by URI.

Given a list of URIs, this method will return a dictionary in the form {uri: [track1, track2, ...]}.

Parameters:

resource – Resource URI(s).

Returns:

[
  {
    "album": "Album name",
    "album_uri": "Album URI (if available)",
    "artist": "Artist name",
    "artist_uri": "Artist URI (if available)",
    "date": "Track release date",
    "file": "Track URI, for MPD compatibility purposes",
    "genre": "Track genre",
    "playlist_pos": "Track position in the tracklist/playlist",
    "time": "Track length (in seconds)",
    "title": "Track title",
    "track_id": "Track ID in the current tracklist",
    "track_no": "Track number in the album",
    "type": "Item type",
    "uri": "Track URI"
  }
]

main()[source]#

Implementation of the main loop of the plugin.

move(start: int | None = None, end: int | None = None, position: int | None = None, from_pos: int | None = None, to_pos: int | None = None, **__)[source]#

Move one or more tracks in the current playlist to a new position.

You can pass either:

  • start, end and position to move a slice of tracks from start to end to the new position position.

  • from_pos and to_pos to move a single track from from_pos to to_pos.

Parameters:
  • start – Start position of the slice of tracks to be moved.

  • end – End position of the slice of tracks to be moved.

  • position – New position where the tracks will be inserted.

  • from_pos – Alias for start - it only works with one track at the time. Maintained for compatibility with platypush.plugins.music.mpd.MusicMpdPlugin.move().

  • to_pos – Alias for position - it only works with one track at the time. Maintained for compatibility with platypush.plugins.music.mpd.MusicMpdPlugin.move().

next(**__)[source]#

Play the next track.

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

pause(**__)[source]#

Pause the playback.

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

pause_if_playing(**__)[source]#

Pause the playback if it’s currently playing.

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

play(resource: str | None = None, position: int | None = None, track_id: int | None = None, **__)[source]#

Start playback, or play a resource by URI.

Parameters:
  • resource – Resource path/URI. If not specified, it will resume the playback if paused/stopped, otherwise it will start playing the selected track.

  • track_id – The ID of track (or tlid) in the current playlist that should be played, if you want to play a specific track already loaded in the current playlist.

  • position – Position number (0-based) of the track in the current playlist that should be played.

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

play_if_paused(**__)[source]#

Resume the playback if it’s currently paused.

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

play_if_paused_or_stopped()[source]#

Resume the playback if it’s currently paused or stopped.

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

play_or_stop()[source]#

Play if the playback is stopped, stop if it’s playing, otherwise resume playback.

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

play_pos(pos: int)[source]#

Play a track in the current playlist by position number.

Legacy alias for play() with a position parameter.

Parameters:

pos – Position number (0-based).

playlist_clear(playlist: str, **__)[source]#

Remove all the tracks from a playlist.

Parameters:

playlist – Playlist URI/name.

Returns:

The modified playlist. .. schema:: mopidy.MopidyPlaylistSchema

playlist_move(playlist: str, start: int | None = None, end: int | None = None, position: int | None = None, from_pos: int | None = None, to_pos: int | None = None, **__)[source]#

Move tracks in a playlist.

This action can work in two different ways:

  • If the start, end and position parameters are specified, it will move an individual track from the position start to the position end to the new position position.

  • If the from_pos, to_pos and position parameters are specified, it will move the tracks in the specified range (inclusive) to the new position position.

Parameters:
  • playlist – Playlist URI.

  • start – Start position of the slice of tracks to be moved.

  • end – End position of the slice of tracks to be moved.

  • position – New position where the tracks will be inserted.

Returns:

The modified playlist. .. schema:: mopidy.MopidyPlaylistSchema

prev(**__)[source]#

Play the previous track.

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

random(value: bool | None = None, **__)[source]#

Set the random mode.

Parameters:

value – Random mode. If not specified, it will toggle the current random mode.

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

remove_from_playlist(playlist: str, resources: Iterable[str | int] | None = None, from_pos: int | None = None, to_pos: int | None = None, **__)[source]#

Remove tracks from a playlist.

This action can work in three different ways:

  • If the resources parameter is specified, and it contains strings, it will remove the tracks matching the provided URIs.

  • If the resources parameter is specified, and it contains integers, it will remove the tracks in the specified positions.

  • If the from_pos and to_pos parameters are specified, it will remove the tracks in the specified range (inclusive).

Parameters:
  • playlist – Playlist URI/name.

  • tracks – List of track URIs.

  • from_pos – Start position of the slice of tracks to be removed.

  • to_pos – End position of the slice of tracks to be removed.

Returns:

The modified playlist. .. schema:: mopidy.MopidyPlaylistSchema

rename_playlist(playlist: str, new_name: str, **__)[source]#

Rename a playlist.

Parameters:
  • playlist – Playlist URI/name.

  • new_name – New playlist name.

Returns:

The modified playlist. .. schema:: mopidy.MopidyPlaylistSchema

repeat(value: bool | None = None, **__)[source]#

Set the repeat mode.

Parameters:

value – Repeat mode. If not specified, it will toggle the current repeat mode.

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

save(name: str, **__)[source]#

Save the current tracklist to a new playlist with the given name.

Parameters:

name – New playlist name.

search(filter: dict, exact: bool = False, **__)[source]#

Search items that match the given query.

Parameters:
  • filter

    {
      "album": "Album name(s)",
      "albumartist": "Album artist name(s)",
      "any": "Generic search string(s)",
      "artist": "Artist name(s)",
      "comment": "Comment(s)",
      "date": "Track release date(s)",
      "disc_no": "Disc number(s)",
      "genre": "Genre(s)",
      "musicbrainz_albumid": "MusicBrainz album ID(s)",
      "musicbrainz_artistid": "MusicBrainz artist ID(s)",
      "musicbrainz_trackid": "MusicBrainz album artist ID(s)",
      "title": "Track title(s)",
      "uris": "Filter by URIs"
    }
    

  • exact – If True, the search will only return exact matches.

Returns:

A list of result, including:

  • Tracks
    [
      {
        "album": "Album name",
        "album_uri": "Album URI (if available)",
        "artist": "Artist name",
        "artist_uri": "Artist URI (if available)",
        "date": "Track release date",
        "file": "Track URI, for MPD compatibility purposes",
        "genre": "Track genre",
        "playlist_pos": "Track position in the tracklist/playlist",
        "time": "Track length (in seconds)",
        "title": "Track title",
        "track_id": "Track ID in the current tracklist",
        "track_no": "Track number in the album",
        "type": "Item type",
        "uri": "Track URI"
      }
    ]
    
  • Albums
    [
      {
        "album": "Same as name - for MPD compatibility purposes",
        "artist": "Artist name",
        "artist_uri": "Artist URI",
        "date": "Album release date",
        "file": "Artist URI, for MPD compatibility purposes",
        "genre": "Album genre",
        "name": "Album name",
        "uri": "Album URI"
      }
    ]
    
  • Artists
    [
      {
        "artist": "Same as name - for MPD compatibility purposes",
        "file": "Artist URI, for MPD compatibility purposes",
        "name": "Artist name",
        "type": "Item type",
        "uri": "Artist URI"
      }
    ]
    

seek(position: float, **__)[source]#

Seek to a given position in the current track.

Parameters:

position – Position in seconds.

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

set_volume(volume: int, **__)[source]#

Set the volume.

Parameters:

volume – Volume level (0-100).

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

shuffle(**__)[source]#

Shuffle the current playlist.

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

single(value: bool | None = None, **__)[source]#

Set the single mode.

Parameters:

value – Single mode. If not specified, it will toggle the current single mode.

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

start()#

Start the plugin.

status(**__)[source]#

Get the current Mopidy status.

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

stop(**__)[source]#

Stop the playback.

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

voldown(step: int = 5, **__)[source]#

Decrease the volume by a given step.

Parameters:

step – Volume step (default: 5%).

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

volup(step: int = 5, **__)[source]#

Increase the volume by a given step.

Parameters:

step – Volume step (default: 5%).

Returns:

{
  "consume": "Consume mode",
  "mute": "Mute mode",
  "playing_pos": "Index of the currently playing track",
  "random": "Random mode",
  "repeat": "Repeat mode",
  "single": "Single mode",
  "state": "Player state",
  "time": "Current time (in seconds)",
  "track": "Current track",
  "volume": "Player volume (0-100)"
}

wait_stop(timeout=None)#

Wait until a stop event is received.