@@ -69,37 +71,35 @@ terms. Let's look at each of them:
...
@@ -69,37 +71,35 @@ terms. Let's look at each of them:
of the ``ACK_ERROR`` constants defined
of the ``ACK_ERROR`` constants defined
in `src/protocol/Ack.hxx`.
in `src/protocol/Ack.hxx`.
- ``command_listNum``:
- ``command_listNum``: offset of the command that caused the error in
offset of the command that caused the error in a `Command List <command_lists>`.
a :ref:`Command List <command_lists>`. An error will always cause a
An error will always cause a command list to terminate
command list to terminate at the command that causes the error.
at the command that causes the error.
- ``current_command``:
- ``current_command``: name of the command, in a :ref:`Command List
name of the command, in a `Command List <command_lists>`,
<command_lists>`, that was executing when the error occurred.
that was executing when the error occurred.
- ``message_text``:
- ``message_text``:
some (hopefully) informative text that describes the
some (hopefully) informative text that describes the
nature of the error.
nature of the error.
foo
An example might help. Consider the following sequence
~~~
sent from the client to the server::
An example might help. Consider the following sequence
sent from the client to the server.
CMDSYN: command_list_begin volume 86 play 10240 status command_list_end
command_list_begin
volume 86
play 10240
status
command_list_end
The server responds with:
The server responds with::
``ACK \[50@1] {play} song doesn't exist: "10240"``
ACK [50@1] {play} song doesn't exist: "10240"
This tells us that the play command, which was the
This tells us that the play command, which was the second in the list
second in the list (the first or only command is
(the first or only command is numbered 0), failed with error 50. The
numbered 0), failed with error 50. The number 50
number 50 translates to ``ACK_ERROR_NO_EXIST`` -- the song doesn't
translates to ``ACK_ERROR_NO_EXIST``--the
exist. This is reiterated by the message text which also tells us
song doesn't exist. This is reiterated by the message text
which song doesn't exist.
which also tells us which song doesn't exist.
.. _command_lists:
.. _command_lists:
...
@@ -125,26 +125,24 @@ successful command executed in the command list.
...
@@ -125,26 +125,24 @@ successful command executed in the command list.
Ranges
Ranges
======
======
Some commands (e.g. `delete` <command_delete>`)
Some commands (e.g. :ref:`delete <command_delete>`) allow specifying a
allow specifying a range in the form
range in the form ``START:END`` (the ``END`` item is not included in
*START:END* (the ``END``
the range, similar to ranges in the Python programming language). If
item is not included in the range, similar to ranges in the
``END`` is omitted, then the maximum possible value is assumed.
Python programming language). If ``END`` is
omitted, then the maximum possible value is assumed.
.. _filter_syntax:
.. _filter_syntax:
Filters
Filters
=======
=======
All commands which search for songs (e.g. `find` <command_find>` and
All commands which search for songs (e.g. :ref:`find <command_find>`
`searchadd` <command_searchadd>`)
and :ref:`searchadd <command_searchadd>`) share a common filter
share a common filter syntax:
syntax::
CMDSYN: find EXPRESSION
find EXPRESSION
``EXPRESSION`` is a string enclosed in
``EXPRESSION`` is a string enclosed in parantheses which can be one
parantheses which can be one of:
of:
- ``(TAG == 'VALUE')``: match a tag value.
- ``(TAG == 'VALUE')``: match a tag value.
``(TAG != 'VALUE')``: mismatch a tag value.
``(TAG != 'VALUE')``: mismatch a tag value.
...
@@ -182,9 +180,9 @@ parantheses which can be one of:
...
@@ -182,9 +180,9 @@ parantheses which can be one of:
- ``(EXPRESSION1 AND EXPRESSION2 ...)``: combine two or
- ``(EXPRESSION1 AND EXPRESSION2 ...)``: combine two or
more expressions with logical "and".
more expressions with logical "and".
Prior to MPD 0.21, the syntax looked like this:
Prior to MPD 0.21, the syntax looked like this::
CMDSYN: find TYPE VALUE
find TYPE VALUE
.. _tags:
.. _tags:
...
@@ -194,6 +192,28 @@ Tags
...
@@ -194,6 +192,28 @@ Tags
The following tags are supported by
The following tags are supported by
``MPD``:
``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.
* **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.
* **date**: the song's release date. This is usually a 4-digit year.
* **composer**: the artist who composed the song.
* **performer**: the artist who performed the song.
* **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.
* **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_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
There can be multiple values for some of these tags. For
example, ``MPD`` may return multiple
example, ``MPD`` may return multiple
lines with a ``performer`` tag. A tag value is
lines with a ``performer`` tag. A tag value is
...
@@ -204,9 +224,8 @@ a UTF-8 string.
...
@@ -204,9 +224,8 @@ a UTF-8 string.
Other Metadata
Other Metadata
==============
==============
The response to `lsinfo` <command_lsinfo>` and
The response to :ref:`lsinfo <command_lsinfo>` and similar commands
similar commands may contain `song
may contain :ref:`song tags <tags>` and other metadata, specifically:
tags <tags>` and other metadata, specifically:
- ``duration``: the duration of the song in
- ``duration``: the duration of the song in
seconds; may contain a fractional part.
seconds; may contain a fractional part.
...
@@ -215,22 +234,17 @@ tags <tags>` and other metadata, specifically:
...
@@ -215,22 +234,17 @@ tags <tags>` and other metadata, specifically:
but as integer value. This is deprecated and is only here
but as integer value. This is deprecated and is only here
for compatibility with older clients. Do not use.
for compatibility with older clients. Do not use.
- ``Range``: if this is a queue item
- ``Range``: if this is a queue item referring only to a portion of
referring only to a portion of the song file, then this
the song file, then this attribute contains the time range in the
attribute contains the time range in the form
form ``START-END`` or ``START-`` (open ended); both ``START`` and
*START-END* or
``END`` are time stamps within the song in seconds (may contain a
*START-* (open ended); both
fractional part). Example: ``60-120`` plays only the second minute;
*START* and
"``180`` skips the first three minutes.
*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
- ``Format``: the audio format of the song
(or an approximation to a format supported by MPD and the
(or an approximation to a format supported by MPD and the
decoder plugin being used). When playing this file, the
decoder plugin being used). When playing this file, the
``audio`` value in the `status` <command_status>`
``audio`` value in the :ref:`status <command_status>`
response should be the same.
response should be the same.
- ``Last-Modified``: the time stamp of the
- ``Last-Modified``: the time stamp of the
...
@@ -244,15 +258,14 @@ Recipes
...
@@ -244,15 +258,14 @@ Recipes
Queuing
Queuing
=======
=======
Often, users run ``MPD`` with ``random`` enabled, but want to
Often, users run ``MPD`` with :ref:`random <command_random>` enabled,
be able to insert songs "before" the rest of the playlist.
but want to be able to insert songs "before" the rest of the playlist.
That is commonly called "queuing".
That is commonly called "queuing".
``MPD`` implements this by allowing the client to specify a
``MPD`` implements this by allowing the client to specify a "priority"
"priority" for each song in the playlist (commands ``priod`` <command_prio>` and
for each song in the playlist (commands :ref:`priod <command_prio>`
``priodid`` <command_prioid>`). A
and :ref:`priodid <command_prioid>`). A higher priority means that
higher priority means that the song is going to be played
the song is going to be played before the other songs.
before the other songs.
In "random" mode, ``MPD`` maintains an
In "random" mode, ``MPD`` maintains an
internal randomized sequence of songs. In this sequence,
internal randomized sequence of songs. In this sequence,
...
@@ -284,24 +297,25 @@ Command reference
...
@@ -284,24 +297,25 @@ Command reference
Querying ``MPD``'s status
Querying ``MPD``'s status
================================
================================
CMDSYN: clearerror
:command:`clearerror`
Clears the current error message in status (this is also
Clears the current error message in status (this is also
accomplished by any command that starts playback).
accomplished by any command that starts playback).
CMDSYN: currentsong
:command:`currentsong`
Displays the song info of the current song (same song that
Displays the song info of the current song (same song that
is identified in status).
is identified in status).
CMDSYN: idle SUBSYSTEMS
.. _command_idle:
Introduced with
``MPD`` 0.14
:command:`idle [SUBSYSTEMS...]` [#since_0_14]_
Waits until there is a noteworthy change in one or more
Waits until there is a noteworthy change in one or more
of ``MPD``'s subsystems. As soon
of ``MPD``'s subsystems. As soon
as there is one, it lists all changed systems in a line
as there is one, it lists all changed systems in a line
in the format ``changed:
in the format ``changed:
SUBSYSTEM``, where SUBSYSTEM is one of the
SUBSYSTEM``, where SUBSYSTEM is one of the
following:
following:
- ``database``: the song database has been modified after `update` <command_update>`.
- ``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.
- ``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
- ``stored_playlist``: a stored playlist has been modified, renamed, created or deleted
- ``playlist``: the current playlist has been modified
- ``playlist``: the current playlist has been modified
...
@@ -313,12 +327,13 @@ CMDSYN: idle SUBSYSTEMS
...
@@ -313,12 +327,13 @@ CMDSYN: idle SUBSYSTEMS
- ``sticker``: the sticker database has been modified.
- ``sticker``: the sticker database has been modified.
- ``subscription``: a client has subscribed or unsubscribed to a channel
- ``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 queue is empty
- ``message``: a message was received on a channel this client is subscribed to; this event is only emitted when the queue is empty
Change events accumulate, even while the connection is
not in "idle" mode; no events gets lost while the client
Change events accumulate, even while the connection is not in
is doing something else with the connection. If an
"idle" mode; no events gets lost while the client is doing
event had already occurred since the last call, the new
something else with the connection. If an event had already
`idle` <command_idle>`
occurred since the last call, the new :ref:`idle <command_idle>`
command will return immediately.
command will return immediately.
While a client is waiting for `idle`
While a client is waiting for `idle`
results, the server disables timeouts, allowing a client
results, the server disables timeouts, allowing a client
to wait for events as long as mpd runs. The
to wait for events as long as mpd runs. The
...
@@ -332,24 +347,27 @@ CMDSYN: idle SUBSYSTEMS
...
@@ -332,24 +347,27 @@ CMDSYN: idle SUBSYSTEMS
notifications when something changed in one of the
notifications when something changed in one of the
specified subsytems.
specified subsytems.
CMDSYN: status
.. _command_status:
:command:`status`
Reports the current status of the player and the volume
Reports the current status of the player and the volume
level.
level.
- ``volume``: ``0-100`` or ``-1`` if the volume cannot be determined
- ``volume``: ``0-100`` or ``-1`` if the volume cannot be determined
- ``repeat``: ``0`` or ``1``
- ``repeat``: ``0`` or ``1``
- ``random``: ``0`` or ``1``
- ``random``: ``0`` or ``1``
- ``single``: Introduced with ``MPD`` 0.15 (oneshot introduced with 0.20). ``0``, ``1``, or ``oneshot``
- ``single`` [#since_0_15]_: ``0``, ``1``, or ``oneshot`` [#since_0_20]_
- ``consume``: ``0`` or ``1``
- ``consume`` [#since_0_15]_: ``0`` or ``1``
- ``playlist``: 31-bit unsigned integer, the playlist version number
- ``playlist``: 31-bit unsigned integer, the playlist version number
- ``playlistlength``: integer, the length of the playlist
- ``playlistlength``: integer, the length of the playlist
- ``state``: ``play``, ``stop, or ``pause``
- ``state``: ``play``, ``stop, or ``pause``
- ``song``: playlist song number of the current song stopped on or playing
- ``song``: playlist song number of the current song stopped on or playing
- ``songid``: playlist songid 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
- ``nextsong`` [#since_0_15]_: playlist song number of the next song to be played
- ``nextsongid``: playlist songid 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)
- ``time``: total time elapsed (of current playing/paused song)
- ``elapsed``: Introduced with ``MPD`` 0.16. Total time elapsed within the current song, but with higher resolution.
- ``elapsed`` [#since_0_16]_: Total time elapsed within the current song, but with higher resolution.
- ``duration``: Introduced with ``MPD`` 0.20. Duration of the current song in seconds.
- ``duration`` [#since_0_20]_: Duration of the current song in seconds.
- ``bitrate``: instantaneous bitrate in kbps
- ``bitrate``: instantaneous bitrate in kbps
- ``xfade``: ``crossfade`` in seconds
- ``xfade``: ``crossfade`` in seconds
- ``mixrampdb``: ``mixramp`` threshold in dB
- ``mixrampdb``: ``mixramp`` threshold in dB
...
@@ -358,8 +376,9 @@ CMDSYN: status
...
@@ -358,8 +376,9 @@ CMDSYN: status
- ``updating_db``: ``job id``
- ``updating_db``: ``job id``
- ``error``: if there is an error, returns message here
- ``error``: if there is an error, returns message here
CMDSYN: stats
:command:`stats`
Displays statistics.
Displays statistics.
- ``artists``: number of artists
- ``artists``: number of artists
- ``albums``: number of albums
- ``albums``: number of albums
- ``songs``: number of songs
- ``songs``: number of songs
...
@@ -371,45 +390,48 @@ CMDSYN: stats
...
@@ -371,45 +390,48 @@ CMDSYN: stats
Playback options
Playback options
================
================
CMDSYN: consume STATE
:command:`consume {STATE}` [#since_0_15]_
Sets consume state to ``STATE``,
Sets consume state to ``STATE``,
``STATE`` should be 0 or 1.
``STATE`` should be 0 or 1.
When consume is activated, each song played is removed from playlist.
When consume is activated, each song played is removed from playlist.
CMDSYN: crossfade SECONDS
:command:`crossfade {SECONDS}`
Sets crossfading between songs.
Sets crossfading between songs.
CMDSYN: mixrampdb deciBels
:command:`mixrampdb {deciBels}`
Sets the threshold at which songs will be overlapped. Like crossfading but doesn't fade the track volume, just overlaps. The songs need to have MixRamp tags added by an external tool. 0dB is the normalized maximum volume so use negative values, I prefer -17dB. In the absence of mixramp tags crossfading will be used. See http://sourceforge.net/projects/mixramp
Sets the threshold at which songs will be overlapped. Like crossfading but doesn't fade the track volume, just overlaps. The songs need to have MixRamp tags added by an external tool. 0dB is the normalized maximum volume so use negative values, I prefer -17dB. In the absence of mixramp tags crossfading will be used. See http://sourceforge.net/projects/mixramp
CMDSYN: mixrampdelay SECONDS
:command:`mixrampdelay {SECONDS}`
Additional time subtracted from the overlap calculated by mixrampdb. A value of "nan" disables MixRamp overlapping and falls back to crossfading.
Additional time subtracted from the overlap calculated by mixrampdb. A value of "nan" disables MixRamp overlapping and falls back to crossfading.
CMDSYN: random STATE
.. _command_random:
:command:`random {STATE}`
Sets random state to ``STATE``,
Sets random state to ``STATE``,
``STATE`` should be 0 or 1.
``STATE`` should be 0 or 1.
CMDSYN: repeat STATE
:command:`repeat {STATE}`
Sets repeat state to ``STATE``,
Sets repeat state to ``STATE``,
``STATE`` should be 0 or 1.
``STATE`` should be 0 or 1.
CMDSYN: setvol VOL
.. _command_setvol:
:command:`setvol {VOL}`
Sets volume to ``VOL``, the range of
Sets volume to ``VOL``, the range of
volume is 0-100.
volume is 0-100.
CMDSYN: single STATE
:command:`single {STATE}` [#since_0_15]_
Sets single state to ``STATE``,
Sets single state to ``STATE``,
``STATE`` should be 0 or 1.
``STATE`` should be 0 or 1.
When single is activated, playback is stopped after current song, or
When single is activated, playback is stopped after current song, or
song is repeated if the 'repeat' mode is enabled.
song is repeated if the 'repeat' mode is enabled.
CMDSYN: replay_gain_mode MODE
:command:`replay_gain_mode {MODE}` [#since_0_16]_
Sets the replay gain mode. One of
Sets the replay gain mode. One of
*off*,
``off``,
*track*,
``track``,
*album*,
``album``,
*auto*
``auto``
added in ``MPD`` 0.16
.
.
Changing the mode during playback may take several
Changing the mode during playback may take several
seconds, because the new settings does not affect the
seconds, because the new settings does not affect the