Jury - MP3 Jukebox in Python


About a year ago, I finally finished the process of encoding my entire CD collection into MP3 format, which made it very convenient to listen to anything I wanted on my PC. However, I soon realised it would be even better if I could play any of the music from my normal living room hi-fi system rather than searching for CDs or having to switch on the cumbersome, noisy PC in the corner.

I decided that a custom-made Jukebox was in order. I'll write about the hardware another time, but it basically consists of a diskless (and hence noiseless) PC in a smart-looking case with a flat panel screen attached. For the software, I thought I could use one of the many pieces of jukebox software that already existed, and I spent some time evaluating all sorts of packages. However, they all turned out to be unsuitable, mostly because they were too feature-rich and complex, sometimes because they couldn't handle enough music files, and all too often because they appeared to be designed by someone who thought vi was a paragon of usability.

I narrowed my requirements down to the following:

Notice that there's nothing in there about playlists, shuffle play, time/frame readouts, file management, CD ripping, or any of the other advanced features I've found in other jukeboxes. If I want those, then I boot up a bigger PC and run different software.

I had a couple of days to write the software while I was suffering from the 'flu, so it's no tour de force of software engineering, but I'm still using it and happy with it a year later, so there must be something right about it. More to the point, when visitors come to the house, they can walk up to it and play music without serious tuition.

The Software

The software is divided into two parts: one which runs through your collection of MP3 files and creates a sorted index, and another which is the actual player, which uses that index. It's almost entirely written in Python, apart from a couple of bits of Bash shell script.

There was no point in reinventing the wheel as far as handling MP3 files went, so I used a couple of pre-existing pieces of software for this. They are mp3info, for reading the ID3 tags out of MP3 files, and mpg123, for actually playing them.

The user interface is designed to be easy to use. Here's a screen shot:

Jury screenshot

As you can probably see, it consists mostly of a simple scrolling list of tracks. I chose to sort them by artist, then by album, then by CD track number, because that suits the way I listen to music. The panel at the top of the screen shows the full details of the selected track, and the panel at the bottom shows the current status of the program.

It's all controlled by the keyboard. The important keys are:

In addition, typing any alphanumeric key searches for the artist beginning with that character. Typing another character within 2 seconds narrows the search to the artist beginning with both characters, and so on. In this way it's quick and easy to find any artist just by typing the beginning of its name.

The selected track is shown highlighted in reverse video white, whilst the playing track (if any) is displayed in green.


To get Jury running, you'll need to install:

You'll need to park the files from the downloaded tarfile somewhere suitable. Mine happen to sit in /home/mp3/jury.

Create the directory /usr/local/lib/jury and make sure it's writable by whoever's going to create the index.

Configure the indexing program by telling it where your MP3 files live. There's a line near the top of mp3dog.py which reads


Change this to reflect your local setup. It's in Python list format, so if you wanted to add more than one directory (remembering that it will include all the subdirectories automatically), you'd use something like:


Now run mp3index and let it do its thing. It'll probably spit out various messages if it encounters files with no ID3 tags in them, but it will also more usefully print a running total of the number of files it's processed.

Now you're ready to run the player. Just run jury and you should be in business.


Jury makes all sorts of unreasonable assumptions about your system. Amongst these are:

There are a couple of features of mpg123 and mp3info which you might come across:

Naturally, this software is supplied completely without warranty. If it deletes all your music and sets your PC on fire don't say I didn't warn you. It works for me. That's all.


Here's the file, in all its glory.

jury-1.0.tgz (4464 bytes)

Let me know you get on at chris@stumpie.com.

Chris Jones, 7 November 2002