mashTape and APIs

Sunday, Mar 30. 2008  –  Category: Songbird

Hacking on my mashTape extension has been a great way to find some wicked APIs and get the extension developer’s perspective on Songbird platform development. This morning’s hacking has made me realise we need a better way to allow extensions using display panes to set context for when their display pane should be visible. For instance, mashTape makes little sense when not listening to music. I’d love to be able to set something in my install.rdf, or in my display pane registration code to the effect of:

  • Don’t show when “not playing”
  • Don’t show in a non-media view (e.g. when I’m browsing the web, etc.)

I’ll have to think about it a little more and writeup a story/bug to figure out how I’d like to register this context for my display pane. Right now I’ve done it in mashTape through a combination of a tabbrowser select-tab listener, and a WebProgressListener, which seems like a lot of unnecessary work.

On the topic of APIs… I love Last.fm’s APIs, but it’s frustrating that their API for getting the artist bio information is incomplete. Perhaps it’s to drive traffic to their site (which is understandable), but I often get email requests to expose more of the bio information. Looking around, Freebase has got a wicked cool API, and they’ve somehow scraped Wikipedia’s great content into a bio/article for the artist. I’d love to use it… if only I could figure out how to get the bio! I played with their APIs for at least an hour this morning, and could grab all the information for everything except the “a.k.a.” and “bio/article” sections. Ugh.

Somehow I got from Freebase’s site over to DBpedia where they’ve built XML/RDF interfaces for Wikipedia’s content, and within 5 minutes I had a successful call to grab and parse out the full Wikipedia abstract text for artist bio, years active, etc. etc. I’m psyched. Now I just need to integrate that into mashTape and I should have a full artist bio.

Tags: ,

6 Responses to “mashTape and APIs”

  1. Matt Says:

    Good idea Steve.

    What if it was easy for panes to programatically control their visibility and dimensions?

    Mozilla sidebars get setSidebarWidth() and toggleSidebar() (See http://developer.mozilla.org/en/docs/Code_snippets:Sidebar)

    Also, are you familiar with TabContentChange? It’s a controversial new event that makes it easy to track the state of the browser. (See http://dekiwiki.songbirdnest.com/index.php?title=Platform%26Player/Recipes/Tabbed_Browser)

  2. Dae Park Says:

    Try this to get the aka and article (i.e. of David Bowie):

    http://www.freebase.com/api/service/mqlread?queries={%22q1%22:{%22query%22:%7B%0A%20%20%22/common/topic/alias%22%20:%20%5B%5D,%0A%20%20%22/common/topic/article%22%20:%20%7B%0A%22id%22:%20null%20%20%0A%7D,%0A%20%20%22id%22%20:%20%22/topic/en/david_bowie%22%0A%7D}}

    And to get the contents of the article you will need to use our blob api with the article id you get from the above query:

    http://www.freebase.com/api/trans/raw/guid/9202a8c04000641f8000000000013658

    If you have any questions contact us at our developers mailing list.

  3. Dae Park Says:

    Sorry for the multi-post but another great resource is our query editor. You can try the above query here:

    http://www.freebase.com/tools/queryeditor?q=%7B%20%20%22/common/topic/alias%22%20:%20%5B%5D,%20%20%22/common/topic/article%22%20:%20%7B%22id%22:%20null%20%20%7D,%20%20%22id%22%20:%20%22/topic/en/david_bowie%22%7D&read=1

  4. Stephen Lau Says:

    Thanks Dae – the query editor is cool, I was hoping to find a tool like that but couldn’t find it anywhere on the site. I must have missed it somehow.

    Is there a way to get the entire article text? It looks like using the blob API only returns me an excerpt from the article.

  5. David Craddock Says:

    You legend! This is exactly what I’m trying to do with a music mashup I’m working on. I’m a big fan of MashTape, and have spent the last hour or so re-reading your javascript code for inspiration on how you did it, but this article explains all. Many thanks!

  6. Scraping artists bios off of Wikipedia | DavidCraddock.net Says:

    [...] pictures of the currently playing artist. I was reading through the mashTape code, and then found this posting by its developer, which hepfully provided the exact method I [...]

Leave a Reply

Comments will be sent to the moderation queue.


Recent posts