Skip to content

Instantly share code, notes, and snippets.

@wesrog
Created December 5, 2008 18:26
Show Gist options
  • Save wesrog/32440 to your computer and use it in GitHub Desktop.
Save wesrog/32440 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'rbosa'
require 'net/http'
require 'cgi'
require 'rexml/document'
include REXML
itunes = OSA.app('iTunes')
track = itunes.current_track
feed = "http://ws.audioscrobbler.com/1.0/artist/#{CGI::escape(track.artist)}/toptags.xml"
doc = Document.new(Net::HTTP.get(URI(feed)))
track.genre = doc.root[1][1].text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment