libmpd-haskell is a client library for MPD. It exposes all of MPD's commands in a nice Haskell-style interface. API documentation is here. The latest release is available at Hackage.
You can use Hugs or a recent GHC. Instructions are in the README.
Start up GHCi in the libmpd-haskell directory and load the library:
> :l Network.MPD
List the contents of the top level of your music repository:
> withMPD $ lsInfo "" Right [Left "Tool",Left "Tom Waits",Left "The Who",Left "The Tea Party"...
List the contents of another directory:
> withMPD $ lsInfo "Tom Waits" Right [Left "Tom Waits/Mule Variations",Left "Tom Waits/Big Time",Left ...
Add a directory of music to the current playlist:
> withMPD $ add "" "Tom Waits/Big Time" Right ["Tom Waits/Big Time/01 - 16 Shells from a Thirty-Ought-Six.mp3",...
Start or continue playing and display the playing song:
> withMPD $ play Nothing >> currentSong
Right (Just (Song {sgArtist = "Tom Waits", sgAlbum = "Big Time", sgTitl...
To get the latest sources you will first need darcs. Once that's installed, type at a command prompt:
darcs get http://turing.une.edu.au/~bsinclai/code/libmpd-haskell
To update your repository, enter
the libmpd-haskell directory and type:
darcs pull
The repository can be browsed online and code coverage details are kept here.
The developers hang out at #libmpd-haskell on irc.freenode.net, drop by if you need help with anything.