Media Player Daemon

Mike Massonnet | Posted 1 month, 4 days ago on April 10, 2006

Still listening to your music with some classical players? By classical I mean those which lets you browse your directories to fill the playlist, or even those which makes their own databases. A database makes life easier to search artists, songs and albums. But what can a database be good for when it can only be refreshed by the player which created it.

I say STOP!

MPD is what everyone is looking for, a daemon player. With it you can have hundred of clients to manage the playlists. Those clients can be graphic, command-line, WAP, Web, written in C, C++, Java, XUL, Python, PHP... You can go from one client to another, you can run several clients at the time, the music will always be played, even if you close the clients. So? Just manage your music, make your playlist, leave the client unlike to let a player idle in the taskbar or in the systray. You need to quit X? Don't be worried about your music, it will still be played!

Install the daemon

Fetch MPD like you do usually, aptitude install mpd was the trick for me. MPD can be downloaded from the website/download.

Configuration

The default configution file is located at /etc/mpd.conf. This one is mine:

# required
playlist_directory "/var/lib/mpd/playlists"
music_directory    "/home/mike/music"
port               "6600"
log_file           "/var/log/mpd/mpd.log"
error_file         "/var/log/mpd/errors.log"

# optional, but HIGHLY RECOMMENDED
db_file            "/var/lib/mpd/mpddb"
user               "mpd"

# optional, but recommended
state_file         "/var/lib/mpd/state"

man for mpd if you want to see all config options.

I set the user to mpd. This way he runs the daemon, he writes its database and logs and he don't touch to other files, like my music :-) Of course others can read my music.

The clients

There are a lot of clients available at MPD's wiki and at website/clients.

I selected ncmpc, gmpc, ajaxmp and mpc. They are respectively an ncurses, a GTK+, a web and a command line interfaces.

ncmpc

http://hem.bredband.net/kaw/ncmpc/

Really simple and good designed to ssh on your jukebox. Press h, F1 or 1 for help.

ncmpc

gmpc

http://cms.qballcow.nl/index.php?page=Gnome_Music_Player_Client

Still simple and nice, it also adds an icon in the systray which pops up the currently played track on every change. This behavour is configurable of course.

gmpc

ajaxmp

http://mroyer31.hd.free.fr/dokuwiki/doku.php

A web application written in PHP and JavaScript for the hippy things like refreshing the information of the played track without blinking all the browsers' screen. Yes! It is done with xmlhttprequests :) There are features presents like drag and dropping songs over the playlist. It will work with Gecko browsers, don't even think about KHTML...

This application can optionnaly handle user accounts. It can be disabled by commenting the $auth_config array in the configuration (config/config.php). And a last word about it, only one theme is available and contributions are welcome :)

ajaxmp

mpc

http://www.musicpd.org/mpc.shtml

It is a fast and lighweight command line tool making it ideal for scripting commands and bindings to hotkeys, like the multimedia keys ;)

mpc help to get the command list.

Earlier posts