mopidy.frontends.mpd – MPD server

For details on how to use Mopidy’s MPD server, see Mopidy-MPD.

MPD dispatcher

class mopidy.frontends.mpd.dispatcher.MpdContext(dispatcher, session=None, config=None, core=None)[source]

This object is passed as the first argument to all MPD command handlers to give the command handlers access to important parts of Mopidy.

config = None

The Mopidy configuration.

core = None

The Mopidy core API. An instance of mopidy.core.Core.

dispatcher = None

The current MpdDispatcher.

events = None

The active subsystems that have pending events.

lookup_playlist_from_name(name)[source]

Helper function to retrieve a playlist from its unique MPD name.

lookup_playlist_name_from_uri(uri)[source]

Helper function to retrieve the unique MPD playlist name from its uri.

refresh_playlists_mapping()[source]

Maintain map between playlists and unique playlist names to be used by MPD

session = None

The current mopidy.frontends.mpd.MpdSession.

subscriptions = None

The subsytems that we want to be notified about in idle mode.

class mopidy.frontends.mpd.dispatcher.MpdDispatcher(session=None, config=None, core=None)[source]

The MPD session feeds the MPD dispatcher with requests. The dispatcher finds the correct handler, processes the request and sends the response back to the MPD session.

handle_request(request, current_command_list_index=None)[source]

Dispatch incoming requests to the correct handler.

MPD protocol

rather incomplete with regards to data formats, both for requests and responses. Thus, we have had to talk a great deal with the the original MPD server using telnet to get the details we need to implement our own MPD server which is compatible with the numerous existing MPD clients.

mopidy.frontends.mpd.protocol.ENCODING = u'UTF-8'

The MPD protocol uses UTF-8 for encoding all data.

mopidy.frontends.mpd.protocol.LINE_TERMINATOR = u'\n'

The MPD protocol uses \n as line terminator.

class mopidy.frontends.mpd.protocol.MpdCommand

MpdCommand(name, auth_required)

auth_required

Alias for field number 1

name

Alias for field number 0

mopidy.frontends.mpd.protocol.VERSION = u'0.17.0'

The MPD protocol version is 0.17.0.

mopidy.frontends.mpd.protocol.handle_request(pattern, auth_required=True)[source]

Decorator for connecting command handlers to command requests.

If you use named groups in the pattern, the decorated method will get the groups as keyword arguments. If the group is optional, remember to give the argument a default value.

For example, if the command is do that thing the what argument will be this thing:

@handle_request('do\ (?P<what>.+)$')
def do(what):
    ...

Note that the patterns are compiled with the re.VERBOSE flag. Thus, you must escape any space characters you want to match, but you’re also free to add non-escaped whitespace to format the pattern for easier reading.

Parameters:pattern (string) – regexp pattern for matching commands
mopidy.frontends.mpd.protocol.load_protocol_modules()[source]

The protocol modules must be imported to get them registered in request_handlers and mpd_commands.

mopidy.frontends.mpd.protocol.mpd_commands = set([MpdCommand(name=u'stop', auth_required=True), MpdCommand(name=u'listall', auth_required=True), MpdCommand(name=u'noidle', auth_required=True), MpdCommand(name=u'plchangesposid', auth_required=True), MpdCommand(name=u'ping', auth_required=False), MpdCommand(name=u'listplaylists', auth_required=True), MpdCommand(name=u'playlistmove', auth_required=True), MpdCommand(name=u'findadd', auth_required=True), MpdCommand(name=u'pause', auth_required=True), MpdCommand(name=u'sendmessage', auth_required=True), MpdCommand(name=u'notcommands', auth_required=False), MpdCommand(name=u'moveid', auth_required=True), MpdCommand(name=u'playlistid', auth_required=True), MpdCommand(name=u'readmessages', auth_required=True), MpdCommand(name=u'listplaylistinfo', auth_required=True), MpdCommand(name=u'config', auth_required=False), MpdCommand(name=u'currentsong', auth_required=True), MpdCommand(name=u'consume', auth_required=True), MpdCommand(name=u'status', auth_required=True), MpdCommand(name=u'searchadd', auth_required=True), MpdCommand(name=u'single', auth_required=True), MpdCommand(name=u'previous', auth_required=True), MpdCommand(name=u'command_list_end', auth_required=True), MpdCommand(name=u'update', auth_required=True), MpdCommand(name=u'command_list_begin', auth_required=True), MpdCommand(name=u'replay_gain_mode', auth_required=True), MpdCommand(name=u'playlistdelete', auth_required=True), MpdCommand(name=u'repeat', auth_required=True), MpdCommand(name=u'rename', auth_required=True), MpdCommand(name=u'playlist', auth_required=True), MpdCommand(name=u'next', auth_required=True), MpdCommand(name=u'playlistclear', auth_required=True), MpdCommand(name=u'close', auth_required=False), MpdCommand(name=u'move', auth_required=True), MpdCommand(name=u'rm', auth_required=True), MpdCommand(name=u'clear', auth_required=True), MpdCommand(name=u'swap', auth_required=True), MpdCommand(name=u'replay_gain_status', auth_required=True), MpdCommand(name=u'shuffle', auth_required=True), MpdCommand(name=u'add', auth_required=True), MpdCommand(name=u'count', auth_required=True), MpdCommand(name=u'password', auth_required=False), MpdCommand(name=u'listallinfo', auth_required=True), MpdCommand(name=u'playid', auth_required=True), MpdCommand(name=u'swapid', auth_required=True), MpdCommand(name=u'outputs', auth_required=True), MpdCommand(name=u'unsubscribe', auth_required=True), MpdCommand(name=u'disableoutput', auth_required=True), MpdCommand(name=u'kill', auth_required=True), MpdCommand(name=u'subscribe', auth_required=True), MpdCommand(name=u'searchaddpl', auth_required=True), MpdCommand(name=u'addid', auth_required=True), MpdCommand(name=u'commands', auth_required=False), MpdCommand(name=u'command_list_ok_begin', auth_required=True), MpdCommand(name=u'play', auth_required=True), MpdCommand(name=u'rescan', auth_required=True), MpdCommand(name=u'playlistfind', auth_required=True), MpdCommand(name=u'stats', auth_required=True), MpdCommand(name=u'seekid', auth_required=True), MpdCommand(name=u'load', auth_required=True), MpdCommand(name=u'setvol', auth_required=True), MpdCommand(name=u'listplaylist', auth_required=True), MpdCommand(name=u'save', auth_required=True), MpdCommand(name=u'list', auth_required=True), MpdCommand(name=u'seekcur', auth_required=True), MpdCommand(name=u'urlhandlers', auth_required=True), MpdCommand(name=u'playlistadd', auth_required=True), MpdCommand(name=u'tagtypes', auth_required=True), MpdCommand(name=u'sticker', auth_required=True), MpdCommand(name=u'random', auth_required=True), MpdCommand(name=u'search', auth_required=True), MpdCommand(name=u'lsinfo', auth_required=True), MpdCommand(name=u'channels', auth_required=True), MpdCommand(name=u'find', auth_required=True), MpdCommand(name=u'plchanges', auth_required=True), MpdCommand(name=u'decoders', auth_required=True), MpdCommand(name=u'clearerror', auth_required=True), MpdCommand(name=u'enableoutput', auth_required=True), MpdCommand(name=u'seek', auth_required=True), MpdCommand(name=u'playlistinfo', auth_required=True), MpdCommand(name=u'crossfade', auth_required=True), MpdCommand(name=u'playlistsearch', auth_required=True), MpdCommand(name=u'deleteid', auth_required=True), MpdCommand(name=u'idle', auth_required=True), MpdCommand(name=u'delete', auth_required=True)])

Set of all available commands, represented as MpdCommand objects.

mopidy.frontends.mpd.protocol.request_handlers = {<_sre.SRE_Pattern object at 0xb52c020>: <function unsubscribe at 0xb8b6144>, <_sre.SRE_Pattern object at 0xb538078>: <function setvol at 0xba5c87c>, <_sre.SRE_Pattern object at 0xafacac8>: <function consume at 0xb6cf79c>, <_sre.SRE_Pattern object at 0xae0a020>: <function kill at 0xb4477d4>, <_sre.SRE_Pattern object at 0xb40e0f8>: <function channels at 0xb8b60d4>, <_sre.SRE_Pattern object at 0xaed41e8>: <function disableoutput at 0xb8b62cc>, <_sre.SRE_Pattern object at 0xbb08200>: <function sticker_set at 0xb43833c>, <_sre.SRE_Pattern object at 0xb4b6218>: <function playlistinfo at 0xb77fdbc>, <_sre.SRE_Pattern object at 0xb286228>: <function listallinfo at 0xb6cfbfc>, <_sre.SRE_Pattern object at 0xb00a250>: <function replay_gain_mode at 0xba5c79c>, <_sre.SRE_Pattern object at 0xb518278>: <function sticker_get at 0xb4382cc>, <_sre.SRE_Pattern object at 0xb372280>: <function play at 0xba5c6bc>, <_sre.SRE_Pattern object at 0xb40e2a8>: <function commands at 0xba5caac>, <_sre.SRE_Pattern object at 0xad8c2d8>: <function save at 0xb77fb1c>, <_sre.SRE_Pattern object at 0xb816310>: <function find at 0xb6cf7d4>, <_sre.SRE_Pattern object at 0xadd8340>: <function listallinfo at 0xb6cfbfc>, <_sre.SRE_Pattern object at 0xade0360>: <function sticker_list at 0xb438304>, <_sre.SRE_Pattern object at 0xb3723b0>: <function next_ at 0xba5c614>, <_sre.SRE_Pattern object at 0xb7d4608>: <function tagtypes at 0xba5cb54>, <_sre.SRE_Pattern object at 0xb6aa438>: <function moveid at 0xb77f9cc>, <_sre.SRE_Pattern object at 0xac2c458>: <function seekcur at 0xba5c8b4>, <_sre.SRE_Pattern object at 0xae484a0>: <function listplaylist at 0xb77f844>, <_sre.SRE_Pattern object at 0xb42a0d0>: <function search at 0xb6cfa74>, <_sre.SRE_Pattern object at 0xb19e558>: <function playlistclear at 0xb77f144>, <_sre.SRE_Pattern object at 0xaed45b0>: <function addid at 0xb77fd4c>, <_sre.SRE_Pattern object at 0xaee25d0>: <function playlistsearch at 0xb77ffb4>, <_sre.SRE_Pattern object at 0xab7a608>: <function close at 0xb4471b4>, <_sre.SRE_Pattern object at 0xb61c630>: <function sendmessage at 0xb4478b4>, <_sre.SRE_Pattern object at 0xb6aebd8>: <function update at 0xb6cf95c>, <_sre.SRE_Pattern object at 0xb83c700>: <function empty at 0xb77f6f4>, <_sre.SRE_Pattern object at 0xb026738>: <function rename at 0xb77f8b4>, <_sre.SRE_Pattern object at 0xb372740>: <function stop at 0xba5c924>, <_sre.SRE_Pattern object at 0xb8f0770>: <function subscribe at 0xb8b61ec>, <_sre.SRE_Pattern object at 0xb7d4890>: <function decoders at 0xba5cae4>, <_sre.SRE_Pattern object at 0xb1228d8>: <function clearerror at 0xba5cd14>, <_sre.SRE_Pattern object at 0xadd48f0>: <function rescan at 0xb6cf614>, <_sre.SRE_Pattern object at 0xb526940>: <function listall at 0xb6cf25c>, <_sre.SRE_Pattern object at 0xae4c950>: <function plchanges at 0xb77fe64>, <_sre.SRE_Pattern object at 0xb60a9a8>: <function playpos at 0xba5c48c>, <_sre.SRE_Pattern object at 0xb1649d0>: <function playlistinfo at 0xb77fdbc>, <_sre.SRE_Pattern object at 0xb1129e0>: <function playlistfind at 0xb77ff7c>, <_sre.SRE_Pattern object at 0xb92aa38>: <function idle at 0xba5cdbc>, <_sre.SRE_Pattern object at 0xb4b6ac0>: <function lsinfo at 0xb6cf87c>, <_sre.SRE_Pattern object at 0xaa52ae8>: <function rescan at 0xb6cf614>, <_sre.SRE_Pattern object at 0xb372b68>: <function ping at 0xb737614>, <_sre.SRE_Pattern object at 0xb122bc0>: <function playlistid at 0xb77fed4>, <_sre.SRE_Pattern object at 0xb4c4bd0>: <function single at 0xba5c8ec>, <_sre.SRE_Pattern object at 0xb40ebf0>: <function playlist at 0xb77fa04>, <_sre.SRE_Pattern object at 0xb06cc30>: <function readmessages at 0xb8b610c>, <_sre.SRE_Pattern object at 0xb38eca0>: <function searchaddpl at 0xb6cf8b4>, <_sre.SRE_Pattern object at 0xb40ecc8>: <function previous at 0xba5c6f4>, <_sre.SRE_Pattern object at 0xabf2220>: <function urlhandlers at 0xba5cb8c>, <_sre.SRE_Pattern object at 0xb166d48>: <function sticker_find at 0xb438294>, <_sre.SRE_Pattern object at 0xb40eda0>: <function add at 0xb77f614>, <_sre.SRE_Pattern object at 0xabf4e70>: <function plchangesposid at 0xb77f374>, <_sre.SRE_Pattern object at 0xb411278>: <function rm at 0xb77f41c>, <_sre.SRE_Pattern object at 0xb824ee8>: <function swap at 0xb77f5a4>, <_sre.SRE_Pattern object at 0xb80cef0>: <function seekid at 0xba5c844>, <_sre.SRE_Pattern object at 0xaf64f00>: <function repeat at 0xba5c764>, <_sre.SRE_Pattern object at 0xae82f48>: <function password_ at 0xb7376bc>, <_sre.SRE_Pattern object at 0xae7b7f8>: <function deleteid at 0xb77fd14>, <_sre.SRE_Pattern object at 0xb422fd8>: <function playid at 0xba5c4fc>, <_sre.SRE_Pattern object at 0xac09088>: <function move_songpos at 0xb77f95c>, <_sre.SRE_Pattern object at 0xb421230>: <function move_range at 0xb77f72c>, <_sre.SRE_Pattern object at 0xabfd278>: <function command_list_begin at 0xb44717c>, <_sre.SRE_Pattern object at 0xb7212b0>: <function delete_range at 0xb77fa3c>, <_sre.SRE_Pattern object at 0xaf472f0>: <function delete_songpos at 0xb77fd84>, <_sre.SRE_Pattern object at 0xb4ad350>: <function seekcur at 0xba5c8b4>, <_sre.SRE_Pattern object at 0xad7b368>: <function pause at 0xba5c1ec>, <_sre.SRE_Pattern object at 0xac3d380>: <function shuffle at 0xb77f4fc>, <_sre.SRE_Pattern object at 0xb83b3d0>: <function enableoutput at 0xb8b609c>, <_sre.SRE_Pattern object at 0xb5973e8>: <function currentsong at 0xba5cd4c>, <_sre.SRE_Pattern object at 0xb122ac8>: <function pause at 0xba5c1ec>, <_sre.SRE_Pattern object at 0xafb9490>: <function command_list_end at 0xb44780c>, <_sre.SRE_Pattern object at 0xae69578>: <function playlistid at 0xb77fed4>, <_sre.SRE_Pattern object at 0xb3875a0>: <function swapid at 0xb77f3ac>, <_sre.SRE_Pattern object at 0xb1b3630>: <function findadd at 0xb6cfe9c>, <_sre.SRE_Pattern object at 0xad81698>: <function noidle at 0xba5cd84>, <_sre.SRE_Pattern object at 0xadb76a8>: <function replay_gain_status at 0xba5c7d4>, <_sre.SRE_Pattern object at 0xb2876e0>: <function list_ at 0xb6cfdbc>, <_sre.SRE_Pattern object at 0xad81e80>: <function status at 0xba5ce2c>, <_sre.SRE_Pattern object at 0xad81750>: <function update at 0xb6cf95c>, <_sre.SRE_Pattern object at 0xb4117f0>: <function shuffle at 0xb77f4fc>, <_sre.SRE_Pattern object at 0xb819800>: <function playlistadd at 0xb77f534>, <_sre.SRE_Pattern object at 0xaf2f960>: <function crossfade at 0xba5c17c>, <_sre.SRE_Pattern object at 0xad7b8a8>: <function clear at 0xb77f79c>, <_sre.SRE_Pattern object at 0xb4118b8>: <function outputs at 0xb8b625c>, <_sre.SRE_Pattern object at 0xb535968>: <function random at 0xba5c72c>, <_sre.SRE_Pattern object at 0xad81978>: <function config at 0xba5ca74>, <_sre.SRE_Pattern object at 0xb411980>: <function listall at 0xb6cf25c>, <_sre.SRE_Pattern object at 0xaefb9e0>: <function idle at 0xba5cdbc>, <_sre.SRE_Pattern object at 0xba73a00>: <function playlistinfo at 0xb77fdbc>, <_sre.SRE_Pattern object at 0xb1f9a68>: <function sticker_delete at 0xb43825c>, <_sre.SRE_Pattern object at 0xac31b18>: <function load at 0xb77f1ec>, <_sre.SRE_Pattern object at 0xb013bd8>: <function searchadd at 0xb6cf224>, <_sre.SRE_Pattern object at 0xafb5a00>: <function notcommands at 0xba5cb1c>, <_sre.SRE_Pattern object at 0xad7bc98>: <function stats at 0xba5cdf4>, <_sre.SRE_Pattern object at 0xabf4bd0>: <function listplaylistinfo at 0xb77f56c>, <_sre.SRE_Pattern object at 0xae5de20>: <function command_list_ok_begin at 0xb44787c>, <_sre.SRE_Pattern object at 0xb537e68>: <function playlistmove at 0xb77f09c>, <_sre.SRE_Pattern object at 0xb285e80>: <function playlistdelete at 0xb77f0d4>, <_sre.SRE_Pattern object at 0xac93ee0>: <function listplaylists at 0xb77f684>, <_sre.SRE_Pattern object at 0xbb09f20>: <function count at 0xb77fca4>, <_sre.SRE_Pattern object at 0xb137f38>: <function lsinfo at 0xb6cf87c>, <_sre.SRE_Pattern object at 0xac2bfc0>: <function seek at 0xba5c80c>}

Map between request matchers and request handler functions.

Audio output

mopidy.frontends.mpd.protocol.audio_output.disableoutput(context, outputid)[source]
  • Pattern: disableoutput\ "(?P<outputid>\d+)"$

musicpd.org, audio output section:

disableoutput

Turns an output off.

mopidy.frontends.mpd.protocol.audio_output.enableoutput(context, outputid)[source]
  • Pattern: enableoutput\ "(?P<outputid>\d+)"$

musicpd.org, audio output section:

enableoutput

Turns an output on.

mopidy.frontends.mpd.protocol.audio_output.outputs(context)[source]
  • Pattern: outputs$

musicpd.org, audio output section:

outputs

Shows information about all outputs.

Channels

mopidy.frontends.mpd.protocol.channels.channels(context)[source]
  • Pattern: channels$

musicpd.org, client to client section:

channels

Obtain a list of all channels. The response is a list of “channel:” lines.

mopidy.frontends.mpd.protocol.channels.readmessages(context)[source]
  • Pattern: readmessages$

musicpd.org, client to client section:

readmessages

Reads messages for this client. The response is a list of “channel:” and “message:” lines.

mopidy.frontends.mpd.protocol.channels.sendmessage(context, channel, text)[source]
  • Pattern: sendmessage\ "(?P<channel>[A-Za-z0-9:._-]+)"\ "(?P<text>[^"]*)"$

musicpd.org, client to client section:

sendmessage {CHANNEL} {TEXT}

Send a message to the specified channel.

mopidy.frontends.mpd.protocol.channels.subscribe(context, channel)[source]
  • Pattern: subscribe\ "(?P<channel>[A-Za-z0-9:._-]+)"$

musicpd.org, client to client section:

subscribe {NAME}

Subscribe to a channel. The channel is created if it does not exist already. The name may consist of alphanumeric ASCII characters plus underscore, dash, dot and colon.

mopidy.frontends.mpd.protocol.channels.unsubscribe(context, channel)[source]
  • Pattern: unsubscribe\ "(?P<channel>[A-Za-z0-9:._-]+)"$

musicpd.org, client to client section:

unsubscribe {NAME}

Unsubscribe from a channel.

Command list

mopidy.frontends.mpd.protocol.command_list.command_list_begin(context)[source]
  • Pattern: command_list_begin$

musicpd.org, command list section:

To facilitate faster adding of files etc. you can pass a list of commands all at once using a command list. The command list begins with command_list_begin or command_list_ok_begin and ends with command_list_end.

It does not execute any commands until the list has ended. The return value is whatever the return for a list of commands is. On success for all commands, OK is returned. If a command fails, no more commands are executed and the appropriate ACK error is returned. If command_list_ok_begin is used, list_OK is returned for each successful command executed in the command list.

mopidy.frontends.mpd.protocol.command_list.command_list_end(context)[source]
  • Pattern: command_list_end$

See command_list_begin().

mopidy.frontends.mpd.protocol.command_list.command_list_ok_begin(context)[source]
  • Pattern: command_list_ok_begin$

See command_list_begin().

Connection

mopidy.frontends.mpd.protocol.connection.close(context)[source]
  • Pattern: close$

musicpd.org, connection section:

close

Closes the connection to MPD.

mopidy.frontends.mpd.protocol.connection.kill(context)[source]
  • Pattern: kill$

musicpd.org, connection section:

kill

Kills MPD.

mopidy.frontends.mpd.protocol.connection.password_(context, password)[source]
  • Pattern: password\ "(?P<password>[^"]+)"$

musicpd.org, connection section:

password {PASSWORD}

This is used for authentication with the server. PASSWORD is simply the plaintext password.

mopidy.frontends.mpd.protocol.connection.ping(context)[source]
  • Pattern: ping$

musicpd.org, connection section:

ping

Does nothing but return OK.

Current playlist

mopidy.frontends.mpd.protocol.current_playlist.add(context, uri)[source]
  • Pattern: add\ "(?P<uri>[^"]*)"$

musicpd.org, current playlist section:

add {URI}

Adds the file URI to the playlist (directories add recursively). URI can also be a single file.

Clarifications:

  • add "" should add all tracks in the library to the current playlist.
mopidy.frontends.mpd.protocol.current_playlist.addid(context, uri, songpos=None)[source]
  • Pattern: addid\ "(?P<uri>[^"]*)"(\ "(?P<songpos>\d+)")*$

musicpd.org, current playlist section:

addid {URI} [POSITION]

Adds a song to the playlist (non-recursive) and returns the song id.

URI is always a single file or URL. For example:

addid "foo.mp3"
Id: 999
OK

Clarifications:

  • addid "" should return an error.
mopidy.frontends.mpd.protocol.current_playlist.clear(context)[source]
  • Pattern: clear$

musicpd.org, current playlist section:

clear

Clears the current playlist.

mopidy.frontends.mpd.protocol.current_playlist.delete_range(context, start, end=None)[source]
  • Pattern: delete\ "(?P<start>\d+):(?P<end>\d+)*"$

musicpd.org, current playlist section:

delete [{POS} | {START:END}]

Deletes a song from the playlist.

mopidy.frontends.mpd.protocol.current_playlist.delete_songpos(context, songpos)[source]
  • Pattern: delete\ "(?P<songpos>\d+)"$

See delete_range()

mopidy.frontends.mpd.protocol.current_playlist.deleteid(context, tlid)[source]
  • Pattern: deleteid\ "(?P<tlid>\d+)"$

musicpd.org, current playlist section:

deleteid {SONGID}

Deletes the song SONGID from the playlist

mopidy.frontends.mpd.protocol.current_playlist.move_range(context, start, to, end=None)[source]
  • Pattern: move\ "(?P<start>\d+):(?P<end>\d+)*"\ "(?P<to>\d+)"$

musicpd.org, current playlist section:

move [{FROM} | {START:END}] {TO}

Moves the song at FROM or range of songs at START:END to TO in the playlist.

mopidy.frontends.mpd.protocol.current_playlist.move_songpos(context, songpos, to)[source]
  • Pattern: move\ "(?P<songpos>\d+)"\ "(?P<to>\d+)"$

See move_range().

mopidy.frontends.mpd.protocol.current_playlist.moveid(context, tlid, to)[source]
  • Pattern: moveid\ "(?P<tlid>\d+)"\ "(?P<to>\d+)"$

musicpd.org, current playlist section:

moveid {FROM} {TO}

Moves the song with FROM (songid) to TO (playlist index) in the playlist. If TO is negative, it is relative to the current song in the playlist (if there is one).

mopidy.frontends.mpd.protocol.current_playlist.playlist(context)[source]
  • Pattern: playlist$

musicpd.org, current playlist section:

playlist

Displays the current playlist.

Note

Do not use this, instead use playlistinfo.

mopidy.frontends.mpd.protocol.current_playlist.playlistfind(context, tag, needle)[source]
  • Pattern: playlistfind\ ("?)(?P<tag>[^"]+)\1\ "(?P<needle>[^"]+)"$

musicpd.org, current playlist section:

playlistfind {TAG} {NEEDLE}

Finds songs in the current playlist with strict matching.

GMPC:

  • does not add quotes around the tag.
mopidy.frontends.mpd.protocol.current_playlist.playlistid(context, tlid=None)[source]
  • Pattern: playlistid$
  • Pattern: playlistid\ "(?P<tlid>\d+)"$

musicpd.org, current playlist section:

playlistid {SONGID}

Displays a list of songs in the playlist. SONGID is optional and specifies a single song to display info for.

mopidy.frontends.mpd.protocol.current_playlist.playlistinfo(context, songpos=None, start=None, end=None)[source]
  • Pattern: playlistinfo$
  • Pattern: playlistinfo\ "(?P<songpos>-?\d+)"$
  • Pattern: playlistinfo\ "(?P<start>\d+):(?P<end>\d+)*"$

musicpd.org, current playlist section:

playlistinfo [[SONGPOS] | [START:END]]

Displays a list of all songs in the playlist, or if the optional argument is given, displays information only for the song SONGPOS or the range of songs START:END.

ncmpc and mpc:

  • uses negative indexes, like playlistinfo "-1", to request the entire playlist
mopidy.frontends.mpd.protocol.current_playlist.playlistsearch(context, tag, needle)[source]
  • Pattern: playlistsearch\ ("?)(?P<tag>\w+)\1\ "(?P<needle>[^"]+)"$

musicpd.org, current playlist section:

playlistsearch {TAG} {NEEDLE}

Searches case-sensitively for partial matches in the current playlist.

GMPC:

  • does not add quotes around the tag
  • uses filename and any as tags
mopidy.frontends.mpd.protocol.current_playlist.plchanges(context, version)[source]
  • Pattern: plchanges\ ("?)(?P<version>-?\d+)\1$

musicpd.org, current playlist section:

plchanges {VERSION}

Displays changed songs currently in the playlist since VERSION.

To detect songs that were deleted at the end of the playlist, use playlistlength returned by status command.

MPDroid:

  • Calls plchanges "-1" two times per second to get the entire playlist.
mopidy.frontends.mpd.protocol.current_playlist.plchangesposid(context, version)[source]
  • Pattern: plchangesposid\ "(?P<version>\d+)"$

musicpd.org, current playlist section:

plchangesposid {VERSION}

Displays changed songs currently in the playlist since VERSION. This function only returns the position and the id of the changed song, not the complete metadata. This is more bandwidth efficient.

To detect songs that were deleted at the end of the playlist, use playlistlength returned by status command.

mopidy.frontends.mpd.protocol.current_playlist.shuffle(context, start=None, end=None)[source]
  • Pattern: shuffle$
  • Pattern: shuffle\ "(?P<start>\d+):(?P<end>\d+)*"$

musicpd.org, current playlist section:

shuffle [START:END]

Shuffles the current playlist. START:END is optional and specifies a range of songs.

mopidy.frontends.mpd.protocol.current_playlist.swap(context, songpos1, songpos2)[source]
  • Pattern: swap\ "(?P<songpos1>\d+)"\ "(?P<songpos2>\d+)"$

musicpd.org, current playlist section:

swap {SONG1} {SONG2}

Swaps the positions of SONG1 and SONG2.

mopidy.frontends.mpd.protocol.current_playlist.swapid(context, tlid1, tlid2)[source]
  • Pattern: swapid\ "(?P<tlid1>\d+)"\ "(?P<tlid2>\d+)"$

musicpd.org, current playlist section:

swapid {SONG1} {SONG2}

Swaps the positions of SONG1 and SONG2 (both song ids).

Music database

mopidy.frontends.mpd.protocol.music_db.count(context, mpd_query)[source]
  • Pattern: ``count (?P<mpd_query>

    (?: # Non-capturing group for repeating query pairs

    ”? # Optional quote around the field type (?:

    [Aa]lbum

    [Aa]lbumartist
    [Aa]ny
    [Aa]rtist
    [Cc]omment
    [Cc]omposer
    [Dd]ate
    [Ff]ile
    [Ff]ilename
    [Gg]enre
    [Pp]erformer
    [Tt]itle
    [Tt]rack

    ) ”? # End of optional quote around the field type # A single space “[^”]*” # Matching a quoted search string s?

    )+

``

musicpd.org, music database section:

count {TAG} {NEEDLE}

Counts the number of songs and their total playtime in the db matching TAG exactly.

GMPC:

  • does not add quotes around the tag argument.
  • use multiple tag-needle pairs to make more specific searches.
mopidy.frontends.mpd.protocol.music_db.find(context, mpd_query)[source]
  • Pattern: ``find (?P<mpd_query>

    (?: # Non-capturing group for repeating query pairs

    ”? # Optional quote around the field type (?:

    [Aa]lbum

    [Aa]lbumartist
    [Aa]ny
    [Aa]rtist
    [Cc]omment
    [Cc]omposer
    [Dd]ate
    [Ff]ile
    [Ff]ilename
    [Gg]enre
    [Pp]erformer
    [Tt]itle
    [Tt]rack

    ) ”? # End of optional quote around the field type # A single space “[^”]*” # Matching a quoted search string s?

    )+

``

musicpd.org, music database section:

find {TYPE} {WHAT}

Finds songs in the db that are exactly WHAT. TYPE can be any tag supported by MPD, or one of the two special parameters - file to search by full path (relative to database root), and any to match against all available tags. WHAT is what to find.

GMPC:

  • does not add quotes around the field argument.
  • also uses find album "[ALBUM]" artist "[ARTIST]" to list album tracks.

ncmpc:

  • does not add quotes around the field argument.
  • capitalizes the type argument.

ncmpcpp:

  • also uses the search type “date”.
  • uses “file” instead of “filename”.
mopidy.frontends.mpd.protocol.music_db.findadd(context, mpd_query)[source]
  • Pattern: ``findadd (?P<mpd_query>

    (?: # Non-capturing group for repeating query pairs

    ”? # Optional quote around the field type (?:

    [Aa]lbum

    [Aa]lbumartist
    [Aa]ny
    [Aa]rtist
    [Cc]omment
    [Cc]omposer
    [Dd]ate
    [Ff]ile
    [Ff]ilename
    [Gg]enre
    [Pp]erformer
    [Tt]itle
    [Tt]rack

    ) ”? # End of optional quote around the field type # A single space “[^”]*” # Matching a quoted search string s?

    )+

``

musicpd.org, music database section:

findadd {TYPE} {WHAT}

Finds songs in the db that are exactly WHAT and adds them to current playlist. Parameters have the same meaning as for find.

mopidy.frontends.mpd.protocol.music_db.list_(context, field, mpd_query=None)[source]
  • Pattern: ``list (”?) # Optional quote around the field type (?P<field>( # Field to list in the response

    [Aa]lbum

    [Aa]lbumartist
    [Aa]rtist
    [Cc]omposer
    [Dd]ate
    [Gg]enre
    [Pp]erformer

    )) 1 # End of optional quote around the field type (?: # Non-capturing group for optional search query

    # A single space (?P<mpd_query>.*)

    )? $

``

musicpd.org, music database section:

list {TYPE} [ARTIST]

Lists all tags of the specified type. TYPE should be album, artist, albumartist, date, or genre.

ARTIST is an optional parameter when type is album, date, or genre. This filters the result list by an artist.

Clarifications:

The musicpd.org documentation for list is far from complete. The command also supports the following variant:

list {TYPE} {QUERY}

Where QUERY applies to all TYPE. QUERY is one or more pairs of a field name and a value. If the QUERY consists of more than one pair, the pairs are AND-ed together to find the result. Examples of valid queries and what they should return:

list "artist" "artist" "ABBA"

List artists where the artist name is “ABBA”. Response:

Artist: ABBA
OK
list "album" "artist" "ABBA"

Lists albums where the artist name is “ABBA”. Response:

Album: More ABBA Gold: More ABBA Hits
Album: Absolute More Christmas
Album: Gold: Greatest Hits
OK
list "artist" "album" "Gold: Greatest Hits"

Lists artists where the album name is “Gold: Greatest Hits”. Response:

Artist: ABBA
OK
list "artist" "artist" "ABBA" "artist" "TLC"

Lists artists where the artist name is “ABBA” and “TLC”. Should never match anything. Response:

OK
list "date" "artist" "ABBA"

Lists dates where artist name is “ABBA”. Response:

Date:
Date: 1992
Date: 1993
OK
list "date" "artist" "ABBA" "album" "Gold: Greatest Hits"

Lists dates where artist name is “ABBA” and album name is “Gold: Greatest Hits”. Response:

Date: 1992
OK
list "genre" "artist" "The Rolling Stones"

Lists genres where artist name is “The Rolling Stones”. Response:

Genre:
Genre: Rock
OK

GMPC:

  • does not add quotes around the field argument.

ncmpc:

  • does not add quotes around the field argument.
  • capitalizes the field argument.
mopidy.frontends.mpd.protocol.music_db.listall(context, uri=None)[source]
  • Pattern: listall$
  • Pattern: listall\ "(?P<uri>[^"]+)"$

musicpd.org, music database section:

listall [URI]

Lists all songs and directories in URI.

mopidy.frontends.mpd.protocol.music_db.listallinfo(context, uri=None)[source]
  • Pattern: listallinfo$
  • Pattern: listallinfo\ "(?P<uri>[^"]+)"$

musicpd.org, music database section:

listallinfo [URI]

Same as listall, except it also returns metadata info in the same format as lsinfo.

mopidy.frontends.mpd.protocol.music_db.lsinfo(context, uri=None)[source]
  • Pattern: lsinfo$
  • Pattern: lsinfo\ "(?P<uri>[^"]*)"$

musicpd.org, music database section:

lsinfo [URI]

Lists the contents of the directory URI.

When listing the root directory, this currently returns the list of stored playlists. This behavior is deprecated; use listplaylists instead.

MPD returns the same result, including both playlists and the files and directories located at the root level, for both lsinfo, lsinfo "", and lsinfo "/".

mopidy.frontends.mpd.protocol.music_db.rescan(context, uri=None)[source]
  • Pattern: rescan$
  • Pattern: rescan\ "(?P<uri>[^"]+)"$

musicpd.org, music database section:

rescan [URI]

Same as update, but also rescans unmodified files.

mopidy.frontends.mpd.protocol.music_db.search(context, mpd_query)[source]
  • Pattern: ``search (?P<mpd_query>

    (?: # Non-capturing group for repeating query pairs

    ”? # Optional quote around the field type (?:

    [Aa]lbum

    [Aa]lbumartist
    [Aa]ny
    [Aa]rtist
    [Cc]omment
    [Cc]omposer
    [Dd]ate
    [Ff]ile
    [Ff]ilename
    [Gg]enre
    [Pp]erformer
    [Tt]itle
    [Tt]rack

    ) ”? # End of optional quote around the field type # A single space “[^”]*” # Matching a quoted search string s?

    )+

``

musicpd.org, music database section:

search {TYPE} {WHAT} [...]

Searches for any song that contains WHAT. Parameters have the same meaning as for find, except that search is not case sensitive.

GMPC:

  • does not add quotes around the field argument.

  • uses the undocumented field any.

  • searches for multiple words like this:

    search any "foo" any "bar" any "baz"

ncmpc:

  • does not add quotes around the field argument.
  • capitalizes the field argument.

ncmpcpp:

  • also uses the search type “date”.
  • uses “file” instead of “filename”.
mopidy.frontends.mpd.protocol.music_db.searchadd(context, mpd_query)[source]
  • Pattern: ``searchadd (?P<mpd_query>

    (?: # Non-capturing group for repeating query pairs

    ”? # Optional quote around the field type (?:

    [Aa]lbum

    [Aa]lbumartist
    [Aa]ny
    [Aa]rtist
    [Cc]omment
    [Cc]omposer
    [Dd]ate
    [Ff]ile
    [Ff]ilename
    [Gg]enre
    [Pp]erformer
    [Tt]itle
    [Tt]rack

    ) ”? # End of optional quote around the field type # A single space “[^”]*” # Matching a quoted search string s?

    )+

``

musicpd.org, music database section:

searchadd {TYPE} {WHAT} [...]

Searches for any song that contains WHAT in tag TYPE and adds them to current playlist.

Parameters have the same meaning as for find, except that search is not case sensitive.

mopidy.frontends.mpd.protocol.music_db.searchaddpl(context, playlist_name, mpd_query)[source]
  • Pattern: ``searchaddpl”(?P<playlist_name>[^”]+)” (?P<mpd_query>

    (?: # Non-capturing group for repeating query pairs

    ”? # Optional quote around the field type (?:

    [Aa]lbum

    [Aa]lbumartist
    [Aa]ny
    [Aa]rtist
    [Cc]omment
    [Cc]omposer
    [Dd]ate
    [Ff]ile
    [Ff]ilename
    [Gg]enre
    [Pp]erformer
    [Tt]itle
    [Tt]rack

    ) ”? # End of optional quote around the field type # A single space “[^”]*” # Matching a quoted search string s?

    )+

``

musicpd.org, music database section:

searchaddpl {NAME} {TYPE} {WHAT} [...]

Searches for any song that contains WHAT in tag TYPE and adds them to the playlist named NAME.

If a playlist by that name doesn’t exist it is created.

Parameters have the same meaning as for find, except that search is not case sensitive.

mopidy.frontends.mpd.protocol.music_db.update(context, uri=None, rescan_unmodified_files=False)[source]
  • Pattern: update$
  • Pattern: update\ "(?P<uri>[^"]+)"$

musicpd.org, music database section:

update [URI]

Updates the music database: find new files, remove deleted files, update modified files.

URI is a particular directory or song/file to update. If you do not specify it, everything is updated.

Prints updating_db: JOBID where JOBID is a positive number identifying the update job. You can read the current job id in the status response.

Playback

mopidy.frontends.mpd.protocol.playback.consume(context, state)[source]
  • Pattern: consume\ ("?)(?P<state>[01])\1$

musicpd.org, playback section:

consume {STATE}

Sets consume state to STATE, STATE should be 0 or 1. When consume is activated, each song played is removed from playlist.

mopidy.frontends.mpd.protocol.playback.crossfade(context, seconds)[source]
  • Pattern: crossfade\ "(?P<seconds>\d+)"$

musicpd.org, playback section:

crossfade {SECONDS}

Sets crossfading between songs.

mopidy.frontends.mpd.protocol.playback.next_(context)[source]
  • Pattern: next$

musicpd.org, playback section:

next

Plays next song in the playlist.

MPD’s behaviour when affected by repeat/random/single/consume:

Given a playlist of three tracks numbered 1, 2, 3, and a currently playing track c. next_track is defined at the track that will be played upon calls to next.

Tests performed on MPD 0.15.4-1ubuntu3.

     
repeat random single consume c = 1 c = 2 c = 3 Notes
T T T T 2 3 EOPL  
T T T . Rand Rand Rand [1]
T T . T Rand Rand Rand [4]
T T . . Rand Rand Rand [4]
T . T T 2 3 EOPL  
T . T . 2 3 1  
T . . T 3 3 EOPL  
T . . . 2 3 1  
. T T T Rand Rand Rand [3]
. T T . Rand Rand Rand [3]
. T . T Rand Rand Rand [2]
. T . . Rand Rand Rand [2]
. . T T 2 3 EOPL  
. . T . 2 3 EOPL  
. . . T 2 3 EOPL  
. . . . 2 3 EOPL  
  • When end of playlist (EOPL) is reached, the current track is unset.
  • [1] When random and single is combined, next selects a track randomly at each invocation, and not just the next track in an internal prerandomized playlist.
  • [2] When random is active, next will skip through all tracks in the playlist in random order, and finally EOPL is reached.
  • [3] single has no effect in combination with random alone, or random and consume.
  • [4] When random and repeat is active, EOPL is never reached, but the playlist is played again, in the same random order as the first time.
mopidy.frontends.mpd.protocol.playback.pause(context, state=None)[source]
  • Pattern: pause$
  • Pattern: pause\ "(?P<state>[01])"$

musicpd.org, playback section:

pause {PAUSE}

Toggles pause/resumes playing, PAUSE is 0 or 1.

MPDroid:

  • Calls pause without any arguments to toogle pause.
mopidy.frontends.mpd.protocol.playback.play(context)[source]
  • Pattern: play$

The original MPD server resumes from the paused state on play without arguments.

mopidy.frontends.mpd.protocol.playback.playid(context, tlid)[source]
  • Pattern: playid\ ("?)(?P<tlid>-?\d+)\1$

musicpd.org, playback section:

playid [SONGID]

Begins playing the playlist at song SONGID.

Clarifications:

  • playid "-1" when playing is ignored.
  • playid "-1" when paused resumes playback.
  • playid "-1" when stopped with a current track starts playback at the current track.
  • playid "-1" when stopped without a current track, e.g. after playlist replacement, starts playback at the first track.
mopidy.frontends.mpd.protocol.playback.playpos(context, songpos)[source]
  • Pattern: play\ ("?)(?P<songpos>-?\d+)\1$

musicpd.org, playback section:

play [SONGPOS]

Begins playing the playlist at song number SONGPOS.

Clarifications:

  • play "-1" when playing is ignored.
  • play "-1" when paused resumes playback.
  • play "-1" when stopped with a current track starts playback at the current track.
  • play "-1" when stopped without a current track, e.g. after playlist replacement, starts playback at the first track.

BitMPC:

  • issues play 6 without quotes around the argument.
mopidy.frontends.mpd.protocol.playback.previous(context)[source]
  • Pattern: previous$

musicpd.org, playback section:

previous

Plays previous song in the playlist.

MPD’s behaviour when affected by repeat/random/single/consume:

Given a playlist of three tracks numbered 1, 2, 3, and a currently playing track c. previous_track is defined at the track that will be played upon previous calls.

Tests performed on MPD 0.15.4-1ubuntu3.

   
repeat random single consume c = 1 c = 2 c = 3
T T T T Rand? Rand? Rand?
T T T . 3 1 2
T T . T Rand? Rand? Rand?
T T . . 3 1 2
T . T T 3 1 2
T . T . 3 1 2
T . . T 3 1 2
T . . . 3 1 2
. T T T c c c
. T T . c c c
. T . T c c c
. T . . c c c
. . T T 1 1 2
. . T . 1 1 2
. . . T 1 1 2
. . . . 1 1 2
  • If time_position of the current track is 15s or more, previous should do a seek to time position 0.
mopidy.frontends.mpd.protocol.playback.random(context, state)[source]
  • Pattern: random\ ("?)(?P<state>[01])\1$

musicpd.org, playback section:

random {STATE}

Sets random state to STATE, STATE should be 0 or 1.

mopidy.frontends.mpd.protocol.playback.repeat(context, state)[source]
  • Pattern: repeat\ ("?)(?P<state>[01])\1$

musicpd.org, playback section:

repeat {STATE}

Sets repeat state to STATE, STATE should be 0 or 1.

mopidy.frontends.mpd.protocol.playback.replay_gain_mode(context, mode)[source]
  • Pattern: replay_gain_mode\ "(?P<mode>(off|track|album))"$

musicpd.org, playback section:

replay_gain_mode {MODE}

Sets the replay gain mode. One of off, track, album.

Changing the mode during playback may take several seconds, because the new settings does not affect the buffered data.

This command triggers the options idle event.

mopidy.frontends.mpd.protocol.playback.replay_gain_status(context)[source]
  • Pattern: replay_gain_status$

musicpd.org, playback section:

replay_gain_status

Prints replay gain options. Currently, only the variable replay_gain_mode is returned.

mopidy.frontends.mpd.protocol.playback.seek(context, songpos, seconds)[source]
  • Pattern: seek\ ("?)(?P<songpos>\d+)\1\ ("?)(?P<seconds>\d+)\3$

musicpd.org, playback section:

seek {SONGPOS} {TIME}

Seeks to the position TIME (in seconds) of entry SONGPOS in the playlist.

Droid MPD:

  • issues seek 1 120 without quotes around the arguments.
mopidy.frontends.mpd.protocol.playback.seekcur(context, position=None, diff=None)[source]
  • Pattern: seekcur\ "(?P<position>\d+)"$
  • Pattern: seekcur\ "(?P<diff>[-+]\d+)"$

musicpd.org, playback section:

seekcur {TIME}

Seeks to the position TIME within the current song. If prefixed by ‘+’ or ‘-‘, then the time is relative to the current playing position.

mopidy.frontends.mpd.protocol.playback.seekid(context, tlid, seconds)[source]
  • Pattern: seekid\ "(?P<tlid>\d+)"\ "(?P<seconds>\d+)"$

musicpd.org, playback section:

seekid {SONGID} {TIME}

Seeks to the position TIME (in seconds) of song SONGID.

mopidy.frontends.mpd.protocol.playback.setvol(context, volume)[source]
  • Pattern: setvol\ ("?)(?P<volume>[-+]*\d+)\1$

musicpd.org, playback section:

setvol {VOL}

Sets volume to VOL, the range of volume is 0-100.

Droid MPD:

  • issues setvol 50 without quotes around the argument.
mopidy.frontends.mpd.protocol.playback.single(context, state)[source]
  • Pattern: single\ ("?)(?P<state>[01])\1$

musicpd.org, playback section:

single {STATE}

Sets single state to STATE, STATE should be 0 or 1. When single is activated, playback is stopped after current song, or song is repeated if the repeat mode is enabled.

mopidy.frontends.mpd.protocol.playback.stop(context)[source]
  • Pattern: stop$

musicpd.org, playback section:

stop

Stops playing.

Reflection

mopidy.frontends.mpd.protocol.reflection.commands(context)[source]
  • Pattern: commands$

musicpd.org, reflection section:

commands

Shows which commands the current user has access to.

mopidy.frontends.mpd.protocol.reflection.config(context)[source]
  • Pattern: config$

musicpd.org, reflection section:

config

Dumps configuration values that may be interesting for the client. This command is only permitted to “local” clients (connected via UNIX domain socket).

mopidy.frontends.mpd.protocol.reflection.decoders(context)[source]
  • Pattern: decoders$

musicpd.org, reflection section:

decoders

Print a list of decoder plugins, followed by their supported suffixes and MIME types. Example response:

plugin: mad
suffix: mp3
suffix: mp2
mime_type: audio/mpeg
plugin: mpcdec
suffix: mpc

Clarifications:

  • ncmpcpp asks for decoders the first time you open the browse view. By returning nothing and OK instead of an not implemented error, we avoid “Not implemented” showing up in the ncmpcpp interface, and we get the list of playlists without having to enter the browse interface twice.
mopidy.frontends.mpd.protocol.reflection.notcommands(context)[source]
  • Pattern: notcommands$

musicpd.org, reflection section:

notcommands

Shows which commands the current user does not have access to.

mopidy.frontends.mpd.protocol.reflection.tagtypes(context)[source]
  • Pattern: tagtypes$

musicpd.org, reflection section:

tagtypes

Shows a list of available song metadata.

mopidy.frontends.mpd.protocol.reflection.urlhandlers(context)[source]
  • Pattern: urlhandlers$

musicpd.org, reflection section:

urlhandlers

Gets a list of available URL handlers.

Status

mopidy.frontends.mpd.protocol.status.SUBSYSTEMS = [u'database', u'mixer', u'options', u'output', u'player', u'playlist', u'stored_playlist', u'update']

Subsystems that can be registered with idle command.

mopidy.frontends.mpd.protocol.status.clearerror(context)[source]
  • Pattern: clearerror$

musicpd.org, status section:

clearerror

Clears the current error message in status (this is also accomplished by any command that starts playback).

mopidy.frontends.mpd.protocol.status.currentsong(context)[source]
  • Pattern: currentsong$

musicpd.org, status section:

currentsong

Displays the song info of the current song (same song that is identified in status).

mopidy.frontends.mpd.protocol.status.idle(context, subsystems=None)[source]
  • Pattern: idle$
  • Pattern: idle\ (?P<subsystems>.+)$

musicpd.org, status section:

idle [SUBSYSTEMS...]

Waits until there is a noteworthy change in one or more of MPD’s subsystems. As soon as there is one, it lists all changed systems in a line in the format changed: SUBSYSTEM, where SUBSYSTEM is one of the following:

  • database: the song database has been modified after update.
  • update: a database update has started or finished. If the database was modified during the update, the database event is also emitted.
  • stored_playlist: a stored playlist has been modified, renamed, created or deleted
  • playlist: the current playlist has been modified
  • player: the player has been started, stopped or seeked
  • mixer: the volume has been changed
  • output: an audio output has been enabled or disabled
  • options: options like repeat, random, crossfade, replay gain

While a client is waiting for idle results, the server disables timeouts, allowing a client to wait for events as long as MPD runs. The idle command can be canceled by sending the command noidle (no other commands are allowed). MPD will then leave idle mode and print results immediately; might be empty at this time.

If the optional SUBSYSTEMS argument is used, MPD will only send notifications when something changed in one of the specified subsystems.

mopidy.frontends.mpd.protocol.status.noidle(context)[source]
  • Pattern: noidle$

See _status_idle().

mopidy.frontends.mpd.protocol.status.stats(context)[source]
  • Pattern: stats$

musicpd.org, status section:

stats

Displays statistics.

  • artists: number of artists
  • songs: number of albums
  • uptime: daemon uptime in seconds
  • db_playtime: sum of all song times in the db
  • db_update: last db update in UNIX time
  • playtime: time length of music played
mopidy.frontends.mpd.protocol.status.status(context)[source]
  • Pattern: status$

musicpd.org, status section:

status

Reports the current status of the player and the volume level.

  • volume: 0-100 or -1
  • repeat: 0 or 1
  • single: 0 or 1
  • consume: 0 or 1
  • playlist: 31-bit unsigned integer, the playlist version number
  • playlistlength: integer, the length of the playlist
  • state: play, stop, or pause
  • song: playlist song number of the current song stopped on or playing
  • songid: playlist songid of the current song stopped on or playing
  • nextsong: playlist song number of the next song to be played
  • nextsongid: playlist songid of the next song to be played
  • time: total time elapsed (of current playing/paused song)
  • elapsed: Total time elapsed within the current song, but with higher resolution.
  • bitrate: instantaneous bitrate in kbps
  • xfade: crossfade in seconds
  • audio: sampleRate``:bits``:channels
  • updatings_db: job id
  • error: if there is an error, returns message here
Clarifications based on experience implementing
  • volume: can also be -1 if no output is set.
  • elapsed: Higher resolution means time in seconds with three decimal places for millisecond precision.

Stickers

mopidy.frontends.mpd.protocol.stickers.sticker_delete(context, field, uri, name=None)[source]
  • Pattern: sticker\ delete\ "(?P<field>[^"]+)"\ "(?P<uri>[^"]+)"(\ "(?P<name>[^"]+)")*$

musicpd.org, sticker section:

sticker delete {TYPE} {URI} [NAME]

Deletes a sticker value from the specified object. If you do not specify a sticker name, all sticker values are deleted.

mopidy.frontends.mpd.protocol.stickers.sticker_find(context, field, uri, name)[source]
  • Pattern: sticker\ find\ "(?P<field>[^"]+)"\ "(?P<uri>[^"]+)"\ "(?P<name>[^"]+)"$

musicpd.org, sticker section:

sticker find {TYPE} {URI} {NAME}

Searches the sticker database for stickers with the specified name, below the specified directory (URI). For each matching song, it prints the URI and that one sticker’s value.

mopidy.frontends.mpd.protocol.stickers.sticker_get(context, field, uri, name)[source]
  • Pattern: sticker\ get\ "(?P<field>[^"]+)"\ "(?P<uri>[^"]+)"\ "(?P<name>[^"]+)"$

musicpd.org, sticker section:

sticker get {TYPE} {URI} {NAME}

Reads a sticker value for the specified object.

mopidy.frontends.mpd.protocol.stickers.sticker_list(context, field, uri)[source]
  • Pattern: sticker\ list\ "(?P<field>[^"]+)"\ "(?P<uri>[^"]+)"$

musicpd.org, sticker section:

sticker list {TYPE} {URI}

Lists the stickers for the specified object.

mopidy.frontends.mpd.protocol.stickers.sticker_set(context, field, uri, name, value)[source]
  • Pattern: sticker\ set\ "(?P<field>[^"]+)"\ "(?P<uri>[^"]+)"\ "(?P<name>[^"]+)"\ "(?P<value>[^"]+)"$

musicpd.org, sticker section:

sticker set {TYPE} {URI} {NAME} {VALUE}

Adds a sticker value to the specified object. If a sticker item with that name already exists, it is replaced.

Stored playlists

mopidy.frontends.mpd.protocol.stored_playlists.listplaylist(context, name)[source]
  • Pattern: listplaylist\ ("?)(?P<name>[^"]+)\1$

musicpd.org, stored playlists section:

listplaylist {NAME}

Lists the files in the playlist NAME.m3u.

Output format:

file: relative/path/to/file1.flac
file: relative/path/to/file2.ogg
file: relative/path/to/file3.mp3
mopidy.frontends.mpd.protocol.stored_playlists.listplaylistinfo(context, name)[source]
  • Pattern: listplaylistinfo\ ("?)(?P<name>[^"]+)\1$

musicpd.org, stored playlists section:

listplaylistinfo {NAME}

Lists songs in the playlist NAME.m3u.

Output format:

Standard track listing, with fields: file, Time, Title, Date, Album, Artist, Track
mopidy.frontends.mpd.protocol.stored_playlists.listplaylists(context)[source]
  • Pattern: listplaylists$

musicpd.org, stored playlists section:

listplaylists

Prints a list of the playlist directory.

After each playlist name the server sends its last modification time as attribute Last-Modified in ISO 8601 format. To avoid problems due to clock differences between clients and the server, clients should not compare this value with their local clock.

Output format:

playlist: a
Last-Modified: 2010-02-06T02:10:25Z
playlist: b
Last-Modified: 2010-02-06T02:11:08Z

Clarifications:

  • ncmpcpp 0.5.10 segfaults if we return ‘playlist: ‘ on a line, so we must ignore playlists without names, which isn’t very useful anyway.
mopidy.frontends.mpd.protocol.stored_playlists.load(context, name, start=None, end=None)[source]
  • Pattern: load\ "(?P<name>[^"]+)"(\ "(?P<start>\d+):(?P<end>\d+)*")*$

musicpd.org, stored playlists section:

load {NAME} [START:END]

Loads the playlist into the current queue. Playlist plugins are supported. A range may be specified to load only a part of the playlist.

Clarifications:

  • load appends the given playlist to the current playlist.
  • MPD 0.17.1 does not support open-ended ranges, i.e. without end specified, for the load command, even though MPD’s general range docs allows open-ended ranges.
  • MPD 0.17.1 does not fail if the specified range is outside the playlist, in either or both ends.
mopidy.frontends.mpd.protocol.stored_playlists.playlistadd(context, name, uri)[source]
  • Pattern: playlistadd\ "(?P<name>[^"]+)"\ "(?P<uri>[^"]+)"$

musicpd.org, stored playlists section:

playlistadd {NAME} {URI}

Adds URI to the playlist NAME.m3u.

NAME.m3u will be created if it does not exist.

mopidy.frontends.mpd.protocol.stored_playlists.playlistclear(context, name)[source]
  • Pattern: playlistclear\ "(?P<name>[^"]+)"$

musicpd.org, stored playlists section:

playlistclear {NAME}

Clears the playlist NAME.m3u.

mopidy.frontends.mpd.protocol.stored_playlists.playlistdelete(context, name, songpos)[source]
  • Pattern: playlistdelete\ "(?P<name>[^"]+)"\ "(?P<songpos>\d+)"$

musicpd.org, stored playlists section:

playlistdelete {NAME} {SONGPOS}

Deletes SONGPOS from the playlist NAME.m3u.

mopidy.frontends.mpd.protocol.stored_playlists.playlistmove(context, name, from_pos, to_pos)[source]
  • Pattern: playlistmove\ "(?P<name>[^"]+)"\ "(?P<from_pos>\d+)"\ "(?P<to_pos>\d+)"$

musicpd.org, stored playlists section:

playlistmove {NAME} {SONGID} {SONGPOS}

Moves SONGID in the playlist NAME.m3u to the position SONGPOS.

Clarifications:

  • The second argument is not a SONGID as used elsewhere in the protocol documentation, but just the SONGPOS to move from, i.e. playlistmove {NAME} {FROM_SONGPOS} {TO_SONGPOS}.
mopidy.frontends.mpd.protocol.stored_playlists.rename(context, old_name, new_name)[source]
  • Pattern: rename\ "(?P<old_name>[^"]+)"\ "(?P<new_name>[^"]+)"$

musicpd.org, stored playlists section:

rename {NAME} {NEW_NAME}

Renames the playlist NAME.m3u to NEW_NAME.m3u.

mopidy.frontends.mpd.protocol.stored_playlists.rm(context, name)[source]
  • Pattern: rm\ "(?P<name>[^"]+)"$

musicpd.org, stored playlists section:

rm {NAME}

Removes the playlist NAME.m3u from the playlist directory.

mopidy.frontends.mpd.protocol.stored_playlists.save(context, name)[source]
  • Pattern: save\ "(?P<name>[^"]+)"$

musicpd.org, stored playlists section:

save {NAME}

Saves the current playlist to NAME.m3u in the playlist directory.