My Web-Based MP3 Player System

by Billy Biggs <>, 19 Feb 2004


I have always used xmms for playing MP3s, although I have also tried rhythmbox and really liked it. However, neither had the ideal UI for me. I like the idea of some modern PVR systems and web interface MP3 players, but many require either a database or ID3 tags on my entire collection. So I decided to design my own system. My goals were as follows:

  1. I have a strict filename scheme for my MP3s and do not use ID3 tags. The system should be based on filenames for tracks and directory names for albums.
  2. I do not care about playlists. I just want to play albums as if I had put the CD in my CD player.
  3. My collection is over 70 gigabytes stored across three discs. I need to have my album list sorted independent of location.
  4. I want to easily rename tracks or albums, move files or add new albums without having to update a lot of state.


The system I designed was simple and took only a few hours to implement. I am extremely happy with it. Here is how it works:

  1. A daemon written in perl plays the MP3s and is controlled entirely by the filesystem. For example, touch /mp3/control/stop instructs the script to stop, and touch /mp3/control/skip instructs it to go to the next track. You give the script a directory and it plays that directory as an album.
  2. Two php scripts. One for the album list, one for the controller. They do the appropriate touch'ing of files to control the player.
  3. An album list. This is simply the output of find /mp3 -type d. Each album is a directory. NFS handles the multiple-disc/machine abstraction. The album list is sorted by a php script, and takes care of "The "-prefixed artist names nicely.
  4. The web server is running on a spare machine which now has an alias of mp3 (http://mp3/). It touches and reads the files it needs over NFS, so the player can run independent of the web interface.


  1. The controller page. The track information is all gathered from files output by the perl script for which track and album it is currently playing.
  2. The album list. Clicking on an album starts playing it. Perfect.

Source code

The source code for my system is here

  1. mp3player-0.1.tar.gz, 20 Feb 2004