Monday, March 10, 2008

The Big OE

In less than a week now I am leaving New Zealand to go to the UK, for what us Kiwis refer to as "the big OE" (OE being Overseas Experience). The UK makes a good base for taking trips to Europe, which is what I plan to do in addition to working (most likely in London) for the next 1-2 years. Several of my friends are already in the UK and I have plenty of relatives there so at least I won't arrive in the country knowing nobody. I'm sure I'll miss home - the nice weather, having my own car, and of course being able to see my family and friends. Still, you don't find adventure on your own doorstep as someone once told me. Very true.

This week is already shaping up to be a busy one at work, winding things down. In many ways it's sad to be leaving there - I've been there just over six years now, and they are like family to me. I would have liked to get to know several new team members who joined recently better as well. There are plenty of fine people there to pick up where I'm leaving off though, and I've left them with documentation that should suffice when I'm not there to answer questions :)

Being the procrastinatory individual that I am, I still have a list of things yet to do before I go. I haven't packed yet, although I have most of the things other than clothes that I plan to take with me (much less stuff than I expected, actually). Four days left in the week - should be plenty of time ;)

In case anyone is wondering I will still be involved in my various projects (Opie, OpenSync, etc.) - being that these are run over the internet I can still participate wherever I am in the world. In some ways it will make things easier - a lot of the open source / free software conferences are in Europe anyway.

Where did my collection go?

So I was trying to move my music collection in Amarok to a different machine. I simply moved all of the MP3 files from machine A to machine B, taking care to preserve the same path structure, and then copied the configuration files (~/.kde/share/config/amarokrc and ~/.kde/share/apps/amarok/* - for clarity, I'm using sqlite backend to store the collection). Then I opened Amarok on the second machine, only to find that my collection was empty. Now, this is not a situation that I'm unfamiliar with - the same thing happened one time when I upgraded Amarok, although somehow I managed to recover from that one. What confused me initially though was that I thought it might not be successfully reading the collection database file; however, after some searching and investigation I figured out what the real problem is and how to solve it.

Digging into the data structure of Amarok's collection.db (by running "sqlite3 ~/.kde/share/apps/amarok/collection.db"), it seems that Amarok records the device where each track is stored so that you can have tracks on removable devices, and they appear when you plug the removable device in and disappear when you unplug it. When running Amarok with the same collection data on another machine, the device that it thought contained all of my tracks (ie, one of my hard drive partitions) no longer existed and thus the collection was shown as empty.

Once you know what's going on here it's not hard to fix the problem, simply by fixing up the device links. In fact, in collections created in newer versions of Amarok (at least in 1.4.8 - my collection has been around for quite a few versions now) it seems to put the files against no device at all (device_id of -1). A few SQL statements later and I had simply cleared out the contents of the devices table and set all of the device_id values in other tables to -1 instead of a specific device, and voila - the next time I started Amarok my collection was restored :)

It seems to me though that there ought to be a nicer way of exporting your collection so you don't have to muck around like this. It might make a good summer of code project for someone... ;)