You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			1945 lines
		
	
	
		
			61 KiB
		
	
	
	
		
			ReStructuredText
		
	
			
		
		
	
	
			1945 lines
		
	
	
		
			61 KiB
		
	
	
	
		
			ReStructuredText
		
	
########
 | 
						|
Protocol
 | 
						|
########
 | 
						|
 | 
						|
General protocol syntax
 | 
						|
***********************
 | 
						|
 | 
						|
Protocol overview
 | 
						|
=================
 | 
						|
 | 
						|
The :program:`MPD` command protocol exchanges
 | 
						|
line-based text records between client and server over TCP.
 | 
						|
Once the client is connected to the server, they conduct a
 | 
						|
conversation until the client closes the connection. The
 | 
						|
conversation flow is always initiated by the client.
 | 
						|
 | 
						|
All data between the client and the server is encoded in
 | 
						|
UTF-8.
 | 
						|
 | 
						|
The client transmits a command sequence, terminated by the
 | 
						|
newline character ``\n``.  The server will
 | 
						|
respond with one or more lines, the last of which will be a
 | 
						|
completion code.
 | 
						|
 | 
						|
When the client connects to the server, the server will answer
 | 
						|
with the following line::
 | 
						|
 | 
						|
 OK MPD version
 | 
						|
 | 
						|
where ``version`` is a version identifier such as
 | 
						|
0.12.2.  This version identifier is the version of the protocol
 | 
						|
spoken, not the real version of the daemon.  (There is no way to
 | 
						|
retrieve this real version identifier from the connection.)
 | 
						|
 | 
						|
Requests
 | 
						|
========
 | 
						|
 | 
						|
.. code-block:: none
 | 
						|
 | 
						|
 COMMAND [ARG...]
 | 
						|
 | 
						|
If arguments contain spaces, they should be surrounded by double
 | 
						|
quotation marks.
 | 
						|
 | 
						|
Argument strings are separated from the command and any other
 | 
						|
arguments by linear white-space (' ' or '\\t').
 | 
						|
 | 
						|
Responses
 | 
						|
=========
 | 
						|
 | 
						|
A command returns ``OK`` on completion or
 | 
						|
``ACK some error`` on failure.  These
 | 
						|
denote the end of command execution.
 | 
						|
 | 
						|
Some commands return more data before the response ends with ``OK``.
 | 
						|
Each line is usually in the form ``NAME: VALUE``.  Example::
 | 
						|
 | 
						|
  foo: bar
 | 
						|
  OK
 | 
						|
 | 
						|
.. _binary:
 | 
						|
 | 
						|
Binary Responses
 | 
						|
----------------
 | 
						|
 | 
						|
Some commands can return binary data.  This is initiated by a line
 | 
						|
containing ``binary: 1234`` (followed as usual by a newline).  After
 | 
						|
that, the specified number of bytes of binary data follows, then a
 | 
						|
newline, and finally the ``OK`` line.
 | 
						|
 | 
						|
If the object to be transmitted is large, the server may choose a
 | 
						|
reasonable chunk size and transmit only a portion.  The maximum chunk
 | 
						|
size can be changed by clients with the :ref:`binarylimit
 | 
						|
<command_binarylimit>` command.
 | 
						|
 | 
						|
Usually, the response also contains a ``size`` line which specifies
 | 
						|
the total (uncropped) size, and the command usually has a way to
 | 
						|
specify an offset into the object; this way, the client can copy the
 | 
						|
whole file without blocking the connection for too long.
 | 
						|
 | 
						|
Example::
 | 
						|
 | 
						|
  foo: bar
 | 
						|
  binary: 42
 | 
						|
  <42 bytes>
 | 
						|
  OK
 | 
						|
 | 
						|
 | 
						|
Failure responses
 | 
						|
-----------------
 | 
						|
 | 
						|
The nature of the error can be gleaned from the information
 | 
						|
that follows the ``ACK``.
 | 
						|
``ACK`` lines are of the form:
 | 
						|
 | 
						|
.. code-block:: none
 | 
						|
 | 
						|
 ACK [error@command_listNum] {current_command} message_text
 | 
						|
 | 
						|
These responses are generated by a call to
 | 
						|
``commandError``. They contain four separate
 | 
						|
terms. Let's look at each of them:
 | 
						|
 | 
						|
- ``error``: numeric value of one
 | 
						|
  of the ``ACK_ERROR`` constants defined
 | 
						|
  in `src/protocol/Ack.hxx`.
 | 
						|
 | 
						|
- ``command_listNum``: offset of the command that caused the error in
 | 
						|
  a :ref:`Command List <command_lists>`.  An error will always cause a
 | 
						|
  command list to terminate at the command that causes the error.
 | 
						|
 | 
						|
- ``current_command``: name of the command, in a :ref:`Command List
 | 
						|
  <command_lists>`, that was executing when the error occurred.
 | 
						|
 | 
						|
- ``message_text``:
 | 
						|
  some (hopefully) informative text that describes the
 | 
						|
  nature of the error.
 | 
						|
 | 
						|
An example might help.  Consider the following sequence
 | 
						|
sent from the client to the server::
 | 
						|
 | 
						|
 command_list_begin
 | 
						|
 volume 86
 | 
						|
 play 10240
 | 
						|
 status
 | 
						|
 command_list_end
 | 
						|
 | 
						|
The server responds with::
 | 
						|
 | 
						|
 ACK [2@1] {play} Bad song index
 | 
						|
 | 
						|
This tells us that the play command, which was the second in the list
 | 
						|
(the first or only command is numbered 0), failed with error 2.  The
 | 
						|
number 2 translates to ``ACK_ERROR_ARG`` -- the argument is invalid
 | 
						|
since such song position does not exist.  This is reiterated by the
 | 
						|
message text which also tells us that the song index is incorrect.
 | 
						|
 | 
						|
.. _command_lists:
 | 
						|
 | 
						|
Command lists
 | 
						|
=============
 | 
						|
 | 
						|
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
 | 
						|
response is a concatentation of all individual responses.
 | 
						|
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.
 | 
						|
 | 
						|
Only synchronous commands can be used in command lists.  Commands that
 | 
						|
suspend execution (``idle`` and ``noidle``) are not allowed.
 | 
						|
 | 
						|
Ranges
 | 
						|
======
 | 
						|
 | 
						|
Some commands (e.g. :ref:`delete <command_delete>`) allow specifying a
 | 
						|
range in the form ``START:END`` (the ``END`` item is not included in
 | 
						|
the range, similar to ranges in the Python programming language).  If
 | 
						|
``END`` is omitted, then the maximum possible value is assumed.
 | 
						|
 | 
						|
.. _filter_syntax:
 | 
						|
 | 
						|
Filters
 | 
						|
=======
 | 
						|
 | 
						|
All commands which search for songs (e.g. :ref:`find <command_find>`
 | 
						|
and :ref:`searchadd <command_searchadd>`) share a common filter
 | 
						|
syntax::
 | 
						|
 | 
						|
 find EXPRESSION
 | 
						|
 | 
						|
``EXPRESSION`` is a string enclosed in parentheses which can be one
 | 
						|
of:
 | 
						|
 | 
						|
- ``(TAG == 'VALUE')``: match a tag value; if there are multiple
 | 
						|
  values of the given type, at least one must match.
 | 
						|
  ``(TAG != 'VALUE')``: mismatch a tag value; if there are multiple
 | 
						|
  values of the given type, none of them must match.
 | 
						|
  The special tag ``any`` checks all
 | 
						|
  tag types.
 | 
						|
  ``AlbumArtist`` looks for
 | 
						|
  ``VALUE`` in ``AlbumArtist``
 | 
						|
  and falls back to ``Artist`` tags if
 | 
						|
  ``AlbumArtist`` does not exist.
 | 
						|
  ``VALUE`` is what to find.
 | 
						|
  An empty value string means: match only if the given tag type does
 | 
						|
  not exist at all; this implies that negation with an empty value
 | 
						|
  checks for the existence of the given tag type.
 | 
						|
 | 
						|
- ``(TAG contains 'VALUE')`` checks if the given value is a substring
 | 
						|
  of the tag value.
 | 
						|
 | 
						|
- ``(TAG starts_with 'VALUE')`` checks if the tag value starts with the given value.
 | 
						|
 | 
						|
- ``(TAG =~ 'VALUE')`` and ``(TAG !~ 'VALUE')`` use a Perl-compatible
 | 
						|
  regular expression instead of doing a simple string comparison.
 | 
						|
  (This feature is only available if :program:`MPD` was compiled with
 | 
						|
  :file:`libpcre`)
 | 
						|
 | 
						|
- ``(file == 'VALUE')``: match the full song URI
 | 
						|
  (relative to the music directory).
 | 
						|
 | 
						|
- ``(base 'VALUE')``: restrict the search to
 | 
						|
  songs in the given directory (relative to the music
 | 
						|
  directory).
 | 
						|
 | 
						|
- ``(modified-since 'VALUE')``: compares the
 | 
						|
  file's time stamp with the given value (ISO 8601 or UNIX
 | 
						|
  time stamp).
 | 
						|
 | 
						|
- ``(added-since 'VALUE')``: compares time stamp when the file was added with
 | 
						|
  the given value (ISO 8601 or UNIX time stamp).
 | 
						|
 | 
						|
- ``(AudioFormat == 'SAMPLERATE:BITS:CHANNELS')``: compares the audio
 | 
						|
  format with the given value.  See :ref:`audio_output_format` for a
 | 
						|
  detailed explanation.
 | 
						|
 | 
						|
- ``(AudioFormat =~ 'SAMPLERATE:BITS:CHANNELS')``:
 | 
						|
  matches the audio format with the given mask (i.e. one
 | 
						|
  or more attributes may be ``*``).
 | 
						|
 | 
						|
- ``(prio >= 42)``:
 | 
						|
  compares the priority of queued songs.
 | 
						|
 | 
						|
- ``(!EXPRESSION)``: negate an expression.  Note that each expression
 | 
						|
  must be enclosed in parentheses, e.g. :code:`(!(artist == 'VALUE'))`
 | 
						|
  (which is equivalent to :code:`(artist != 'VALUE')`)
 | 
						|
 | 
						|
- ``(EXPRESSION1 AND EXPRESSION2 ...)``: combine two or
 | 
						|
  more expressions with logical "and".  Note that each expression must
 | 
						|
  be enclosed in parentheses, e.g. :code:`((artist == 'FOO') AND
 | 
						|
  (album == 'BAR'))`
 | 
						|
 | 
						|
The :command:`find` commands are case sensitive, while
 | 
						|
:command:`search` and related commands ignore case.  The latter also
 | 
						|
applies `Unicode normalization <https://unicode.org/reports/tr15/>`__
 | 
						|
and converts all punctuation to ASCII equivalents
 | 
						|
if MPD was compiled with `ICU <https://icu.unicode.org/>`__ support.
 | 
						|
 | 
						|
Explicit case-sensitivity [#since_0_24]_
 | 
						|
----------------------------------------
 | 
						|
 | 
						|
.. note:: The following variants of filter operators override the default case sensitivity
 | 
						|
   that is command dependant with explicit case sensitivity.
 | 
						|
 | 
						|
.. list-table:: Explicitly case-sensitive operators
 | 
						|
   :widths: 33 33 33
 | 
						|
 | 
						|
   * - Explicitly case-sensitive
 | 
						|
     - Explicitly case-insensitive
 | 
						|
     - Equivalent command dependant
 | 
						|
 | 
						|
   * - ``eq_cs``
 | 
						|
     - ``eq_ci``
 | 
						|
     - ``==``
 | 
						|
 | 
						|
   * - ``!eq_cs``
 | 
						|
     - ``!eq_ci``
 | 
						|
     - ``!=``
 | 
						|
 | 
						|
   * - ``contains_cs``
 | 
						|
     - ``contains_ci``
 | 
						|
     - ``contains``
 | 
						|
 | 
						|
   * - ``!contains_cs``
 | 
						|
     - ``!contains_ci``
 | 
						|
     - ``!contains``
 | 
						|
 | 
						|
   * - ``starts_with_cs``
 | 
						|
     - ``starts_with_ci``
 | 
						|
     - ``starts_with``
 | 
						|
 | 
						|
   * - ``!starts_with_cs``
 | 
						|
     - ``!starts_with_ci``
 | 
						|
     - ``!starts_with``
 | 
						|
 | 
						|
Prior to MPD 0.21, the syntax looked like this::
 | 
						|
 | 
						|
 find TYPE VALUE
 | 
						|
 | 
						|
Escaping String Values
 | 
						|
----------------------
 | 
						|
 | 
						|
String values are quoted with single or double quotes, and special
 | 
						|
characters within those values must be escaped with the backslash
 | 
						|
(``\``).  Keep in mind that the backslash is also the escape character
 | 
						|
on the protocol level, which means you may need to use double
 | 
						|
backslash.
 | 
						|
 | 
						|
Example expression which matches an artist named ``foo'bar"``::
 | 
						|
 | 
						|
 (Artist == "foo\'bar\"")
 | 
						|
 | 
						|
At the protocol level, the command must look like this::
 | 
						|
 | 
						|
 find "(Artist == \"foo\\'bar\\\"\")"
 | 
						|
 | 
						|
The double quotes enclosing the artist name must be escaped because
 | 
						|
they are inside a double-quoted ``find`` parameter.  The single quote
 | 
						|
inside that artist name must be escaped with two backslashes; one to
 | 
						|
escape the single quote, and another one because the backslash inside
 | 
						|
the string inside the parameter needs to be escaped as well.  The
 | 
						|
double quote has three confusing backslashes: two to build one
 | 
						|
backslash, and another one to escape the double quote on the protocol
 | 
						|
level.  Phew!
 | 
						|
 | 
						|
To reduce confusion, you should use a library such as `libmpdclient
 | 
						|
<https://www.musicpd.org/libs/libmpdclient/>`_ which escapes command
 | 
						|
arguments for you.
 | 
						|
 | 
						|
.. _tags:
 | 
						|
 | 
						|
Tags
 | 
						|
====
 | 
						|
 | 
						|
The following tags are supported by :program:`MPD`:
 | 
						|
 | 
						|
* **artist**: the artist name. Its meaning is not well-defined; see "*composer*" and "*performer*" for more specific tags.
 | 
						|
* **artistsort**: same as artist, but for sorting. This usually omits prefixes such as "The".
 | 
						|
* **album**: the album name.
 | 
						|
* **albumsort**: same as album, but for sorting.
 | 
						|
* **albumartist**: on multi-artist albums, this is the artist name which shall be used for the whole album. The exact meaning of this tag is not well-defined.
 | 
						|
* **albumartistsort**: same as albumartist, but for sorting.
 | 
						|
* **title**: the song title.
 | 
						|
* **titlesort**:  same as title, but for sorting.
 | 
						|
* **track**: the decimal track number within the album.
 | 
						|
* **name**: a name for this song. This is not the song title. The exact meaning of this tag is not well-defined. It is often used by badly configured internet radio stations with broken tags to squeeze both the artist name and the song title in one tag.
 | 
						|
* **genre**: the music genre.
 | 
						|
* **mood**: the mood of the audio with a few keywords.
 | 
						|
* **date**: the song's release date. This is usually a 4-digit year.
 | 
						|
* **originaldate**: the song's original release date.
 | 
						|
* **composer**: the artist who composed the song.
 | 
						|
* **composersort**: same as composer, but for sorting.
 | 
						|
* **performer**: the artist who performed the song.
 | 
						|
* **conductor**: the conductor who conducted the song.
 | 
						|
* **work**: `"a work is a distinct intellectual or artistic creation,
 | 
						|
  which can be expressed in the form of one or more audio recordings" <https://musicbrainz.org/doc/Work>`_
 | 
						|
* **ensemble**: the ensemble performing this song, e.g. "Wiener Philharmoniker".
 | 
						|
* **movement**: name of the movement, e.g. "Andante con moto".
 | 
						|
* **movementnumber**: movement number, e.g. "2" or "II".
 | 
						|
* **showmovement**: If this tag is set to "1" players supporting this tag will display the `work`, `movement`, and `movementnumber`` instead of the track title.
 | 
						|
* **location**: location of the recording, e.g. "Royal Albert Hall".
 | 
						|
* **grouping**: "used if the sound belongs to a larger category of
 | 
						|
  sounds/music" (`from the IDv2.4.0 TIT1 description
 | 
						|
  <http://id3.org/id3v2.4.0-frames>`_).
 | 
						|
* **comment**: a human-readable comment about this song. The exact meaning of this tag is not well-defined.
 | 
						|
* **disc**: the decimal disc number in a multi-disc album.
 | 
						|
* **label**: the name of the label or publisher.
 | 
						|
* **musicbrainz_artistid**: the artist id in the `MusicBrainz <https://picard.musicbrainz.org/docs/mappings/>`_ database.
 | 
						|
* **musicbrainz_albumid**: the album id in the `MusicBrainz <https://picard.musicbrainz.org/docs/mappings/>`_ database.
 | 
						|
* **musicbrainz_albumartistid**: the album artist id in the `MusicBrainz <https://picard.musicbrainz.org/docs/mappings/>`_ database.
 | 
						|
* **musicbrainz_trackid**: the track id in the `MusicBrainz <https://picard.musicbrainz.org/docs/mappings/>`_ database.
 | 
						|
* **musicbrainz_releasegroupid**: the release group id in the `MusicBrainz <https://picard.musicbrainz.org/docs/mappings/>`_ database.
 | 
						|
* **musicbrainz_releasetrackid**: the release track id in the `MusicBrainz <https://picard.musicbrainz.org/docs/mappings/>`_ database.
 | 
						|
* **musicbrainz_workid**: the work id in the `MusicBrainz <https://picard.musicbrainz.org/docs/mappings/>`_ database.
 | 
						|
 | 
						|
There can be multiple values for some of these tags.  For
 | 
						|
example, :program:`MPD` may return multiple
 | 
						|
lines with a ``performer`` tag.  A tag value is
 | 
						|
a UTF-8 string.
 | 
						|
 | 
						|
.. _other_metadata:
 | 
						|
 | 
						|
Other Metadata
 | 
						|
==============
 | 
						|
 | 
						|
The response to :ref:`lsinfo <command_lsinfo>` and similar commands
 | 
						|
may contain :ref:`song tags <tags>` and other metadata, specifically:
 | 
						|
 | 
						|
- ``duration``: the duration of the song in
 | 
						|
  seconds; may contain a fractional part.
 | 
						|
 | 
						|
- ``Time``: like ``duration``,
 | 
						|
  but as integer value.  This is deprecated and is only here
 | 
						|
  for compatibility with older clients.  Do not use.
 | 
						|
 | 
						|
- ``Range``: if this is a queue item referring only to a portion of
 | 
						|
  the song file, then this attribute contains the time range in the
 | 
						|
  form ``START-END`` or ``START-`` (open ended); both ``START`` and
 | 
						|
  ``END`` are time stamps within the song in seconds (may contain a
 | 
						|
  fractional part).  Example: ``60-120`` plays only the second minute;
 | 
						|
  "``180`` skips the first three minutes.
 | 
						|
 | 
						|
- ``Format``: the audio format of the song
 | 
						|
  (or an approximation to a format supported by MPD and the
 | 
						|
  decoder plugin being used).  When playing this file, the
 | 
						|
  ``audio`` value in the :ref:`status <command_status>`
 | 
						|
  response should be the same.
 | 
						|
 | 
						|
- ``Last-Modified``: the time stamp of the
 | 
						|
  last modification of the underlying file in ISO 8601
 | 
						|
  format.  Example:
 | 
						|
  "*2008-09-28T20:04:57Z*"
 | 
						|
 | 
						|
- ``added`` [#since_0_24]_: the time stamp when the file was added in ISO 8601.
 | 
						|
  A negative value means that this is unknown/unavailable.
 | 
						|
  Example: "*2023-11-25T13:25:07Z*"
 | 
						|
 | 
						|
Recipes
 | 
						|
*******
 | 
						|
 | 
						|
Queuing
 | 
						|
=======
 | 
						|
 | 
						|
Often, users run :program:`MPD` with :ref:`random <command_random>`
 | 
						|
enabled, but want to be able to insert songs "before" the rest of the
 | 
						|
playlist.  That is commonly called "queuing".
 | 
						|
 | 
						|
:program:`MPD` implements this by allowing the client to specify a
 | 
						|
"priority" for each song in the playlist (commands :ref:`priod
 | 
						|
<command_prio>` and :ref:`priodid <command_prioid>`).  A higher
 | 
						|
priority means that the song is going to be played before the other
 | 
						|
songs.
 | 
						|
 | 
						|
In "random" mode, :program:`MPD` maintains an
 | 
						|
internal randomized sequence of songs.  In this sequence,
 | 
						|
songs with a higher priority come first, and all songs with
 | 
						|
the same priority are shuffled (by default, all songs are
 | 
						|
shuffled, because all have the same priority "0").  When you
 | 
						|
increase the priority of a song, it is moved to the front of
 | 
						|
the sequence according to its new priority, but always after
 | 
						|
the current one.  A song that has been played already (it's
 | 
						|
"before" the current song in that sequence) will only be
 | 
						|
scheduled for repeated playback if its priority has become
 | 
						|
bigger than the priority of the current song.  Decreasing the
 | 
						|
priority of a song will move it farther to the end of the
 | 
						|
sequence.  Changing the priority of the current song has no
 | 
						|
effect on the sequence.  During playback, a song's priority is
 | 
						|
reset to zero.
 | 
						|
 | 
						|
Command reference
 | 
						|
*****************
 | 
						|
 | 
						|
.. note:: For manipulating playlists and playing, there are two sets of
 | 
						|
   commands.  One set uses the song id of a song in the playlist,
 | 
						|
   while another set uses the playlist position of the song. The
 | 
						|
   commands using song ids should be used instead of the commands
 | 
						|
   that manipulate and control playback based on playlist
 | 
						|
   position. Using song ids is a safer method when multiple
 | 
						|
   clients are interacting with :program:`MPD`.
 | 
						|
 | 
						|
Querying :program:`MPD`'s status
 | 
						|
================================
 | 
						|
 | 
						|
.. _command_clearerror:
 | 
						|
 | 
						|
:command:`clearerror`
 | 
						|
    Clears the current error message in status (this is also
 | 
						|
    accomplished by any command that starts playback).
 | 
						|
 | 
						|
.. _command_currentsong:
 | 
						|
 | 
						|
:command:`currentsong`
 | 
						|
    Displays the song info of the current song (same song that
 | 
						|
    is identified in status). Information about the current song
 | 
						|
    is represented by key-value pairs, one on each line. The first
 | 
						|
    pair must be the `file` key-value pair.
 | 
						|
 | 
						|
.. _command_idle:
 | 
						|
 | 
						|
:command:`idle [SUBSYSTEMS...]` [#since_0_14]_
 | 
						|
    Waits until there is a noteworthy change in one or more
 | 
						|
    of :program:`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 :ref:`update <command_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 queue (i.e. the current playlist) has been modified
 | 
						|
    - ``player``: the player has been started, stopped or seeked or
 | 
						|
      tags of the currently playing song have changed (e.g. received
 | 
						|
      from stream)
 | 
						|
    - ``mixer``: the volume has been changed
 | 
						|
    - ``output``: an audio output has been added, removed or modified (e.g. renamed, enabled or disabled)
 | 
						|
    - ``options``: options like repeat, random, crossfade, replay gain
 | 
						|
    - ``partition``: a partition was added, removed or changed
 | 
						|
    - ``sticker``: the sticker database has been modified.
 | 
						|
    - ``subscription``: a client has subscribed or unsubscribed to a channel
 | 
						|
    - ``message``: a message was received on a channel this client is subscribed to;
 | 
						|
      this event is only emitted when the client's message queue is empty
 | 
						|
    - ``neighbor``: a neighbor was found or lost
 | 
						|
    - ``mount``: the mount list has changed
 | 
						|
 | 
						|
    Change events accumulate, even while the connection is not in
 | 
						|
    "idle" mode; no events get lost while the client is doing
 | 
						|
    something else with the connection.  If an event had already
 | 
						|
    occurred since the last call, the new :ref:`idle <command_idle>`
 | 
						|
    command will return immediately.
 | 
						|
 | 
						|
    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). :program:`MPD`
 | 
						|
    will then leave `idle` mode and print
 | 
						|
    results immediately; might be empty at this time.
 | 
						|
    If the optional ``SUBSYSTEMS`` argument
 | 
						|
    is used, :program:`MPD` will only send
 | 
						|
    notifications when something changed in one of the
 | 
						|
    specified subsytems.
 | 
						|
 | 
						|
.. _command_status:
 | 
						|
 | 
						|
:command:`status`
 | 
						|
    Reports the current status of the player and the volume
 | 
						|
    level.
 | 
						|
 | 
						|
    - ``partition``: the name of the current partition (see
 | 
						|
      :ref:`partition_commands`)
 | 
						|
    - ``volume``: ``0-100`` (deprecated: ``-1`` if the volume cannot
 | 
						|
      be determined)
 | 
						|
    - ``repeat``: ``0`` or ``1``
 | 
						|
    - ``random``: ``0`` or ``1``
 | 
						|
    - ``single`` [#since_0_15]_: ``0``, ``1``, or ``oneshot`` [#since_0_21]_
 | 
						|
    - ``consume`` [#since_0_15]_: ``0``, ``1`` or ``oneshot`` [#since_0_24]_
 | 
						|
    - ``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`` [#since_0_15]_: playlist song number of the next song to be played
 | 
						|
    - ``nextsongid`` [#since_0_15]_: playlist songid of the next song to be played
 | 
						|
    - ``time``: total time elapsed (of current playing/paused song) in seconds
 | 
						|
      (deprecated, use ``elapsed`` instead)
 | 
						|
    - ``elapsed`` [#since_0_16]_: Total time elapsed within the
 | 
						|
      current song in seconds, but with higher resolution.
 | 
						|
    - ``duration`` [#since_0_20]_: Duration of the current song in seconds.
 | 
						|
    - ``bitrate``: instantaneous bitrate in kbps
 | 
						|
    - ``xfade``: ``crossfade`` in seconds (see :ref:`crossfading`)
 | 
						|
    - ``mixrampdb``: ``mixramp`` threshold in dB
 | 
						|
    - ``mixrampdelay``: ``mixrampdelay`` in seconds
 | 
						|
    - ``audio``: The format emitted by the decoder plugin during
 | 
						|
      playback, format: ``samplerate:bits:channels``.  See
 | 
						|
      :ref:`audio_output_format` for a detailed explanation.
 | 
						|
    - ``updating_db``: ``job id``
 | 
						|
    - ``error``: if there is an error, returns message here
 | 
						|
    - ``lastloadedplaylist``: last loaded stored playlist [#since_0_24]_
 | 
						|
 | 
						|
    :program:`MPD` may omit lines which have no (known) value.  Older
 | 
						|
    :program:`MPD` versions used to have a "magic" value for
 | 
						|
    "unknown", e.g. ":samp:`volume: -1`".
 | 
						|
 | 
						|
.. _command_stats:
 | 
						|
 | 
						|
:command:`stats`
 | 
						|
    Displays statistics.
 | 
						|
 | 
						|
    - ``artists``: number of artists
 | 
						|
    - ``albums``: number of albums
 | 
						|
    - ``songs``: number of songs
 | 
						|
    - ``uptime``: daemon uptime in seconds
 | 
						|
    - ``db_playtime``: sum of all song times in the database in seconds
 | 
						|
    - ``db_update``: last db update in UNIX time (seconds since
 | 
						|
      1970-01-01 UTC)
 | 
						|
    - ``playtime``: time length of music played
 | 
						|
 | 
						|
Playback options
 | 
						|
================
 | 
						|
 | 
						|
.. _command_consume:
 | 
						|
 | 
						|
:command:`consume {STATE}` [#since_0_15]_
 | 
						|
    Sets consume state to ``STATE``,
 | 
						|
    ``STATE`` should be ``0``, ``1`` or ``oneshot`` [#since_0_24]_.
 | 
						|
    When consume is activated, each song played is removed from playlist.
 | 
						|
 | 
						|
.. _command_crossfade:
 | 
						|
 | 
						|
:command:`crossfade {SECONDS}`
 | 
						|
    Sets crossfading between songs.  See :ref:`crossfading`.
 | 
						|
 | 
						|
.. _command_mixrampdb:
 | 
						|
 | 
						|
:command:`mixrampdb {deciBels}`
 | 
						|
    Sets the threshold at which songs will be overlapped.
 | 
						|
    See :ref:`mixramp`.
 | 
						|
 | 
						|
.. _command_mixrampdelay:
 | 
						|
 | 
						|
:command:`mixrampdelay {SECONDS}`
 | 
						|
    Additional time subtracted from the overlap calculated by mixrampdb. A value of "nan" disables MixRamp overlapping and falls back to crossfading.
 | 
						|
    See :ref:`mixramp`.
 | 
						|
 | 
						|
.. _command_random:
 | 
						|
 | 
						|
:command:`random {STATE}`
 | 
						|
    Sets random state to ``STATE``,
 | 
						|
    ``STATE`` should be 0 or 1.
 | 
						|
 | 
						|
.. _command_repeat:
 | 
						|
 | 
						|
:command:`repeat {STATE}`
 | 
						|
    Sets repeat state to ``STATE``,
 | 
						|
    ``STATE`` should be 0 or 1.
 | 
						|
 | 
						|
    If enabled, MPD keeps repeating the whole queue (:ref:`single mode
 | 
						|
    <command_single>` disabled) or the current song (:ref:`single mode
 | 
						|
    <command_single>` enabled).
 | 
						|
 | 
						|
    If :ref:`random mode <command_random>` is also enabled, the
 | 
						|
    playback order will be shuffled each time the queue gets repeated.
 | 
						|
 | 
						|
.. _command_setvol:
 | 
						|
 | 
						|
:command:`setvol {VOL}`
 | 
						|
    Sets volume to ``VOL``, the range of
 | 
						|
    volume is 0-100.
 | 
						|
 | 
						|
.. _command_getvol:
 | 
						|
 | 
						|
:command:`getvol` [#since_0_23]_
 | 
						|
 | 
						|
    Read the volume.  The result is a ``volume:`` line like in
 | 
						|
    :ref:`status <command_status>`.  If there is no mixer, MPD will
 | 
						|
    emit an empty response.  Example::
 | 
						|
 | 
						|
      getvol
 | 
						|
      volume: 42
 | 
						|
      OK
 | 
						|
 | 
						|
.. _command_single:
 | 
						|
 | 
						|
:command:`single {STATE}` [#since_0_15]_
 | 
						|
    Sets single state to ``STATE``,
 | 
						|
    ``STATE`` should be ``0``, ``1`` or ``oneshot`` [#since_0_21]_.
 | 
						|
    When single is activated, playback is stopped after current song, or
 | 
						|
    song is repeated if the 'repeat' mode is enabled.
 | 
						|
 | 
						|
.. _command_replay_gain_mode:
 | 
						|
 | 
						|
:command:`replay_gain_mode {MODE}` [#since_0_16]_
 | 
						|
    Sets the replay gain mode.  One of
 | 
						|
    ``off``,
 | 
						|
    ``track``,
 | 
						|
    ``album``,
 | 
						|
    ``auto``
 | 
						|
    .
 | 
						|
    Changing the mode during playback may take several
 | 
						|
    seconds, because the new settings do not affect the
 | 
						|
    buffered data.
 | 
						|
    This command triggers the
 | 
						|
    ``options`` idle event.
 | 
						|
 | 
						|
.. _command_replay_gain_status:
 | 
						|
 | 
						|
:command:`replay_gain_status`
 | 
						|
    Prints replay gain options.  Currently, only the
 | 
						|
    variable ``replay_gain_mode`` is
 | 
						|
    returned.
 | 
						|
 | 
						|
.. _command_volume:
 | 
						|
 | 
						|
:command:`volume {CHANGE}`
 | 
						|
    Changes volume by amount ``CHANGE``.
 | 
						|
 | 
						|
Controlling playback
 | 
						|
====================
 | 
						|
 | 
						|
.. _command_next:
 | 
						|
 | 
						|
:command:`next`
 | 
						|
    Plays next song in the playlist.
 | 
						|
 | 
						|
.. _command_pause:
 | 
						|
 | 
						|
:command:`pause {STATE}`
 | 
						|
    Pause or resume playback.  Pass :samp:`1` to pause playback or
 | 
						|
    :samp:`0` to resume playback.  Without the parameter, the pause
 | 
						|
    state is toggled.
 | 
						|
 | 
						|
.. _command_play:
 | 
						|
 | 
						|
:command:`play [SONGPOS]`
 | 
						|
    Begins playing the playlist at song number
 | 
						|
    ``SONGPOS``.
 | 
						|
 | 
						|
.. _command_playid:
 | 
						|
 | 
						|
:command:`playid [SONGID]`
 | 
						|
    Begins playing the playlist at song
 | 
						|
    ``SONGID``.
 | 
						|
 | 
						|
.. _command_previous:
 | 
						|
 | 
						|
:command:`previous`
 | 
						|
    Plays previous song in the playlist.
 | 
						|
 | 
						|
.. _command_seek:
 | 
						|
 | 
						|
:command:`seek {SONGPOS} {TIME}`
 | 
						|
    Seeks to the position ``TIME`` (in
 | 
						|
    seconds; fractions allowed) of entry
 | 
						|
    ``SONGPOS`` in the playlist.
 | 
						|
 | 
						|
.. _command_seekid:
 | 
						|
 | 
						|
:command:`seekid {SONGID} {TIME}`
 | 
						|
    Seeks to the position ``TIME`` (in
 | 
						|
    seconds; fractions allowed) of song
 | 
						|
    ``SONGID``.
 | 
						|
 | 
						|
.. _command_seekcur:
 | 
						|
 | 
						|
:command:`seekcur {TIME}`
 | 
						|
    Seeks to the position ``TIME`` (in
 | 
						|
    seconds; fractions allowed) within the current song.  If
 | 
						|
    prefixed by ``+`` or ``-``, then the time is relative to the
 | 
						|
    current playing position.
 | 
						|
 | 
						|
.. _command_stop:
 | 
						|
 | 
						|
:command:`stop`
 | 
						|
    Stops playing.
 | 
						|
 | 
						|
The Queue
 | 
						|
=========
 | 
						|
 | 
						|
.. note:: The "queue" used to be called "current playlist" or just
 | 
						|
          "playlist", but that was deemed confusing, because
 | 
						|
          "playlists" are also files containing a sequence of songs.
 | 
						|
          Those "playlist files" or "stored playlists" can be
 | 
						|
          :ref:`loaded into the queue <command_load>` and the queue
 | 
						|
          can be :ref:`saved into a playlist file <command_save>`, but
 | 
						|
          they are not to be confused with the queue.
 | 
						|
 | 
						|
          Many of the command names in this section reflect the old
 | 
						|
          naming convention, but for the sake of compatibility, we
 | 
						|
          cannot rename commands.
 | 
						|
 | 
						|
There are two ways to address songs within the queue: by their
 | 
						|
position and by their id.
 | 
						|
 | 
						|
The position is a 0-based index.  It is unstable by design: if you
 | 
						|
move, delete or insert songs, all following indices will change, and a
 | 
						|
client can never be sure what song is behind a given index/position.
 | 
						|
 | 
						|
Song ids on the other hand are stable: an id is assigned to a song
 | 
						|
when it is added, and will stay the same, no matter how much it is
 | 
						|
moved around.  Adding the same song twice will assign different ids to
 | 
						|
them, and a deleted-and-readded song will have a new id.  This way, a
 | 
						|
client can always be sure the correct song is being used.  Song ids are not
 | 
						|
preserved across :program:`MPD` restarts.
 | 
						|
 | 
						|
Many commands come in two flavors, one for each address type.
 | 
						|
Whenever possible, ids should be used.
 | 
						|
 | 
						|
.. _command_add:
 | 
						|
 | 
						|
:command:`add {URI} [POSITION]`
 | 
						|
    Adds the file ``URI`` to the playlist
 | 
						|
    (directories add recursively). ``URI``
 | 
						|
    can also be a single file.
 | 
						|
 | 
						|
    The position parameter is the same as in :ref:`addid
 | 
						|
    <command_addid>`. [#since_0_23_3]_
 | 
						|
 | 
						|
    Clients that are connected via local socket may add arbitrary
 | 
						|
    local files (URI is an absolute path).  Example::
 | 
						|
 | 
						|
     add "/home/foo/Music/bar.ogg"
 | 
						|
 | 
						|
.. _command_addid:
 | 
						|
 | 
						|
:command:`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
 | 
						|
 | 
						|
    If the second parameter is given, then the song is inserted at the
 | 
						|
    specified position.  If the parameter starts with ``+`` or ``-``,
 | 
						|
    then it is relative to the current song [#since_0_23]_; e.g. ``+0``
 | 
						|
    inserts right after the current song and ``-0`` inserts right
 | 
						|
    before the current song (i.e. zero songs between the current song
 | 
						|
    and the newly added song).
 | 
						|
 | 
						|
.. _command_clear:
 | 
						|
 | 
						|
:command:`clear`
 | 
						|
    Clears the queue.
 | 
						|
 | 
						|
.. _command_delete:
 | 
						|
 | 
						|
:command:`delete [{POS} | {START:END}]`
 | 
						|
    Deletes a song from the playlist.
 | 
						|
 | 
						|
.. _command_deleteid:
 | 
						|
 | 
						|
:command:`deleteid {SONGID}`
 | 
						|
    Deletes the song ``SONGID`` from the
 | 
						|
    playlist
 | 
						|
 | 
						|
.. _command_move:
 | 
						|
 | 
						|
:command:`move [{FROM} | {START:END}] {TO}`
 | 
						|
    Moves the song at ``FROM`` or range of songs
 | 
						|
    at ``START:END`` [#since_0_15]_ to ``TO``
 | 
						|
    in the playlist.
 | 
						|
 | 
						|
    If ``TO`` starts with ``+`` or ``-``, then it is relative to the
 | 
						|
    current song; e.g. ``+0`` moves to right after the current song
 | 
						|
    and ``-0`` moves to right before the current song (i.e. zero songs
 | 
						|
    between the current song and the moved range).
 | 
						|
 | 
						|
.. _command_moveid:
 | 
						|
 | 
						|
:command:`moveid {FROM} {TO}`
 | 
						|
    Moves the song with ``FROM`` (songid) to
 | 
						|
    ``TO`` (playlist index) in the
 | 
						|
    playlist.
 | 
						|
 | 
						|
    If ``TO`` starts with ``+`` or ``-``, then it is relative to the
 | 
						|
    current song; e.g. ``+0`` moves to right after the current song
 | 
						|
    and ``-0`` moves to right before the current song (i.e. zero songs
 | 
						|
    between the current song and the moved song).
 | 
						|
 | 
						|
.. _command_playlist:
 | 
						|
 | 
						|
:command:`playlist`
 | 
						|
 | 
						|
    Displays the queue.
 | 
						|
 | 
						|
    Do not use this, instead use :ref:`playlistinfo
 | 
						|
    <command_playlistinfo>`.
 | 
						|
 | 
						|
.. _command_playlistfind:
 | 
						|
 | 
						|
:command:`playlistfind {FILTER} [sort {TYPE}] [window {START:END}]`
 | 
						|
    Search the queue for songs matching
 | 
						|
    ``FILTER`` (see :ref:`Filters <filter_syntax>`).
 | 
						|
 | 
						|
    ``sort`` sorts the result by the specified tag.  The sort is
 | 
						|
    descending if the tag is prefixed with a minus ('-').  Only the
 | 
						|
    first tag value will be used, if multiple of the same type exist.
 | 
						|
    To sort by "Title", "Artist", "Album", "AlbumArtist" or "Composer",
 | 
						|
    you should specify "TitleSort", "ArtistSort", "AlbumSort",
 | 
						|
    "AlbumArtistSort" or "ComposerSort" instead.  These
 | 
						|
    will automatically fall back to the former if "\*Sort" doesn't
 | 
						|
    exist.  "AlbumArtist" falls back to just "Artist".  The type
 | 
						|
    "Last-Modified" can sort by file modification time, and "prio"
 | 
						|
    sorts by queue priority.
 | 
						|
 | 
						|
    ``window`` can be used to query only a portion of the real
 | 
						|
    response.  The parameter is two zero-based queue positions; a
 | 
						|
    start index (including) and an end index (excluding). The end
 | 
						|
    index can be omitted, which means the range is open-ended.
 | 
						|
 | 
						|
.. _command_playlistid:
 | 
						|
 | 
						|
:command:`playlistid {SONGID}`
 | 
						|
    Displays a list of songs in the playlist.
 | 
						|
    ``SONGID`` is optional and specifies a
 | 
						|
    single song to display info for.
 | 
						|
 | 
						|
.. _command_playlistinfo:
 | 
						|
 | 
						|
:command:`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`` [#since_0_15]_
 | 
						|
 | 
						|
.. _command_playlistsearch:
 | 
						|
 | 
						|
:command:`playlistsearch {FILTER} [sort {TYPE}] [window {START:END}]`
 | 
						|
    Search the queue for songs matching
 | 
						|
    ``FILTER`` (see :ref:`Filters <filter_syntax>`).
 | 
						|
    Parameters have the same meaning as for :ref:`find
 | 
						|
    <command_playlistfind>`, except that search is not case sensitive.
 | 
						|
 | 
						|
.. _command_plchanges:
 | 
						|
 | 
						|
:command:`plchanges {VERSION} [START:END]`
 | 
						|
    Displays changed songs currently in the playlist since
 | 
						|
    ``VERSION``.  Start and end positions may
 | 
						|
    be given to limit the output to changes in the given
 | 
						|
    range.
 | 
						|
 | 
						|
    To detect songs that were deleted at the end of the
 | 
						|
    playlist, use playlistlength returned by status command.
 | 
						|
 | 
						|
.. _command_plchangesposid:
 | 
						|
 | 
						|
:command:`plchangesposid {VERSION} [START:END]`
 | 
						|
    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.
 | 
						|
 | 
						|
.. _command_prio:
 | 
						|
 | 
						|
:command:`prio {PRIORITY} {START:END...}`
 | 
						|
    Set the priority of the specified songs.  A higher
 | 
						|
    priority means that it will be played first when
 | 
						|
    "random" mode is enabled.
 | 
						|
 | 
						|
    A priority is an integer between 0 and 255.  The default
 | 
						|
    priority of new songs is 0.
 | 
						|
 | 
						|
.. _command_prioid:
 | 
						|
 | 
						|
:command:`prioid {PRIORITY} {ID...}`
 | 
						|
    Same as :ref:`priod <command_prio>`,
 | 
						|
    but address the songs with their id.
 | 
						|
 | 
						|
.. _command_rangeid:
 | 
						|
 | 
						|
:command:`rangeid {ID} {START:END}` [#since_0_19]_
 | 
						|
    Since :program:`MPD`
 | 
						|
    0.19 Specifies the portion of the
 | 
						|
    song that shall be played.  ``START`` and
 | 
						|
    ``END`` are offsets in seconds
 | 
						|
    (fractional seconds allowed); both are optional.
 | 
						|
    Omitting both (i.e. sending just ":") means "remove the
 | 
						|
    range, play everything".  A song that is currently
 | 
						|
    playing cannot be manipulated this way.
 | 
						|
 | 
						|
.. _command_shuffle:
 | 
						|
 | 
						|
:command:`shuffle [START:END]`
 | 
						|
    Shuffles the queue.
 | 
						|
    ``START:END`` is optional and specifies
 | 
						|
    a range of songs.
 | 
						|
 | 
						|
.. _command_swap:
 | 
						|
 | 
						|
:command:`swap {SONG1} {SONG2}`
 | 
						|
    Swaps the positions of ``SONG1`` and
 | 
						|
    ``SONG2``.
 | 
						|
 | 
						|
.. _command_swapid:
 | 
						|
 | 
						|
:command:`swapid {SONG1} {SONG2}`
 | 
						|
    Swaps the positions of ``SONG1`` and
 | 
						|
    ``SONG2`` (both song ids).
 | 
						|
 | 
						|
.. _command_addtagid:
 | 
						|
 | 
						|
:command:`addtagid {SONGID} {TAG} {VALUE}`
 | 
						|
    Adds a tag to the specified song.  Editing song tags is
 | 
						|
    only possible for remote songs.  This change is
 | 
						|
    volatile: it may be overwritten by tags received from
 | 
						|
    the server, and the data is gone when the song gets
 | 
						|
    removed from the queue.
 | 
						|
 | 
						|
.. _command_cleartagid:
 | 
						|
 | 
						|
:command:`cleartagid {SONGID} [TAG]`
 | 
						|
    Removes tags from the specified song.  If
 | 
						|
    ``TAG`` is not specified, then all tag
 | 
						|
    values will be removed.  Editing song tags is only
 | 
						|
    possible for remote songs.
 | 
						|
 | 
						|
Stored playlists
 | 
						|
================
 | 
						|
 | 
						|
Playlists are stored inside the configured playlist directory.
 | 
						|
They are addressed with their file name (without the directory
 | 
						|
and without the `.m3u` suffix).
 | 
						|
 | 
						|
Some of the commands described in this section can be used to
 | 
						|
run playlist plugins instead of the hard-coded simple
 | 
						|
`m3u` parser.  They can access playlists in
 | 
						|
the music directory (relative path including the suffix),
 | 
						|
playlists in arbitrary location (absolute path including the suffix;
 | 
						|
allowed only for clients that are connected via local socket), or
 | 
						|
remote playlists (absolute URI with a supported scheme).
 | 
						|
 | 
						|
.. _command_listplaylist:
 | 
						|
 | 
						|
:command:`listplaylist {NAME} [{START:END}]`
 | 
						|
    Lists the songs in the playlist.  Playlist plugins are
 | 
						|
    supported. A range may be specified to list
 | 
						|
    only a part of the playlist. [#since_0_24]_
 | 
						|
 | 
						|
.. _command_listplaylistinfo:
 | 
						|
 | 
						|
:command:`listplaylistinfo {NAME} [{START:END}]`
 | 
						|
    Lists the songs with metadata in the playlist.  Playlist
 | 
						|
    plugins are supported. A range may be specified to list
 | 
						|
    only a part of the playlist. [#since_0_24]_
 | 
						|
 | 
						|
.. _command_searchplaylist:
 | 
						|
 | 
						|
:command:`searchplaylist {NAME} {FILTER} [window {START:END}]`
 | 
						|
    Search the playlist for songs matching
 | 
						|
    ``FILTER`` (see :ref:`Filters <filter_syntax>`).  Playlist
 | 
						|
    plugins are supported. A range may be specified to list
 | 
						|
    only a part of the playlist.
 | 
						|
 | 
						|
.. _command_listplaylists:
 | 
						|
 | 
						|
:command:`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.
 | 
						|
 | 
						|
.. _command_load:
 | 
						|
 | 
						|
:command:`load {NAME} [START:END] [POSITION]`
 | 
						|
    Loads the playlist into the current queue.  Playlist
 | 
						|
    plugins are supported.  A range may be specified to load
 | 
						|
    only a part of the playlist.
 | 
						|
 | 
						|
    The ``POSITION`` parameter specifies where the songs will be
 | 
						|
    inserted into the queue; it can be relative as described in
 | 
						|
    :ref:`addid <command_addid>`.  (This requires specifying the range
 | 
						|
    as well; the special value `0:` can be used if the whole playlist
 | 
						|
    shall be loaded at a certain queue position.)  [#since_0_23_1]_
 | 
						|
 | 
						|
.. _command_playlistadd:
 | 
						|
 | 
						|
:command:`playlistadd {NAME} {URI} [POSITION]`
 | 
						|
    Adds ``URI`` to the playlist
 | 
						|
    `NAME.m3u`.
 | 
						|
    `NAME.m3u` will be created if it does
 | 
						|
    not exist.
 | 
						|
 | 
						|
    The ``POSITION`` parameter specifies where the songs will be
 | 
						|
    inserted into the playlist. [#since_0_23_3]_
 | 
						|
 | 
						|
.. _command_playlistclear:
 | 
						|
 | 
						|
:command:`playlistclear {NAME}`
 | 
						|
    Clears the playlist `NAME.m3u`.
 | 
						|
 | 
						|
.. _command_playlistdelete:
 | 
						|
 | 
						|
:command:`playlistdelete {NAME} {SONGPOS}`
 | 
						|
    Deletes ``SONGPOS`` from the
 | 
						|
    playlist `NAME.m3u`.
 | 
						|
 | 
						|
    The second parameter can be a range. [#since_0_23_3]_
 | 
						|
 | 
						|
.. _command_playlistlength:
 | 
						|
 | 
						|
:command:`playlistlength {NAME}`
 | 
						|
    Count the number of songs and their total playtime (seconds) in the
 | 
						|
    playlist.
 | 
						|
 | 
						|
    Example::
 | 
						|
 | 
						|
     playlistlength example
 | 
						|
     songs: 10
 | 
						|
     playtime: 8192
 | 
						|
     OK
 | 
						|
 | 
						|
.. _command_playlistmove:
 | 
						|
 | 
						|
:command:`playlistmove {NAME} [{FROM} | {START:END}] {TO}`
 | 
						|
    Moves the song at position ``FROM`` or range of songs
 | 
						|
    at ``START:END`` [#since_0_24]_ in
 | 
						|
    the playlist `NAME.m3u` to the
 | 
						|
    position ``TO``.
 | 
						|
 | 
						|
.. _command_rename:
 | 
						|
 | 
						|
:command:`rename {NAME} {NEW_NAME}`
 | 
						|
    Renames the playlist `NAME.m3u` to `NEW_NAME.m3u`.
 | 
						|
 | 
						|
.. _command_rm:
 | 
						|
 | 
						|
:command:`rm {NAME}`
 | 
						|
    Removes the playlist `NAME.m3u` from
 | 
						|
    the playlist directory.
 | 
						|
 | 
						|
.. _command_save:
 | 
						|
 | 
						|
:command:`save {NAME} [MODE]`
 | 
						|
    Saves the queue to
 | 
						|
    `NAME.m3u` in the playlist directory.
 | 
						|
 | 
						|
    ``MODE`` [#since_0_24]_
 | 
						|
        Optional argument. One of `create`, `append`, or `replace`.
 | 
						|
 | 
						|
        `create`
 | 
						|
            The default. Create a new playlist.
 | 
						|
            Fail if a playlist with name ``NAME`` already exists.
 | 
						|
 | 
						|
        `append`, `replace`
 | 
						|
            Append or replace an existing playlist.
 | 
						|
            Fail if a playlist with name ``NAME`` doesn\'t already exist.
 | 
						|
 | 
						|
The music database
 | 
						|
==================
 | 
						|
 | 
						|
.. _command_albumart:
 | 
						|
 | 
						|
:command:`albumart {URI} {OFFSET}`
 | 
						|
    Locate album art for the given song and return a chunk of an album
 | 
						|
    art image file at offset ``OFFSET``.
 | 
						|
 | 
						|
    This is currently implemented by searching the directory the file
 | 
						|
    resides in for a file called :file:`cover.png`, :file:`cover.jpg`,
 | 
						|
    or :file:`cover.webp`.
 | 
						|
 | 
						|
    Returns the file size and actual number
 | 
						|
    of bytes read at the requested offset, followed
 | 
						|
    by the chunk requested as raw bytes (see :ref:`binary`), then a
 | 
						|
    newline and the completion code.
 | 
						|
 | 
						|
    Example::
 | 
						|
 | 
						|
     albumart foo/bar.ogg 0
 | 
						|
     size: 1024768
 | 
						|
     binary: 8192
 | 
						|
     <8192 bytes>
 | 
						|
     OK
 | 
						|
 | 
						|
.. _command_count:
 | 
						|
 | 
						|
:command:`count {FILTER} [group {GROUPTYPE}]`
 | 
						|
    Count the number of songs and their total playtime in
 | 
						|
    the database matching ``FILTER`` (see
 | 
						|
    :ref:`Filters <filter_syntax>`).  The
 | 
						|
    following prints the number of songs whose title matches
 | 
						|
    "Echoes"::
 | 
						|
 | 
						|
     count title Echoes
 | 
						|
 | 
						|
    The *group* keyword may be used to
 | 
						|
    group the results by a tag.  The first following example
 | 
						|
    prints per-artist counts while the next prints the
 | 
						|
    number of songs whose title matches "Echoes" grouped by
 | 
						|
    artist::
 | 
						|
 | 
						|
     count group artist
 | 
						|
     count title Echoes group artist
 | 
						|
 | 
						|
    A group with an empty value contains counts of matching songs which
 | 
						|
    don't have this group tag.  It exists only if at least one such song is
 | 
						|
    found.
 | 
						|
 | 
						|
.. _command_getfingerprint:
 | 
						|
 | 
						|
:command:`getfingerprint {URI}`
 | 
						|
 | 
						|
    This command is not available in mpd-dbcreate (ChromaPrint support removed).
 | 
						|
 | 
						|
.. _command_find:
 | 
						|
 | 
						|
:command:`find {FILTER} [sort {TYPE}] [window {START:END}]`
 | 
						|
    Search the database for songs matching
 | 
						|
    ``FILTER`` (see :ref:`Filters <filter_syntax>`).
 | 
						|
 | 
						|
    ``sort`` sorts the result by the
 | 
						|
    specified tag.  The sort is descending if the tag is
 | 
						|
    prefixed with a minus ('-').
 | 
						|
    Without ``sort``, the
 | 
						|
    order is undefined.  Only the first tag value will be
 | 
						|
    used, if multiple of the same type exist.  To sort by
 | 
						|
    "Artist", "Album" or "AlbumArtist", you should specify
 | 
						|
    "ArtistSort", "AlbumSort" or "AlbumArtistSort" instead.
 | 
						|
    These will automatically fall back to the former if
 | 
						|
    "\*Sort" doesn't exist.  "AlbumArtist" falls back to just
 | 
						|
    "Artist".  The type "Last-Modified" can sort by file
 | 
						|
    modification time.
 | 
						|
 | 
						|
    ``window`` can be used to query only a
 | 
						|
    portion of the real response.  The parameter is two
 | 
						|
    zero-based record numbers; a start number and an end
 | 
						|
    number.
 | 
						|
 | 
						|
.. _command_findadd:
 | 
						|
 | 
						|
:command:`findadd {FILTER} [sort {TYPE}] [window {START:END}] [position POS]`
 | 
						|
    Search the database for songs matching
 | 
						|
    ``FILTER`` (see :ref:`Filters <filter_syntax>`) and add them to
 | 
						|
    the queue.  Parameters have the same meaning as for
 | 
						|
    :ref:`find <command_find>` and :ref:`searchadd <command_searchadd>`.
 | 
						|
 | 
						|
.. _command_list:
 | 
						|
 | 
						|
:command:`list {TYPE} {FILTER} [group {GROUPTYPE}] [window {START:END}]`
 | 
						|
    Lists unique tags values of the specified type.
 | 
						|
    ``TYPE`` can be any tag supported by
 | 
						|
    :program:`MPD`.
 | 
						|
 | 
						|
    Additional arguments may specify a :ref:`filter <filter_syntax>`.
 | 
						|
    The *group* keyword may be used
 | 
						|
    (repeatedly) to group the results by one or more tags.
 | 
						|
 | 
						|
    The following example lists all album names,
 | 
						|
    grouped by their respective (album) artist::
 | 
						|
 | 
						|
     list album group albumartist
 | 
						|
 | 
						|
    ``window`` works like in :ref:`find <command_find>`.  In this
 | 
						|
    command, it affects only the top-most tag type. [#since_0_25]_
 | 
						|
 | 
						|
    ``list file`` was implemented in an early :program:`MPD` version,
 | 
						|
    but does not appear to make a lot of sense.  It still works (to
 | 
						|
    avoid breaking compatibility), but is deprecated.
 | 
						|
 | 
						|
.. _command_listall:
 | 
						|
 | 
						|
:command:`listall [URI]`
 | 
						|
    Lists all songs and directories in
 | 
						|
    ``URI``.
 | 
						|
 | 
						|
    Do not use this command.  Do not manage a client-side
 | 
						|
    copy of :program:`MPD`'s database.  That
 | 
						|
    is fragile and adds huge overhead.  It will break with
 | 
						|
    large databases.  Instead, query
 | 
						|
    :program:`MPD` whenever you need
 | 
						|
    something.
 | 
						|
 | 
						|
.. _command_listallinfo:
 | 
						|
 | 
						|
:command:`listallinfo [URI]`
 | 
						|
    Same as :ref:`listall <command_listall>`,
 | 
						|
    except it also returns metadata info in the same format
 | 
						|
    as :ref:`lsinfo <command_lsinfo>`
 | 
						|
 | 
						|
    Do not use this command.  Do not manage a client-side
 | 
						|
    copy of :program:`MPD`'s database.  That
 | 
						|
    is fragile and adds huge overhead.  It will break with
 | 
						|
    large databases.  Instead, query
 | 
						|
    :program:`MPD` whenever you need
 | 
						|
    something.
 | 
						|
 | 
						|
.. _command_listfiles:
 | 
						|
 | 
						|
:command:`listfiles {URI}`
 | 
						|
    Lists the contents of the directory
 | 
						|
    ``URI``, including files are not
 | 
						|
    recognized by :program:`MPD`.
 | 
						|
    ``URI`` can be a path relative to the
 | 
						|
    music directory or an URI understood by one of the
 | 
						|
    storage plugins.  The response contains at least one
 | 
						|
    line for each directory entry with the prefix "file: "
 | 
						|
    or "directory: ", and may be followed by file attributes
 | 
						|
    such as "Last-Modified" and "size".
 | 
						|
 | 
						|
    For example, "smb://SERVER" returns a list of all shares
 | 
						|
    on the given SMB/CIFS server; "nfs://servername/path"
 | 
						|
    obtains a directory listing from the NFS server.
 | 
						|
 | 
						|
.. _command_lsinfo:
 | 
						|
 | 
						|
:command:`lsinfo [URI]`
 | 
						|
    Lists the contents of the directory
 | 
						|
    ``URI``.  The response contains records
 | 
						|
    starting with ``file``,
 | 
						|
    ``directory`` or
 | 
						|
    ``playlist``, each followed by metadata
 | 
						|
    (:ref:`tags <tags>` or :ref:`other metadata <other_metadata>`).
 | 
						|
 | 
						|
    When listing the root directory, this currently returns
 | 
						|
    the list of stored playlists.  This behavior is
 | 
						|
    deprecated; use "listplaylists" instead.
 | 
						|
 | 
						|
    This command may be used to list metadata of remote
 | 
						|
    files (e.g. URI beginning with "http://" or "smb://").
 | 
						|
 | 
						|
    Clients that are connected via local socket may
 | 
						|
    use this command to read the tags of an arbitrary local
 | 
						|
    file (URI is an absolute path).
 | 
						|
 | 
						|
.. _command_readcomments:
 | 
						|
 | 
						|
:command:`readcomments {URI}`
 | 
						|
    Read "comments" (i.e. key-value pairs) from the file
 | 
						|
    specified by "URI".  This "URI" can be a path relative
 | 
						|
    to the music directory or an absolute path.
 | 
						|
 | 
						|
    This command may be used to list metadata of remote
 | 
						|
    files (e.g. URI beginning with "http://" or "smb://").
 | 
						|
 | 
						|
    The response consists of lines in the form "KEY: VALUE".
 | 
						|
    Comments with suspicious characters (e.g. newlines) are
 | 
						|
    ignored silently.
 | 
						|
 | 
						|
    The meaning of these depends on the codec, and not all
 | 
						|
    decoder plugins support it.  For example, on Ogg files,
 | 
						|
    this lists the Vorbis comments.
 | 
						|
 | 
						|
.. _command_readpicture:
 | 
						|
 | 
						|
:command:`readpicture {URI} {OFFSET}`
 | 
						|
    Locate a picture for the given song and return a chunk of the
 | 
						|
    image file at offset ``OFFSET``.  This is usually implemented by
 | 
						|
    reading embedded pictures from binary tags (e.g. ID3v2's ``APIC``
 | 
						|
    tag).
 | 
						|
 | 
						|
    Returns the following values:
 | 
						|
 | 
						|
    - ``size``: the total file size
 | 
						|
    - ``type``: the file's MIME type (optional)
 | 
						|
    - ``binary``: see :ref:`binary`
 | 
						|
 | 
						|
    If the song file was recognized, but there is no picture, the
 | 
						|
    response is successful, but is otherwise empty.
 | 
						|
 | 
						|
    Example::
 | 
						|
 | 
						|
     readpicture foo/bar.ogg 0
 | 
						|
     size: 1024768
 | 
						|
     type: image/jpeg
 | 
						|
     binary: 8192
 | 
						|
     <8192 bytes>
 | 
						|
     OK
 | 
						|
 | 
						|
.. _command_search:
 | 
						|
 | 
						|
:command:`search {FILTER} [sort {TYPE}] [window {START:END}]`
 | 
						|
    Search the database for songs matching
 | 
						|
    ``FILTER`` (see :ref:`Filters <filter_syntax>`).  Parameters
 | 
						|
    have the same meaning as for :ref:`find <command_find>`,
 | 
						|
    except that search is not case sensitive.
 | 
						|
 | 
						|
.. _command_searchadd:
 | 
						|
 | 
						|
:command:`searchadd {FILTER} [sort {TYPE}] [window {START:END}] [position POS]`
 | 
						|
    Search the database for songs matching
 | 
						|
    ``FILTER`` (see :ref:`Filters <filter_syntax>`) and add them to
 | 
						|
    the queue.
 | 
						|
 | 
						|
    Parameters have the same meaning as for :ref:`search <command_search>`.
 | 
						|
 | 
						|
    The ``position`` parameter specifies where the songs will be
 | 
						|
    inserted. [#since_0_23]_
 | 
						|
    It can be relative to the current song as in :ref:`addid
 | 
						|
    <command_addid>`. [#since_0_23_5]_
 | 
						|
 | 
						|
.. _command_searchaddpl:
 | 
						|
 | 
						|
:command:`searchaddpl {NAME} {FILTER} [sort {TYPE}] [window {START:END}] [position POS]`
 | 
						|
    Search the database for songs matching
 | 
						|
    ``FILTER`` (see :ref:`Filters <filter_syntax>`) and add 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 :ref:`search <command_search>`.
 | 
						|
 | 
						|
    The ``position`` parameter specifies where the songs will be
 | 
						|
    inserted. [#since_0_23_4]_
 | 
						|
 | 
						|
.. _command_searchcount:
 | 
						|
 | 
						|
:command:`searchcount {FILTER} [group {GROUPTYPE}]`
 | 
						|
    Count the number of songs and their total playtime in
 | 
						|
    the database matching ``FILTER`` (see
 | 
						|
    :ref:`Filters <filter_syntax>`).
 | 
						|
 | 
						|
    Parameters have the same meaning as for :ref:`count <command_count>`
 | 
						|
    except the search is not case sensitive.
 | 
						|
 | 
						|
.. _command_update:
 | 
						|
 | 
						|
:command:`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 :ref:`status <command_status>`
 | 
						|
    response.
 | 
						|
 | 
						|
.. _command_rescan:
 | 
						|
 | 
						|
:command:`rescan [URI]`
 | 
						|
    Same as :ref:`update <command_update>`,
 | 
						|
    but also rescans unmodified files.
 | 
						|
 | 
						|
Mounts and neighbors
 | 
						|
====================
 | 
						|
 | 
						|
A "storage" provides access to files in a directory tree.  The
 | 
						|
most basic storage plugin is the "local" storage plugin which
 | 
						|
accesses the local file system, and there are plugins to
 | 
						|
access NFS and SMB servers.
 | 
						|
 | 
						|
Multiple storages can be "mounted" together, similar to the
 | 
						|
`mount` command on many operating
 | 
						|
systems, but without cooperation from the kernel.  No
 | 
						|
superuser privileges are necessary, because this mapping exists
 | 
						|
only inside the :program:`MPD` process.
 | 
						|
 | 
						|
.. _command_mount:
 | 
						|
 | 
						|
:command:`mount {PATH} {URI}`
 | 
						|
    Mount the specified remote storage URI at the given
 | 
						|
    path.  Example::
 | 
						|
 | 
						|
     mount foo nfs://192.168.1.4/export/mp3
 | 
						|
 | 
						|
.. _command_unmount:
 | 
						|
 | 
						|
:command:`unmount {PATH}`
 | 
						|
    Unmounts the specified path.  Example::
 | 
						|
 | 
						|
     unmount foo
 | 
						|
 | 
						|
.. _command_listmounts:
 | 
						|
 | 
						|
:command:`listmounts`
 | 
						|
    Queries a list of all mounts.  By default, this contains
 | 
						|
    just the configured ``music_directory``.
 | 
						|
    Example::
 | 
						|
 | 
						|
     listmounts
 | 
						|
     mount:
 | 
						|
     storage: /home/foo/music
 | 
						|
     mount: foo
 | 
						|
     storage: nfs://192.168.1.4/export/mp3
 | 
						|
     OK
 | 
						|
 | 
						|
.. _command_listneighbors:
 | 
						|
 | 
						|
:command:`listneighbors`
 | 
						|
    Queries a list of "neighbors" (e.g. accessible file
 | 
						|
    servers on the local net).  Items on that list may be
 | 
						|
    used with the :ref:`mount <command_mount>`
 | 
						|
    command.  Example::
 | 
						|
 | 
						|
     listneighbors
 | 
						|
     neighbor: smb://FOO
 | 
						|
     name: FOO (Samba 4.1.11-Debian)
 | 
						|
     OK
 | 
						|
 | 
						|
Stickers
 | 
						|
========
 | 
						|
 | 
						|
"Stickers" [#since_0_15]_ are pieces of
 | 
						|
information attached to existing
 | 
						|
:program:`MPD` objects (e.g. song files,
 | 
						|
directories, albums; but currently, they are only implemented for
 | 
						|
song).  Clients can create arbitrary name/value
 | 
						|
pairs.  :program:`MPD` itself does not assume
 | 
						|
any special meaning in them.
 | 
						|
 | 
						|
The goal is to allow clients to share additional (possibly
 | 
						|
dynamic) information about songs, which is neither stored on
 | 
						|
the client (not available to other clients), nor stored in the
 | 
						|
song files (:program:`MPD` has no write
 | 
						|
access).
 | 
						|
 | 
						|
Client developers should create a standard for common sticker
 | 
						|
names, to ensure interoperability.
 | 
						|
 | 
						|
Objects which may have stickers are addressed by their object
 | 
						|
type ("song" for song objects) and their URI (the path within
 | 
						|
the database for songs).
 | 
						|
 | 
						|
.. note:: Since :program:`MPD` 0.24 stickers can also be attached to playlists,
 | 
						|
  some tag types, and :ref:`filter expressions <filter_syntax>`.
 | 
						|
  The following tag types are allowed: Title, Album, Artist, AlbumArtist, Genre,
 | 
						|
  Composer, Performer, Conductor, Work, Ensemble, Location, and Label.
 | 
						|
 | 
						|
.. list-table:: Sticker addressing
 | 
						|
   :widths: 10 45 45
 | 
						|
   :header-rows: 2
 | 
						|
 | 
						|
   * - Type
 | 
						|
     - URI
 | 
						|
     - URI
 | 
						|
 | 
						|
   * -
 | 
						|
     - get, set, delete, list, find
 | 
						|
     - find only
 | 
						|
 | 
						|
   * - "song"
 | 
						|
     - File path within the database
 | 
						|
     - Directory path within the database to find a sticker on
 | 
						|
       all songs under this path recursively
 | 
						|
 | 
						|
   * - "playlist"
 | 
						|
     - The playlist name of a stored playlist
 | 
						|
     - An empty string to find a sticker in all playlists
 | 
						|
 | 
						|
   * - Tag type e.g. "Album"
 | 
						|
     - The tag value
 | 
						|
     - An empty string to find a sticker in all instances of the tag type
 | 
						|
 | 
						|
   * - "filter"
 | 
						|
     - A :ref:`filter expression <filter_syntax>`.
 | 
						|
 | 
						|
     - An empty string to find a sticker in all instances of the filter
 | 
						|
 | 
						|
.. _command_sticker_get:
 | 
						|
 | 
						|
:command:`sticker get {TYPE} {URI} {NAME}`
 | 
						|
    Reads a sticker value for the specified object.
 | 
						|
 | 
						|
.. _command_sticker_set:
 | 
						|
 | 
						|
:command:`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.
 | 
						|
 | 
						|
.. _command_sticker_inc:
 | 
						|
 | 
						|
:command:`sticker inc {TYPE} {URI} {NAME} {VALUE}`
 | 
						|
    Adds a sticker value to the specified object.  If a
 | 
						|
    sticker item with that name already exists, it is
 | 
						|
    incremented by supplied value.
 | 
						|
 | 
						|
.. _command_sticker_dec:
 | 
						|
 | 
						|
:command:`sticker dec {TYPE} {URI} {NAME} {VALUE}`
 | 
						|
    Adds a sticker value to the specified object.  If a
 | 
						|
    sticker item with that name already exists, it is
 | 
						|
    decremented by supplied value.
 | 
						|
 | 
						|
.. _command_sticker_delete:
 | 
						|
 | 
						|
:command:`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.
 | 
						|
 | 
						|
.. _command_sticker_list:
 | 
						|
 | 
						|
:command:`sticker list {TYPE} {URI}`
 | 
						|
    Lists the stickers for the specified object.
 | 
						|
 | 
						|
.. _command_sticker_find:
 | 
						|
 | 
						|
:command:`sticker find {TYPE} {URI} {NAME} [sort {SORTTYPE}] [window {START:END}]`
 | 
						|
    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.
 | 
						|
 | 
						|
    ``sort`` sorts the result by "``uri``","``value`` or "``value_int``" (casts the sticker value to an integer). [#since_0_24]_
 | 
						|
 | 
						|
.. _command_sticker_find_value:
 | 
						|
 | 
						|
:command:`sticker find {TYPE} {URI} {NAME} = {VALUE} [sort {SORTTYPE}] [window {START:END}]`
 | 
						|
    Searches for stickers with the given value.
 | 
						|
 | 
						|
    Other supported operators are:
 | 
						|
    "``<``", "``>``", "``contains``", "``starts_with``" for strings and "``eq``", "``lt``", "``gt``" to cast the value to an integer.
 | 
						|
 | 
						|
Examples:
 | 
						|
 | 
						|
   .. code-block::
 | 
						|
 | 
						|
     sticker set song "path/to/song_1.mp3" "name_1" "value_1"
 | 
						|
     OK
 | 
						|
     sticker set song "path/to/song_2.mp3" "name_1" "value_2"
 | 
						|
     OK
 | 
						|
     sticker get song "path/to/song_1.mp3" "name_1"
 | 
						|
     sticker: name_1=value_1
 | 
						|
     OK
 | 
						|
     sticker find song "path" "name_1"
 | 
						|
     file: path/to/song_1.mp3
 | 
						|
     sticker: name_1=value_1
 | 
						|
     file: path/to/song_2.mp3
 | 
						|
     sticker: name_1=value_2
 | 
						|
     OK
 | 
						|
 | 
						|
   .. code-block::
 | 
						|
 | 
						|
    sticker set Album "Greatest Hits" "name_1" "value_1"
 | 
						|
    OK
 | 
						|
    sticker find Album "" name_1
 | 
						|
    Album: Greatest Hits
 | 
						|
    sticker: name_1=value_1
 | 
						|
    OK
 | 
						|
    sticker set filter "((album == 'Greatest Hits') AND (artist == 'Vera Lynn'))" name_1 value_1
 | 
						|
    OK
 | 
						|
    sticker set filter "((album == 'Greatest Hits') AND (artist == 'Johnny Chester'))" name_1 value_1
 | 
						|
    OK
 | 
						|
    sticker find filter "" name_1
 | 
						|
    filter: ((album == 'Greatest Hits') AND (artist == 'Johnny Chester'))
 | 
						|
    sticker: name_1=value_1
 | 
						|
    filter: ((album == 'Greatest Hits') AND (artist == 'Vera Lynn'))
 | 
						|
    sticker: name_1=value_1
 | 
						|
    OK
 | 
						|
 | 
						|
:command:`stickernames`
 | 
						|
    Gets a list of uniq sticker names.
 | 
						|
 | 
						|
:command:`stickertypes`
 | 
						|
    Shows a list of available sticker types.
 | 
						|
 | 
						|
:command:`stickernamestypes [TYPE]`
 | 
						|
    Gets a list of uniq sticker names and their types.
 | 
						|
 | 
						|
Connection settings
 | 
						|
===================
 | 
						|
 | 
						|
.. _command_close:
 | 
						|
 | 
						|
:command:`close`
 | 
						|
    Closes the connection to :program:`MPD`.
 | 
						|
    :program:`MPD` will try to send the
 | 
						|
    remaining output buffer before it actually closes the
 | 
						|
    connection, but that cannot be guaranteed.  This command
 | 
						|
    will not generate a response.
 | 
						|
 | 
						|
    Clients should not use this command; instead, they should just
 | 
						|
    close the socket.
 | 
						|
 | 
						|
.. _command_kill:
 | 
						|
 | 
						|
:command:`kill`
 | 
						|
    Kills :program:`MPD`.
 | 
						|
 | 
						|
    Do not use this command.  Send ``SIGTERM`` to :program:`MPD`
 | 
						|
    instead, or better: let your service manager handle :program:`MPD`
 | 
						|
    shutdown (e.g. :command:`systemctl stop mpd`).
 | 
						|
 | 
						|
.. _command_password:
 | 
						|
 | 
						|
:command:`password {PASSWORD}`
 | 
						|
    This is used for authentication with the server.
 | 
						|
    ``PASSWORD`` is simply the plaintext
 | 
						|
    password.
 | 
						|
 | 
						|
.. _command_ping:
 | 
						|
 | 
						|
:command:`ping`
 | 
						|
    Does nothing but return "OK".
 | 
						|
 | 
						|
.. _command_binarylimit:
 | 
						|
 | 
						|
:command:`binarylimit SIZE` [#since_0_22_4]_
 | 
						|
 | 
						|
    Set the maximum :ref:`binary response <binary>` size for the
 | 
						|
    current connection to the specified number of bytes.
 | 
						|
 | 
						|
    A bigger value means less overhead for transmitting large
 | 
						|
    entities, but it also means that the connection is blocked for a
 | 
						|
    longer time.
 | 
						|
 | 
						|
.. _command_tagtypes:
 | 
						|
 | 
						|
:command:`tagtypes`
 | 
						|
    Shows a list of available tag types.  It is an
 | 
						|
    intersection of the ``metadata_to_use``
 | 
						|
    setting and this client's tag mask.
 | 
						|
 | 
						|
    About the tag mask: each client can decide to disable
 | 
						|
    any number of tag types, which will be omitted from
 | 
						|
    responses to this client.  That is a good idea, because
 | 
						|
    it makes responses smaller.  The following
 | 
						|
    ``tagtypes`` sub commands configure this
 | 
						|
    list.
 | 
						|
 | 
						|
.. _command_tagtypes_disable:
 | 
						|
 | 
						|
:command:`tagtypes disable {NAME...}`
 | 
						|
    Remove one or more tags from the list of tag types the
 | 
						|
    client is interested in.  These will be omitted from
 | 
						|
    responses to this client.
 | 
						|
 | 
						|
.. _command_tagtypes_enable:
 | 
						|
 | 
						|
:command:`tagtypes enable {NAME...}`
 | 
						|
    Re-enable one or more tags from the list of tag types
 | 
						|
    for this client.  These will no longer be hidden from
 | 
						|
    responses to this client.
 | 
						|
 | 
						|
.. _command_tagtypes_clear:
 | 
						|
 | 
						|
:command:`tagtypes clear`
 | 
						|
    Clear the list of tag types this client is interested
 | 
						|
    in.  This means that :program:`MPD` will
 | 
						|
    not send any tags to this client.
 | 
						|
 | 
						|
.. _command_tagtypes_all:
 | 
						|
 | 
						|
:command:`tagtypes all`
 | 
						|
    Announce that this client is interested in all tag
 | 
						|
    types.  This is the default setting for new clients.
 | 
						|
 | 
						|
.. _command_tagtypes_available:
 | 
						|
 | 
						|
:command:`tagtypes available`
 | 
						|
    Shows the list of tag types configured
 | 
						|
    by the ``metadata_to_use`` setting.
 | 
						|
 | 
						|
:command:`tagtypes reset {NAME...}`
 | 
						|
    Clear the list of tag types and Re-enable one or more tags
 | 
						|
    from the list of tag types for this client.  These will no
 | 
						|
    longer be hidden from responses to this client.
 | 
						|
 | 
						|
.. _command_protocol:
 | 
						|
 | 
						|
:command:`protocol`
 | 
						|
    Shows a list of enabled protocol features.
 | 
						|
 | 
						|
    Available features:
 | 
						|
 | 
						|
    - ``hide_playlists_in_root``: disables the listing of
 | 
						|
      stored playlists for the :ref:`lsinfo <command_lsinfo>`.
 | 
						|
 | 
						|
    The following ``protocol`` sub commands configure the
 | 
						|
    protocol features.
 | 
						|
 | 
						|
.. _command_protocol_disable:
 | 
						|
 | 
						|
:command:`protocol disable {FEATURE...}`
 | 
						|
    Disables one or more features.
 | 
						|
 | 
						|
.. _command_protocol_enable:
 | 
						|
 | 
						|
:command:`protocol enable {FEATURE...}`
 | 
						|
    Enables one or more features.
 | 
						|
 | 
						|
.. _command_protocol_clear:
 | 
						|
 | 
						|
:command:`protocol clear`
 | 
						|
    Disables all protocol features.
 | 
						|
 | 
						|
.. _command_protocol_all:
 | 
						|
 | 
						|
:command:`protocol all`
 | 
						|
    Enables all protocol features.
 | 
						|
 | 
						|
.. _command_protocol_available:
 | 
						|
 | 
						|
:command:`protocol available`
 | 
						|
    Lists all available protocol features.
 | 
						|
 | 
						|
.. _partition_commands:
 | 
						|
 | 
						|
Partition commands
 | 
						|
==================
 | 
						|
 | 
						|
These commands allow a client to inspect and manage
 | 
						|
"partitions".  A partition is one frontend of a multi-player
 | 
						|
MPD process: it has separate queue, player and outputs.  A
 | 
						|
client is assigned to one partition at a time.
 | 
						|
 | 
						|
.. _command_partition:
 | 
						|
 | 
						|
:command:`partition {NAME}`
 | 
						|
    Switch the client to a different partition.
 | 
						|
 | 
						|
.. _command_listpartitions:
 | 
						|
 | 
						|
:command:`listpartitions`
 | 
						|
    Print a list of partitions.  Each partition starts with
 | 
						|
    a ``partition`` keyword and the
 | 
						|
    partition's name, followed by information about the
 | 
						|
    partition.
 | 
						|
 | 
						|
.. _command_newpartition:
 | 
						|
 | 
						|
:command:`newpartition {NAME}`
 | 
						|
    Create a new partition.
 | 
						|
 | 
						|
.. _command_delpartition:
 | 
						|
 | 
						|
:command:`delpartition {NAME}`
 | 
						|
    Delete a partition.  The partition must be empty (no connected
 | 
						|
    clients and no outputs).
 | 
						|
 | 
						|
.. _command_moveoutput:
 | 
						|
 | 
						|
:command:`moveoutput {OUTPUTNAME}`
 | 
						|
    Move an output to the current partition.
 | 
						|
 | 
						|
Audio output devices
 | 
						|
====================
 | 
						|
 | 
						|
.. _command_disableoutput:
 | 
						|
 | 
						|
:command:`disableoutput {ID}`
 | 
						|
    Turns an output off.
 | 
						|
 | 
						|
.. _command_enableoutput:
 | 
						|
 | 
						|
:command:`enableoutput {ID}`
 | 
						|
    Turns an output on.
 | 
						|
 | 
						|
.. _command_toggleoutput:
 | 
						|
 | 
						|
:command:`toggleoutput {ID}`
 | 
						|
    Turns an output on or off, depending on the current
 | 
						|
    state.
 | 
						|
 | 
						|
.. _command_outputs:
 | 
						|
 | 
						|
:command:`outputs`
 | 
						|
    Shows information about all outputs.
 | 
						|
 | 
						|
    ::
 | 
						|
 | 
						|
        outputid: 0
 | 
						|
        outputname: My ALSA Device
 | 
						|
        plugin: alsa
 | 
						|
        outputenabled: 0
 | 
						|
        attribute: dop=0
 | 
						|
        OK
 | 
						|
 | 
						|
    Return information:
 | 
						|
 | 
						|
    - ``outputid``: ID of the output. May change between executions
 | 
						|
    - ``outputname``: Name of the output. It can be any.
 | 
						|
    - ``outputenabled``: Status of the output. 0 if disabled, 1 if enabled.
 | 
						|
 | 
						|
.. _command_outputset:
 | 
						|
 | 
						|
:command:`outputset {ID} {NAME} {VALUE}`
 | 
						|
    Set a runtime attribute.  These are specific to the
 | 
						|
    output plugin, and supported values are usually printed
 | 
						|
    in the :ref:`outputs <command_outputs>`
 | 
						|
    response.
 | 
						|
 | 
						|
Reflection
 | 
						|
==========
 | 
						|
 | 
						|
.. _command_config:
 | 
						|
 | 
						|
:command:`config`
 | 
						|
    Dumps configuration values that may be interesting for
 | 
						|
    the client.  This command is only permitted to "local"
 | 
						|
    clients (connected via local socket).
 | 
						|
 | 
						|
    The following response attributes are available:
 | 
						|
 | 
						|
    - ``music_directory``: The absolute path of the music directory.
 | 
						|
    - ``playlist_directory``: The absolute path of the playlist directory.
 | 
						|
    - ``pcre``: Indicates pcre support.
 | 
						|
 | 
						|
.. _command_commands:
 | 
						|
 | 
						|
:command:`commands`
 | 
						|
    Shows which commands the current user has access to.
 | 
						|
 | 
						|
.. _command_notcommands:
 | 
						|
 | 
						|
:command:`notcommands`
 | 
						|
    Shows which commands the current user does not have
 | 
						|
    access to.
 | 
						|
 | 
						|
.. _command_urlhandlers:
 | 
						|
 | 
						|
:command:`urlhandlers`
 | 
						|
    Gets a list of available URL handlers.
 | 
						|
 | 
						|
.. _command_decoders:
 | 
						|
 | 
						|
:command:`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
 | 
						|
 | 
						|
Client to client
 | 
						|
================
 | 
						|
 | 
						|
Clients can communicate with each others over "channels".  A
 | 
						|
channel is created by a client subscribing to it.  More than
 | 
						|
one client can be subscribed to a channel at a time; all of
 | 
						|
them will receive the messages which get sent to it.  A client
 | 
						|
can be subscribed to up to 16 channels simultaneously.
 | 
						|
 | 
						|
Each time a client subscribes or unsubscribes, the global idle
 | 
						|
event ``subscription`` is generated.  In
 | 
						|
conjunction with the :ref:`channels <command_channels>`
 | 
						|
command, this may be used to auto-detect clients providing
 | 
						|
additional services.
 | 
						|
 | 
						|
New messages are indicated by the ``message``
 | 
						|
idle event.
 | 
						|
 | 
						|
If your MPD instance has multiple partitions, note that
 | 
						|
client-to-client messages are local to the current partition.
 | 
						|
 | 
						|
.. _command_subscribe:
 | 
						|
 | 
						|
:command:`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.
 | 
						|
 | 
						|
.. _command_unsubscribe:
 | 
						|
 | 
						|
:command:`unsubscribe {NAME}`
 | 
						|
    Unsubscribe from a channel.
 | 
						|
 | 
						|
.. _command_channels:
 | 
						|
 | 
						|
:command:`channels`
 | 
						|
    Obtain a list of all channels.  The response is a list
 | 
						|
    of "channel:" lines.
 | 
						|
 | 
						|
.. _command_readmessages:
 | 
						|
 | 
						|
:command:`readmessages`
 | 
						|
    Reads messages for this client.  The response is a list
 | 
						|
    of "channel:" and "message:" lines.
 | 
						|
 | 
						|
.. _command_sendmessage:
 | 
						|
 | 
						|
:command:`sendmessage {CHANNEL} {TEXT}`
 | 
						|
    Send a message to the specified channel.
 | 
						|
 | 
						|
.. rubric:: Footnotes
 | 
						|
 | 
						|
.. [#since_0_14] Since :program:`MPD` 0.14
 | 
						|
.. [#since_0_15] Since :program:`MPD` 0.15
 | 
						|
.. [#since_0_16] Since :program:`MPD` 0.16
 | 
						|
.. [#since_0_19] Since :program:`MPD` 0.19
 | 
						|
.. [#since_0_20] Since :program:`MPD` 0.20
 | 
						|
.. [#since_0_21] Since :program:`MPD` 0.21
 | 
						|
.. [#since_0_22_4] Since :program:`MPD` 0.22.4
 | 
						|
.. [#since_0_23] Since :program:`MPD` 0.23
 | 
						|
.. [#since_0_23_1] Since :program:`MPD` 0.23.1
 | 
						|
.. [#since_0_23_3] Since :program:`MPD` 0.23.3
 | 
						|
.. [#since_0_23_4] Since :program:`MPD` 0.23.4
 | 
						|
.. [#since_0_23_5] Since :program:`MPD` 0.23.5
 | 
						|
.. [#since_0_24] Since :program:`MPD` 0.24
 | 
						|
.. [#since_0_25] Since :program:`MPD` 0.25
 |