MPD Protocol
Version 0.11.0
2004
Warren Dukes
Protocol Outline
The MPD Protocol has Three Components: Commands, Responses, and Command Lists. All communication between the client and server uses the UTF-8 character encoding.
Format of Commands
Commands in MPD are specified begginning with the name of the command. The arguments of a command are delimitted by spaces and should be surrounded by double qutotation marks. The end of a command is delimitted by a return character '\n'.command "arg1" "arg2"
Format of Responses
The different response elements of a command are seperated by the return character '\n'. The last element of a response begin with either OK or ACK. Thus, if a command is successful, the end of the response is OK\n. If a command is unsuccessful ACK terminates the command with the following format:ACK {err#:cmd#} {command} some error messageerr# is an integer indicating the specific error that occured and cmd# is an integer indicating which command of the command list caused the error (See section 1.3 for more info on Command Lists). command gives the name of the command the error occurred on; however, its intended more for debugging persons (for human readability). some error message is also not intended to be parsed by clients but is intended more for debugging purposes.
The other response elements are data. The data is seperated into a name and value pare by : . Thus, a possible command response containing data would be:Name1: Value1
Name2: Value2
OK
Command Lists
Command lists allow for a fast, effecient, and atomic execution of multiple commands. Command lists are initiated with either command_list_begin or command_list_ok_beginand are terminated with command_list_end.command_list_begin
command1 arg1 arg2
command2 arg1 arg2
command3 arg1 arg2
command_list_end
The responses for command executed with command lists are the same with the exception that anOK or ACK is not returned for each command. Instead a single OK or ACK is returned for the entire command list. An OK indicates that all the commands in the command list were successfully executed; while an ACK error is returned on the first unsuccessful command in the command list and none of the following commands in the command are executed.
command_list_ok_begin responds with list_OK after each command is successfully completed. command_list_begin does not return anything between each command that is executed.
Commands
DB: Browsing, Searching, and Finding
Browsing Responses
Browsing Responses usually contain groups of several responses. These groups are either begin with file, directory, or playlist. Each of these response groups maybe followed by metadata, which always begin with a capital letter (A-Z). Here's an example of a complete browsing response:file: Directory/file.mp3
Artist: Muscian
Album: Record
Time: 23
directory: Directory/Subdirectory
playlist: Directory/favorites
OK
directory and playlist have no metadata, however future versions of the MPD protocol may add metadata to either. Also, future versions of MPD may add othe response groups for browsing.
Song Info Responses
For query information on songs in the db (and the playlist), there is a common response for each song. The first response element is file. The remainng elements of the song info are one of the following metadata types: Artist, Album, Title, Track, Name, or Time.
lsinfo
listall
search
find
list
Playlist: Adding, Deleting, and Managment
Additional Song Metadata
Song ID's vs Playlist Position
playlistinfo
playlistid
plchanges
deleteid
delete
add
moveid
move
swapid
swap
clear
save
shuffle
rm
Status Queries
status
Playback: Play, Pause, Stop, and Seek
playid
play
pause
stop
seekid
seek
repeat
random
Miscellanous Commands
password
stats
kill
ACK Errors
Common Errors
Command Specific
Guidelines