What is librmpd?

librmpd is a simple yet powerful Music Player Daemon library written entirely in Ruby. It provides callback functionality to create an event/listener type of setup, along with thread safety for threaded apps.

What does that mean?

It means, dear reader, that you can write (and test!) your own MPD client quickly and easily through the power of Ruby.

Using the library is as easy as creating an object. The MPD class provides methods to interact with the server, as well as the ability to register callbacks. These callbacks are methods that you provide to the MPD class. When something happens that is relevant to the callback, it gets called.

This is a powerful mechanism that allows for things such as playlist changes, playback changes, volume changes, etc all to be reflected in your client as soon as they happen

Unit Tests

I mentioned earlier the ability to test your own MPD client after writing it. Thanks to a 'fake' MPD server included in librmpd, it's easy to write unit tests using a known configuration.

This server implements ONLY the client/server communication protocol, and fakes the rest. The songs database is supplied through an easily modifiable YAML file. As far as your client is concerned, this fake server behaves just like a normal MPD server, only you control it's setup. Now you can test to ensure your client has the correct list of Artists or Songs, something that was previously tied to a user's setup.

More Info

Read the README above to get a better overview of librmpd. Then have a look at the RDoc pages here

Download

You can find the stable, released versions of librmpd here, or you can check out the bleeding edge SVN version here

Installing

Simple, if you use gems (and why wouldn't you?) just download the .gem release file and run (as root)

#> gem install librmpd-X.Y.Z.gem

If you want to run the included tests (WARNING: can take several minutes!) then run

#> gem install librmpd-X.Y.Z.gem -t

You can also download the zip/tgz files if you only want the test server or to including librmpd.rb in a client of your own.