Observations on a Journey

I stayed in London last night, so decided to try something a little different and fly out of London City rather than Heathrow for my upcoming journey to Madrid. I think I’ve decided that this was a mistake. I was staying at R’s in Hammersmith, and the journey to City is much longer than it was in my head. In retrospect, Heathrow would have been much simpler; just a quick trip down the Piccadilly line. The DLR (something Richard has written about before) didn’t help. Only a few years after opening a potentially useful extension to London City, they are already deciding to play the UK rail game and shut it at the weekends for engineering work; a bus was needed. Pathetic.

The journey was tinged by a strange sadness, too. A middle-aged woman who had been sitting opposite me on the Piccadilly line for a few minutes, to all outward appearances entirely normal, suddenly surreptitiously slipped a can of Strongbow out of her (smart leather) handbag and swigged a gulp, then slipped it back in - all as discreetly as possible. Fortunately for me, I’ve never been close to anyone who’s been affected by alcoholism, but it began to dawn on me how strange an addiction it must be to need a drink in such a place - and from such a person. I wasn’t sure if I should feel sorry for her.


With Ratatouille, Brad Bird and Pixar have finally transcended animation. Bird recently said that they wanted animation to be seen as an art form rather than a genre, and one can see why.

Ratatouille has a subtle plot, well-designed characters, humour, tears, and much of the other excellent content one has come to expect from Pixar. At times it drags a little, but in showing how animation can serve to tell a story (rather than simply entertain), as well as any live-action film, they deserve total credit.

It is nothing short of marvellous.

Rush Hour 3, however, is just xenophobic, predictable drivel.

Toronto Trip

I’m in Toronto this week, working with some of my colleagues from the Toronto development lab.

Some observations on the trip so far:

  • If travelling via the US, JFK is preferable as an interchange to O’Hare - the terminal is modern and pleasant, and changing is easier. But:

  • Go direct to Canada if you can - you cut down on immigration paperwork.

  • My car (a Pontiac G6) is pretty cool, and like all North American cars I’ve driven, very usable and drivable. Driving here in Canada doesn’t seem to be much different from the US.

Win a Happiness Workshop

I met Alexander Kjerulf, the self-titled Chief Happiness Officer (possibly one of the most cheerful and effusive people you’d ever meet) at euroGel 2006, where he was running a workshop. Now he’s coming to the UK to work with HP, providing consultancy on happiness in the workplace. There’s a competition running to win free consultancy for companies of 100 employees or less. If you work somewhere of that size, and you think your workplace could do with a few smiles, I’d strongly suggest taking a look at his blog entry on the subject. He’s a great chap and you’d potentially be getting some great consultancy for free.

(even if you don’t work in such a company, take a look anyway; his blog is full of inspiring tips)

More Flexible Firefly Smart Playlists with Perl, sqlite3 and m3u

I use Firefly (previously called mt-daapd) as a media server for my Roku Soundbridge. It has a feature called ‘Smart Playlists’ that dynamically create playlists based on certain criteria, but they aren’t that powerful - they don’t support sorting or other more advanced query features.

Fortunately, underlying Firefly is a sqlite database, which can be queried using standard SQL syntax. This enables a technique of creating static playlists that are automatically re-generated periodically instead.

The prerequisites for the following technique are:

  • Perl, with the File::Spec module (to convert from absolute paths to relative ones, which is what Firefly expects).

  • The sqlite3 command-line interface.

The three commands that follow will create a standard .m3u playlist with the top 100 most-played songs from Firefly’s database, and another playlist with all the non-Podcasts added in the last month, ordered by the time they were added. Neither of these are possible using Firefly’s query language.

sqlite3 /var/cache/mt-daapd/songs3.db 'select path from songs order by play_count desc limit 100' | perl -nle 'require File::Spec; $_ = File::Spec->abs2rel($_, "$PLAYLIST_DIR"); print;' > "$PLAYLIST_DIR/Most-played songs.m3u"

MONTHAGO=$(perl -e 'use Date::Calc::Object qw(:all); $date = Date::Calc>now(); $date += [0,-1,0,0,0,0]; print $date->mktime();')

sqlite3 var/cache/mt-daapd/songs3.db "select path from songs where genre!='Podcast' and time_added > $MONTHAGO order by time_added desc" | perl -nle 'require File::Spec; $_ = File::Spec->abs2rel($_, "$PLAYLIST_DIR"); print;' > "$PLAYLIST_DIR/Music added in last month by most recent.m3u"

(obviously, if you use these, you’ll need to alter paths to suit, make sure the correct Perl modules are installed, remove line breaks to make it easier to read, etc.)

Firefly will read these .m3us if configured correctly during its next rescan, and use them as it would any other playlists. You can force a rescan with the following wgetcommand:

wget --delete-after -q --http-user noone --http-password yourpasswd "http://localhost:3689/config-update.html?action=rescan"

Although not fully dynamic (they are not generated on request from the Soundbridge), if these commands are called from cron or similar, the playlist can be kept up-to-date ‘enough’.

subscribe via RSS