Music Player Daemon

I have finally been able to ditch the crash-fest that is known as xmms, several times in the past year I’ve looked for alternatives to it but nothing ever seemed to be able to meet my requirements. It’s not like I’m looking for anything esoteric, all I want is

  1. ESD output
  2. support for mp3, ogg, flac and m3u playlists
  3. no KDE dependencies (I use Gnome)
  4. controllable from the keyboard and lirc
  5. and most important of all STABLE

Yet, try as I might I couldn’t find something that did these things better than xmms despite the fact thaat xmms would crash at least once a day.

But now I have found Music Player Daemon (MPD), or rather I’ve found that it does ESD output even though the documentation makes no mention of it. If the bloody manpage had just told me it was supported instead of implying that only OSS and ALSA were possible I would have switched months ago when I first looked at it, bah. Anyway, I have keyboard and lirc control by setting up shortcuts for running mpc with various args, a gui in gmpc (ugly though it is) and even an applet to sit on my menu bar. Oh and a plugin for last.fm, well it’s really a client not a plugin but it doesn’t sound right calling it that.

There is one minor irritation with MPD, it makes a database of your songs and uses that to reference the files rather than filesystem paths. Now I have all my music under one dir so it’s not a huge hassle, but it was a bit irritating until I saw a little python script on the wiki to play files from anywhere on the system. Wasn’t quite what I wanted but it showed me the way and tada:

#!/usr/bin/env python

import os
import sys

mpdRoot = ‘/mnt/data/Music’

if not len(sys.argv) > 1:
    print >>sys.stderr, ‘Usage:\n%s <files>’ % sys.argv[0]
    sys.exit(1)

def still_updating():
    return ‘Updating DB’ in os.popen(‘mpc’).read()

links = []
for file in sys.argv[1:]:
    if os.path.isabs(file):
        full = file
    else:
        full = os.path.join(os.getcwd(), file)

    filepath = os.path.realpath(full)
    pre = os.path.commonprefix( [filepath, mpdRoot] )

    #print pre
    head =
    remain = filepath[len(pre)+1:]
    links.append(remain)

#print links
os.system(‘mpc clear’)
os.system(‘mpc update’)
while still_updating():
    pass

for link in links:
    #print ‘os.system(mpc add "%s")’ % link
    os.system(‘mpc add "%s"’ % link)
os.system(‘mpc play’)