November 5th, 2008 |
Published in
Code, Technology | View Comments
Earlier this summer I had noticed that National Public Radio (NPR) launched a brand new open API based on open source technologies. My initial reaction was at best skeptical. I assumed any sort of “API” released by a major media outlet would turn out to be nothing more than a few customizable RSS feeds. If the company was particularly progressive the RSS feeds might include full articles, rather than the neutered one-sentence teasers you find in all the big name’s syndicated content.
I couldn’t have been more mistaken. NPR’s API is no small potatoes. Just take a look at the comprehensive Query Generator to get an inkling of the types of complex queries you can create. Looking at the Query Generator also sheds some light on the content you can retrieve using the API. The API’s main page says the API exposes the entire NPR archive of content starting from the launch of the NPR website in 1995. Just how big is this archive? Over 250,000 stories including text, images, video, and audio!
This quote from the article announcing the API caught my eye immediately:
There were quite a few questions that we addressed when developing the API, but one thing that was not really in question was the need to open as much of our content as possible.
This isn’t the first open media API. BBC was the first to offer a public open access API, however BBC’s API is restricted to the content from the past 7-days. Seven days! That’s nothing compared to the (approx.) 4748 days – and counting – that NPR’s API offers. NPR and the BBC are two large companies leading the technological shift towards open and free information.
But that’s only half the story.
After discovering this fantastic API I had to do something with it, and the new service architecture in Amarok 2 provided the perfect platform to build a NPR mashup. That was several months ago, and at the time the scripting API in Amarok was still being flesh out (Thanks to Peter). On Monday I noticed the BBC scriptable service Nikolaj had created for Amarok 2. I happened to have several hours of free time, so I cooked up a similar service for NPR:


You can get it at kde-apps or via the “Get More Scripts” button in Amarok 2′s Script Manager.
There is definitely room for improvement and in fact here are a few things I plan to do with it:
- Display more than 20 stories under a category
- Sort content by date
- Support searching
- Display the full articles, with images, in the context view
Major props and thanks go out to the entire NPR technical team and all the contributors who made API a reality.
October 23rd, 2008 |
Published in
Code, Technology | View Comments
I got a G1 today.
That deserves a post unto itself, but I wanted to share a solution an annoying issue regarding switching from Verizon to T-Mobile. Before I got the G1 I had a LG-VX9800 (yes, ancient, I know) with around 200 contacts. Obviously one of the first things I wanted to do when I got my G1 was transfer all my contacts from the LG to the G1. There are several ways to do this
- Go to a Verizon store and pay $10 for data backup
- Buy a USB Cable for the LG-VX9800, and use bitpim
- Manually copy (type) your contacts into the G1/Gmail
- Use my method
There was no way I was going to pay $10 for what should be a simple “Export,” so #1 was crossed out. I’m impatient and didn’t want to wait for a cable to be delivered and neither did I want to pay the money for one. There goes #2. I didn’t even consider #3; I just listed it for completeness sake.
That leaves my somewhat difficult and unreliable method. Basically, what I do is use Verizon’s “Backup Assistant” tool to send my contacts to Verizon’s website. Then I save the source of the “Print Contacts” page – because there is no export feature. With a little ruby I parse the file into Gmail’s CSV format and import the file via the Gmail contacts page.
Here’s a quick howto.
- On your Verizon phone go to “Get Going -> Get a New App -> Backup Assistant” and install it for $1.50 a month.
- Follow the prompts and backup your contacts.
- Go to the Verizon backup website and sign in.
- View your contacts and click the “Print Contacts” link. Save the source of this page to a file
- Download this script and run it against the saved html file. Save the output in “contacts.csv”
- Go to the Contacts page in Gmail and select Import, and upload “contacts.csv” Note: I suggest using the “add these imported contacts to” a new group feature. Because you will likely have to merge and cleanup the imported contacts.
- Import and Enjoy
IMPORTANT: My script only grabs the following information from the Verizon contact list: Name, Email, Work Phone, Mobile Phone, and Home Phone.
September 18th, 2008 |
Published in
Code, Technology | View Comments
If there was a blogger award for “Most likely to make timely posts”, then in no possible world would I even be considered for the award. I could list some excuses that sound legit in my head, but the real reason I don’t feel motivated to post often (or on time) is because I’d rather spend that time in Google Reader reading everyone else’s exciting content (that was not sarcastic).
So, lets see… last time I posted I was en route to Akademy 2008 (the KDE developers conference). That was July 30th, now, a month and a half later I am back from Europe (which was amazing), GSoC is over (sad), and class has started (jury’s still out).
Current Status of the MP3tunes Amarok Service
The Good (Works)
- Browsing & Streaming
- Querymaker is as functional as possible with the current API
- Manual Downloading from MP3tunes to Local Collection
- Manual Uploading from any Collection to MP3tunes
The Bad (Doesn’t work)
- AutoSync – 80%- The code is there, however there are problems with the daemon not receiving signals from the MP3tunes’ servers
- MP3tunes playlists support – 0%- Never got started on this
The Ugly
There is one large issue I am still wrestling with. The details of the issue are complicated, but essentially it deals with the way Amarok handles remote tracks in playlists across sessions. Generally, remote tracks’ metadata isn’t cached by Amarok for use between multiple sessions. So, if you add an mp3tunes track to a playlist in Amarok, then restart Amarok and try to play that playlist the mp3tunes track is blank. Now, there exists a method for retrieving that metadata, however it was originally implemented synchronously. When you are retrieving metadata for any significant number of tracks (10+) synchronously, and each one of those retreivals is an HTTP Get request you end up blocking the GUI thread. At Akademy I hacked a way to do this asynchronously, but it is a really nasty hack. I’ve got code on my computer that implements this feature correctly, but it has the nasty habit of crashing Amarok every so often.
Between classes, marching band, homework, and other responsibilities I’m working on getting this ironed out and committed. Hopefully this will happen before the 2.0 release, because right now using MP3tunes in Amarok across sessions is slow and annoying.
July 30th, 2008 |
Published in
Life, Technology | View Comments
The ball has been dropped by me – dropped hard – during the past several weeks. First, I was stumped for a week and a half by the glib+qt fiasco, then my development machine’s hard drive shuffled off the mortal coil. Replacing it took a solid week, and when it finally arrived I installed Gentoo. Two days later, the finally install completes as I’m frantically throwing my life’s possessions into a car:
- clothes
- 2 laptops
- 1 Target desk (retail $50)
- assorted books
- 1 blow-up air mattress
Fast forward through seven hours of me hurtling down the interstate at not-so-safe velocities, and here I am, pardoning my recent idleness as my flight to Paris boards at gate D32. Not accomplishing much over the past several weeks suddenly doesn’t seem so bad: I’m going to Europe! There is a week long hack-a-thon at Akademy; I’ll catch up then.

A bientôt!
July 17th, 2008 |
Published in
Code, Technology | View Comments
I’ve been slacking on the update reports over the past two weeks, because I’m holding out for the exciting post where I say “MP3tunes AutoSync is working! Huzzah!” Sadly, this report isn’t that one.
For the past week I’ve been banging my head against the wall of glib, QtEventLoop, and QThreads. I have quite a headache to say the least, but yesterday thanks to my mentor and Ian, both Amarok developers, my head actually broke through that wall. Literally. GLIB, and Qt are kowtowing at my feet swearing oaths of fealty. They have promised to work together and let me get back to doing fun things, like code new features.