1 Music Player Daemon - Commands
4 This document has not been updated to reflect recent changes in
5 the MPD protocol. It does not contain all supported commands,
6 and some commands may now take additional arguments. However,
7 clients conforming to this specification should still be
8 compatible with the latest release of MPD. For more up to date
9 documentation, please see the protocol reference on the wiki at
10 <http://mpd.wikia.com/wiki/Protocol_Reference>.
12 This document is intended for client developers, not end users.
17 If arguments contain spaces, they should be surrounded by double quotation
20 command <type arg1> <type arg2> ...
21 explanation: w/ arg1 and arg2
23 All data between the client and server is encoded in UTF-8. (Note,
24 that in UTF-8 all standard ansi characters, 0-127, are the same as a standard
25 ansi encoding. Also, no ansi character appears in any multi-byte
26 characters. So, you can use standard C functions like strlen, and strcpy
27 just fine with UTF-8 encoded strings. For example: "OK\n" encoded in UTF-8 is
28 simply "OK\n". For more information on UTF=8:
29 http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 )
34 A command returns "OK\n" on completion or "ACK some error\n" on failure.
35 These denote the end of command execution.
40 For manipulating playlists and playing, there are two sets of commands. One
41 set uses the song id of a song in the playlist, while another set uses the
42 playlist position of the song. The commands using song id's should be used
43 instead of the commands that manipulate and control playback based on playlist
44 position. Using song id's is a safer method when multiple clients are
51 add the file _path_ to the playlist (directories add recursively)
52 _path_ can also be a single file
53 increments playlist version by for each song added
56 clears the current playlist
57 increments playlist version by 1
60 clear the current error message in status
61 (this is also accomplished by any command that starts playback)
64 close the connection with the MPD
66 crossfade <int seconds>
67 sets crossfading between songs
70 displays the song info of current song (same song that is identified
74 delete _song_ from playlist
75 increments playlist version by 1
78 delete song with _songid_ from playlist
79 increments playlist version by 1
81 find <string type> <string what>
82 finds songs in the db that are exactly _what_
83 _type_ should be "album", "artist", or "title"
84 _what_ is what to find
89 list <string type> <string arg1>
90 list all tags of _type_
91 _type_ should be "album" or "artist"
92 _arg1_ is an optional parameter when type is album, this specifies
93 to list albums by a artist, where artist is specified with
97 lists all songs and directories in _path_ (recursively)
98 _path_ is optional and maybe a directory or path
100 listallinfo <string path>
101 same as listall command, except it also returns metadata info
102 in the same format as lsinfo
105 loads the playlist _name_.m3u from the playlist directory
106 increments playlist version by the number of songs added
108 lsinfo <string directory>
109 list contents of _directory_, from the db. _directory_ is optional
111 move <int from> <int to>
112 move song at _from_ to _to_ in the playlist
113 increments playlist version by 1
115 moveid <int songid> <int to>
116 move song with _songid_ to _to_ in the playlist
117 increments playlist version by 1
120 plays next song in playlist
123 toggle pause/resume playing
124 _pause_ is required and should be 0 or 1
125 NOTE: use of pause command w/o the _pause_ argument is deprecated
127 password <string password>
128 this is used for authentication with the server.
129 _password_ is simply the plaintext password
132 does nothing but return "OK"
135 begin playing playlist at song number _song_, _song_ is optional
138 begin playing playlist at song with _songid_, _songid_ is optional
141 displays the current playlist
142 NOTE: do not use this, instead use 'playlistinfo'
144 playlistinfo <int song>
145 displays list of songs in the playlist
146 _song_ is optional and specifies a single song to display info for
148 playlistid <int songid>
149 displays list of songs in the playlist
150 _songid_ is optional and specifies a single song to display info for
152 plchanges <playlist version>
153 displays changed songs currently in the playlist since
155 NOTE: to detect songs that were deleted at the end of the playlist,
156 use playlistlength returned by status command.
158 plchangesposid <playlist version>
159 displays changed songs currently in the playlist since
161 This function only returns the position and the id of the changed song, not the complete metadata. This is more bandwidth efficient.
162 NOTE: to detect songs that were deleted at the end of the playlist,
163 use playlistlength returned by status command.
166 plays previous song in playlist
169 set random state to _state_, _state_ should be 0 or 1
172 set repeat state to _state_, _state_ should be 0 or 1
175 removes the playlist <name>.m3u from the playlist directory
178 saves the current playlist to _name_.m3u in the playlist directory
180 search <string type> <string what>
181 searches for any song that contain _what_
182 _type_ can be "title","artist","album", or "filename"
183 search is not case sensitive
185 seek <int song> <int time>
186 seeks to the position _time_ (in seconds) of entry _song_ in the
189 seekid <int songid> <int time>
190 seeks to the position _time_ (in seconds) of song with _songid_
194 _vol_ the range of volume is 0-100
197 shuffles the current playlist
198 increments playlist version by 1
202 artists: number of artists
203 albums: number of albums
204 songs: number of songs
205 uptime: daemon uptime in seconds
206 db_playtime: sum of all song times in db
207 db_update: last db update in UNIX time
208 playtime: time length of music played
211 reports current status of player, and volume level.
214 playlist: (31-bit unsigned integer, the playlist version number)
215 playlistlength: (integer, the length of the playlist)
216 state: ("play", "stop", or "pause")
217 song: (current song stopped on or playing, playlist song number)
218 songid: (current song stopped on or playing, playlist songid)
219 time: <int elapsed>:<time total> (of current playing/paused song)
220 bitrate: <int bitrate> (instantaneous bitrate in kbps)
221 xfade: <int seconds> (crossfade in seconds)
222 audio: <int sampleRate>:<int bits>:<int channels>
223 updatings_db: <int job id>
224 error: if there is an error, returns message here
229 swap <int song1> <int song2>
230 swap positions of _song1_ and _song2_
231 increments playlist version by 1
233 swapid <int songid1> <int songid2>
234 swap positions of of songs with song id's of _songid1_ and _songid2_
235 increments playlist version by 1
238 searches mp3 directory for new music and removes old music from the db
239 _path_ is an optional argument that maybe a particular directory or
242 updating_db: <int job id>
243 where job id, is the job id requested for your update, and is displayed
244 in status, while the requested update is happening
245 increments playlist version by 1
246 NOTE: To update a number of paths/songs at once, use command_list,
247 it will be much more faster/efficient. Also, if you use a
248 command_list for updating, only one update_db job id will be returned
249 per sequence of updates.
252 change volume by amount _change_
253 NOTE: volume command is deprecated, use setvol instead
258 To facilitate faster adding of files, etc, you can pass a list of commands all
259 at once using a command list. The command list beings with:
265 command_list_ok_begin
271 It does not execute any commands until the list has ended. The return
272 value is whatever the return for a list of commands is. On success
273 for all commands, OK is returned. If a command fails, no more commands
274 are executed and the appropriate ACK error is returned. If "command_list_ok_begin is used", "list_OK\n" is returned for each successful command executed