how does he do that?

Someone asked how the automatic podcast works. It’s a bit complex, and they probably will be sorry they asked.

I have all my music saved as MP3s on a server running Firefly Media Server. It stores all its information about tracks in a SQLite database, so I can very easily grab a random selection of tracks.

Since I know the name of the track and the artist from the Firefly database, I have a selection of script lines that I can feed to flite, a very simple speech synthesizer. Each of these spoken lines is stored as as wav file, and then each candidate MP3 is converted to wav, and the whole mess is joined together using SoX. SoX also created the nifty (well, I think so) intro and outro sweeps.

The huge wav file of the whole show is converted to MP3 using LAME and uploaded to my webhost with scp. All of this process is done by one Perl script – it also creates the web page, the RSS feed, and even logs the tracks on Last.fm.

Couldn’t be simpler.

the little computer that should

My home server went phut last week. There was a brief power outage, and everything else came back on — except the server. It was a three year old Mini-ITX box, and I’m casting about for ways to replace it.

To serve my immediate music serving and podcasting needs, I have pressed The Only Computer That Runs Windows into service, running Ubuntu using Wubi. Unfortunately, I do still occasionally need to run Garmin Mapsource, which only runs on Windows, and also The Only Computer That Runs Windows is also rather too nice a laptop to be sat doing server duty.

I have some options:

  • Get a new motherboard for the mini-itx box. Via still has some crazy ideas about pricing (over $200 for a fanless C7?) but maybe I’ll go for Intel’s snappily-named D945GCLF, which looks okay for what I need and is only $80.
  • I could resurrect the old Athlon box I got in 2002, but it’s big, loud, and its components are probably near end of life. Also, why disturb a mature spider habitat?

What I was really looking for was one of those tiny fanless internet appliance boxes that were so 2007 (like the Koolu and the Zonbu, both of which have moved on to other things), but such units, without the tied storage service contract, are upwards of $500.

My needs are simple:

  • run Firefly to feed the Soundbridges;
  • generate the automatic podcast every day, which realistically means a linux box with Perl, sqlite and the like;
  • have something to ssh into when boredom strikes the need arises. Perhaps unwise having an open machine sitting directly on the internet, but only the ssh port will be open.

I really also need to get rid of all the computer junk in the basement. It now includes two fritzed mini-ITX systems and the world’s slowest PostScript laser printer. Such fun.

cleaning up your FireFly Media Server database

mp3 tagging is a minefield. Like all metadata, one has to balance obsession with detail against ease of acquisition.

Some Firefly clients are pickier than other about tagging. Regrettably, some of the music I get from emusic has bad characters in the tags, which throws the players right off. Finding the problem files is the majority of the problem – here’s a method that at least helps:
wget -O- http://host:port/rsp/db/1 | perl -pwe 's,<(?![/\?]),\n<,g;' > firefly.xml
xmllint --noout firefly.xml

You’ll likely get a few lines like:

firefly.xml:463415: parser error : PCDATA invalid Char value 65535
<title>�Singing in the Bathtub</title>

In this case, the song title tag has some junk characters in it that you’ll need to fix. After cleaning up the tags and rebuilding the database, try this process again to see if you’ve caught all the errors.

ffms2m3u.sh – create playlist for all files on a Firefly Media Server

ffms2m3u – create playlist for all files on a Firefly Media Server.

If you run Firefly Media Server, you can run this script to create an M3U of all the tracks on your server. You can play this in most audio players; VLC likes it, as does iTunes (though big playlists take an age to load). Rhythmbox and the default Ubuntu Movie Player won’t touch my playlist of over 17,000 tracks.

To configure the script you need to edit three lines:


# where the Firefly database lives
DATABASE="/usr/var/cache/mt-daapd/songs3.db"
# server domain name or IP address
SERVER="server.example.com"
# Port to talk to server - don't leave blank
PORT="3689"

If you’re running Ubuntu, you’ll probably only need to change the SERVER line. It spits the M3U playlist, ordered by album, to stdout. Note that in the default Ubuntu install, regular users can’t read the database file.

If you’re running this from a cron job, it’s probably a good idea to fill in the real paths for sqlite3 and awk.