2004-02-24 00:41:20 +01:00
Music Player Daemon - Commands
This document is intended for client developers, not end users.
Format:
-------
If arguments contain spaces, they should be surrounded by double quotation
2004-03-14 17:57:29 +01:00
marks, ".
2004-02-24 00:41:20 +01:00
command <type arg1> <type arg2> ...
explanation: w/ arg1 and arg2
2004-03-14 17:57:29 +01:00
All data between the client and server is encoded in UTF-8. (Note,
that in UTF-8 all standard ansi characters, 0-127, are the same as a standard
ansi encoding. Also, no ansi character appears in any multi-byte
characters. So, you can use standard C functions like strlen, and strcpy
just fine with UTF-8 encoded strings. For example: "OK\n" encoded in UTF-8 is
simply "OK\n". For more information on UTF=8:
http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 )
2004-02-24 00:41:20 +01:00
Command Completion:
-------------------
A command returns "OK\n" on completion or "ACK some error\n" on failure.
These denote the end of command execution.
Commands:
---------
2004-02-26 04:36:04 +01:00
add <string path>
add the file _path_ to the playlist (directories add recursively)
_path_ can also be a single file
increments playlist version by for each song added
2004-02-24 00:41:20 +01:00
clear
clears the current playlist
2004-02-25 01:14:27 +01:00
increments playlist version by 1
2004-02-24 00:41:20 +01:00
clearerror
clear the current error message in status
(this is also accomplished by any command that starts playback)
close
close the connection with the MPD
2004-02-24 17:48:52 +01:00
crossfade <int seconds>
2004-02-27 02:37:17 +01:00
sets crossfading between songs
2004-02-24 17:48:52 +01:00
2004-02-24 00:41:20 +01:00
delete <int song>
delete _song_ from playlist
2004-02-25 01:14:27 +01:00
increments playlist version by 1
2004-02-24 00:41:20 +01:00
find <string type> <string what>
finds songs in the db that are exactly _what_
_type_ should be "album", "artist", or "title"
_what_ is what to find
kill
kill MPD
list <string type> <string arg1>
list all tags of _type_
_type_ should be "album" or "artist"
_arg1_ is an optional parameter when type is album, this specifies
to list albums by a artist, where artist is specified with
arg1
2004-02-26 04:48:59 +01:00
listall <string path>
lists all songs and directories in _path_ (recursively)
_path_ is optional and maybe a directory or path
2004-02-24 00:41:20 +01:00
2004-02-26 04:48:59 +01:00
listallinfo <string path>
2004-02-24 17:48:52 +01:00
same as listall command, except it also returns metadata info
in the same format as lsinfo
2004-02-24 00:41:20 +01:00
load <string name>
loads the playlist _name_.m3u from the playlist directory
2004-02-25 01:14:27 +01:00
increments playlist version by the number of songs added
2004-02-24 00:41:20 +01:00
lsinfo <string directory>
list contents of _directory_, from the db. _directory_ is optional
move <int from> <int to>
move song at _from_ to _to_ in the playlist
2004-02-25 01:14:27 +01:00
increments playlist version by 1
2004-02-24 00:41:20 +01:00
next
plays next song in playlist
2004-02-25 01:14:27 +01:00
pause <bool pause>
toggle pause/resume playing
_pause_ is optional and should be 0 or 1
2004-02-24 00:41:20 +01:00
2004-02-24 17:48:52 +01:00
password <string password>
this is used for authentication with the server.
_password_ is simply the plaintext password
ping
does nothing but return "OK"
2004-02-24 00:41:20 +01:00
play <int song>
begin playing playlist at song number _song_, _song_ is optional
playlist
displays the current playlist
NOTE: do not use this, instead use 'playlistinfo'
2004-04-16 06:20:28 +02:00
playlistinfo <int song>
displays list of songs in the playlist
_song_ is optional and species a single song to displa info for
2004-02-24 00:41:20 +01:00
2004-06-05 18:01:44 +02:00
plchanges <playlist version>
displays changed songs currently in the playlist since
_playlist version_
2004-02-24 00:41:20 +01:00
previous
plays previous song in playlist
random <int state>
set random state to _state_, _state_ should be 0 or 1
repeat <int state>
set repeat state to _state_, _state_ should be 0 or 1
rm <string name>
removes the playlist <name>.m3u from the playlist directory
save <string name>
saves the current playlist to _name_.m3u in the playlist directory
search <string type> <string what>
2004-04-20 00:50:13 +02:00
searches for any song that contain _what_
_type_ can be "title","artist","album", or "filename"
2004-02-24 00:41:20 +01:00
search is not case sensitive
seek <int song> <int time>
seeks to the position _time_ (in seconds) of entry _song_ in the
playlist
2004-02-24 02:37:42 +01:00
setvol <int vol>
set volume to _vol_
2004-02-25 05:10:16 +01:00
_vol_ the range of volume is 0-100
2004-02-24 02:37:42 +01:00
2004-02-24 00:41:20 +01:00
shuffle
shuffles the current playlist
2004-02-25 01:14:27 +01:00
increments playlist version by 1
2004-02-24 00:41:20 +01:00
stats
display stats
artists: number of artists
albums: number of albums
songs: number of songs
uptime: daemon uptime in seconds
2004-02-27 16:40:54 +01:00
db_playtime: sum of all song times in db
2004-02-24 00:41:20 +01:00
db_update: last db update in UNIX time
playtime: time length of music played
status
reports current status of player, and volume level.
volume: (0-100).
repeat: (0 or 1)
playlist: (31-bit unsigned integer, the playlist version number)
playlistlength: (integer, the length of the playlist)
state: ("play", "stop", or "pause")
song: (current song playing/paused, playlist song number)
time: <int elapsed>:<time total> (of current playing/paused song)
bitrate: <int bitrate> (instantaneous bitrate in kbps)
2004-02-27 02:37:17 +01:00
xfade: <int seconds> (crossfade in seconds)
audio: <int sampleRate>:<int bits>:<int channels>
2004-04-11 13:52:29 +02:00
updatings_db: <int job id>
2004-02-24 00:41:20 +01:00
error: if there is an error, returns message here
stop
stop playing
swap <int song1> <int song2>
swap positions of _song1_ and _song2_
2004-02-25 01:14:27 +01:00
increments playlist version by 1
2004-02-24 00:41:20 +01:00
2004-04-11 19:42:47 +02:00
update <string path>
2004-02-24 00:41:20 +01:00
searches mp3 directory for new music and removes old music from the db
2004-04-11 19:42:47 +02:00
_path_ is an optional argument that maybe a particular directory or
song/file to update.
2004-04-11 13:52:29 +02:00
returned:
updating_db: <int job id>
where job id, is the job id requested for your update, and is displayed
in status, while the requested update is happening
2004-03-10 11:01:24 +01:00
increments playlist version by 1
2004-04-11 19:42:47 +02:00
NOTE: to update a number of paths/songs at once, use command_list,
it will be much more faster/effecient
2004-02-24 00:41:20 +01:00
volume <int change>
change volume by amount _change_
2004-02-24 02:37:42 +01:00
NOTE: volume command is deprecated, use setvol instead
2004-02-24 00:41:20 +01:00
COMMAND LIST
------------
To facilitate faster adding of files, etc, you can pass a list of commands all
at once using a command list. The command list beings with:
command_list_begin
2004-06-05 18:01:44 +02:00
or:
command_list_ok_begin
2004-02-24 00:41:20 +01:00
And ends with:
command_list_end
It does not execute any commands until the list has ended. The return
value is whatever the return for a list of commands is. On success
for all commands, OK is returned. If a command fails, no more commands
2004-06-05 18:01:44 +02:00
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
in the command list.