last.fm to Spotify migration

When last.fm announced on 2012-12-13 that they were pulling out of Switzerland in mid-January, I requested a refund (unsuccessfully so far) and started looking around for an alternative immediately. Spotify seems to fit the bill nicely, and barring any glaring privacy or stability issues it’s probably worth a threefold price increase.

But how to migrate? last.fm has got XSPF and tab-separated values export functionality at /user/<username>/library/loved; great! Except that didn’t work the first half a dozen times I tried, and Ivy, the most promising import service, only supports some iTunes format and comma-separated values, so I ended up making a tool to convert lfmCOL.pl XML to CSV. Of course, after finishing that I tried last.fm again, and now the XSPF export worked, so I created another project to convert XSPF to CSV. Nice hacking exercise to ensure that it produces parseable CSV even with quotes and high-Unicode characters in the input.

Ivy kept telling me I didn’t select a track column in the second step, but would gladly accept the pasted result from xclip -in favorites.csv without even asking about columns. Out of 1222 last.fm tracks it found 734 (60%) on Spotify, which is not too terrible considering the impressive collection of obscure tracks on the former.

Advertisements

Office super-tool: pdftk

If you scan or print a lot of documents, you have probably used PDF files. They are very nice, but it can be tricky to modify and otherwise handle them. Enter pdftk: great (but small), free (but valuable) and powerful (but simple). It’s also open source, which means you can learn it now, and use it the same way in five, ten, or twenty years.

I was recently sending out 28 temp job applications with six attachments each. I printed out the motivation letter for each job and 28 copies of each attachment, so I ended up with seven piles of paper which I then had to mix by hand to make 28 applications. Tedious work, and I could have smacked myself when I realized that it would have been much easier to put all the attachments in a single document, and printing that 28 times: Two piles instead of seven. This is really simple with pdftk – Just start up a shell (In Windows: Start → Run → cmd, in Ubuntu: Applications → Accessories → Terminal), and replace the file names in the following command with your own to produce a new file with all the documents in sequence:

pdftk cv.pdf "reference letter 1.pdf" [and so on] cat output new.pdf

cat is the magic word: Concatenate all the files before it. pdftk can also do other useful stuff, like rotating pages (if they were scanned the wrong way around), splitting, watermarking, digital signatures and much more (see examples).