Recent changes Random page
GAMING
Technology
 
Gaming
Entertainment
Science Fiction
Biggest wikis
Hobbies
Music
See more...

MPDDownloadProtocol

From Music Player Daemon Community Wiki

Jump to: navigation, search

Note: this page only exists for historical reasons. This (mis)-feature will never be accepted into mpd because it directly conflicts with What_MPD_Is_and_Is_Not.


This protocol is implemented in this patch. It adds the command

download <string filename>:

Send the file _filename_ to the client. This allows clients to fetch songs and playlists from MPD's databse. _filename_ should be either a file name relative to the music directory or an absolute file name starting with "/playlist/" in which case the rest of the file name is interpreted as being relative to the playlist directory.

The file's content is sent with the following encoding: every line is preceded by a ">" and the last byte is followed by a "\n". This ensures that the final OK\n stands on its own line and that none of the file's data can be confused for a command termination.

Why not just tell the client what the length is? Something like:

filesize: 41987109
filedata: [file data here, with length of exactly <filesize>]
OK

This seems less annoying than parsing of >'s and \n's.

It also avoids the situation where the data actually happens to contain "\nOK\n" (0a4f4b0a). This may not be very likely but it is certainly not impossible.

Rate this article:
Share this article: