MPD ProtocolVersion 0.11.02004Warren DukesProtocol OutlineThe 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 CommandsCommands 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 ResponsesThe 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
OKCommand ListsCommand 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_endThe 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.CommandsDB: Browsing, Searching, and FindingBrowsing ResponsesBrowsing 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
OKdirectory 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 ResponsesFor 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.lsinfolsinfo
lsinfo directory
lsinfo filelsinfo responds with info for the directory or file specified. If lsinfo is called without any arguments then the root directory is implied as the path.listallinfolistallinfo
listallinfo directory
listallinfo filelistallinfo is a recursive form of
lsinfo
listalllistall
listall directory
listall filelistall is the same as
listallinfo
except that no metadata is returned.searchsearch filename pattern
search artist pattern
search album pattern
search title patternsearch respnds with the files that match the specified pattern with the specified data (either filename, artist, album, or title).findfind artist match
find album matchfind responds with the files whose artist or album are the same as match.listlist artist
list album
list album someArtistlist responds with the list of albums or artists in the db.Playlist: Adding, Deleting, and ManagmentAdditional Song MetadataSong ID's vs Playlist Positionplaylistinfoplaylistinfo
playlistinfo -1
playlistinfo positionplaylistidplaylistid
playlistid -1
playlistid idplchangesplchanges versiondeleteiddeleteid iddeletedelete positionaddadd file
add urlmoveidmovid idmovemove positionswapidswapid idswapswap positionclearclearsavesaveshuffleshufflermrmStatus QueriesstatusstatuscurrentsongcurrentsongPlayback: Play, Pause, Stop, and Seekplayidplayid
playid -1
playid idplayplay
play -1
play positionpausepause 0
pause 1stopstopseekidseekid idsecondsseekseek positionsecondsrepeatrepeat 0
repeat 1randomrandom 0
random 1Miscellanous Commandspasswordpassword psswdstatsstatskillkillACK ErrorsCommon ErrorsCommand SpecificGuidelines