On July 26th 2009, my Family decided to get rid of the TV that was in our living room. It was a nice enough TV, it worked and was used on a daily basis, but we had been without it for a solid week while we did some flooring upgrades and found that we didn’t miss it at all. In fact, my wife started to read more, my son started to play on his own more and I…. well I don’t really watch much TV so I just continued as usual. The one thing we did find ourselves missing was music. We’ve had a MythTV frontend hooked to the TV for many years now and used the MythMusic plugin fairly regularly to shuffle through our tunes and provide nice dinner music. My solution was to make a headless, low power PC that runs 24×7 and has a web based remote control.
The Hardware
I wanted to use something like a WRT54G or an NSLU2, but I don’t have either of those. What I did have was an Ingrian i10 Edgesecure appliance which is just a MiniITX board in a small case with a DC-DC power supply. The board inside had it’s BIOS replaced with a custom version that would immediately jump to netbooting, but I didn’t really feel like setting up an NFS root and BOOTP. So out comes the Via C3 board and in goes a Via C7 board that I had. Odd note on the C7, the board has two 10/100 NICs on it, has a hardware crypto engine, is clearly designed for networking but for some reason they decided to install NICs that don’t have hardware 802.1q support. WTH?
Getting it Booted
Short of netbooting, I figured my best option was to use a USB thumbdrive install. I didn’t want to have any moving parts if I could avoid it and while I have some IDE to CF/SD Card adapters, they have a lot of DMA issues and are slow. I had a Lexra 4Gig Firefly drive laying around though, so I downloaded unetbootin and did a network install of ubuntu 9.04. Yes, a full distro is overkill but I wanted to get this done quickly to help cement the passage of the TV. I allowed the installer to partition the drive itself and then did a base xubuntu install. It took awhile since it was pulling down software from the internet, but a few hours later it was booted up and sitting at a login prompt.
The Software
MPD was pretty much made for this exact purpose. It’s a small daemon that can output to a soundcard or a network stream and can be remote controlled from a client over the network. Install was really simple
apt-get install mpd mpc ncmpc
mpc is a command line utility that lets you control mpd and ncmpc is an ncurses based utility to do the same. The configuration of MPD is pretty basic, just edit the mpd.conf. I only really had to change two settings. I moved the bind address from 127.0.0.1 to 0.0.0.0 so I could connect to it over the network and I enabled zeroconf because, I don’t know why I did that to be honest.
Next is the web frontend. Dozens of clients exist for mpd, but I wanted something that was lightweight, web based and didn’t require a lot of dependencies. I’m still hoping to move this all over to an NSLU2 if an NSLU2 fairy should happen to drop me one of those little dudes. After lots of trial and error, I selected Relaxx as my player of choice. It’s small and only requires a web server that supports PHP. I started to use lighttpd, but decided to just apt-get apache instead. The install was pretty simple
apt-get install apache php5
and then just untar and copy the contents of Relaxx into /var/www/ and browse to the jukebox using firefox.
Using it
Relaxx lets you create and modify play lists. I used Relaxx to create three playlists, Everything, Bedtime and Dinner. Dinner is full of Bob Marley, Aretha Franklin, etc. Bedtime is mostly classical and Everything is, well, everything. I then put a cron job on the jukebox that says at 17:30 every night, load up the Dinner play list, then at 18:30, switch back to everything. At 21:00 switch to bed time and at 23:00, the box powers off. When 0650 rolls around, my firewall sends a WOL packet to the jukebox to bring it online and it starts to play the Everything play list. If it hasn’t woke up by 0700, a BIOS wake up event wakes it up. All in all, this little dude is working out great. I have almost a gig of space free on the thumbdrive and the CPU usage is minimal. The music follows the time of day and the whole system is very easy to modify or upgrade.