Sunday, March 25, 2007

Way Back When

I spent the majority of my later teenage years overdosing on computers and music... making music, that is. A few times a year, I find myself listening to the so-called music I made. It really reflected who I was: a kid obsessed with meta-consciousness, psychedelics, alternate realities, and generally anything weird.

So I present to you one track I made while traveling:

user_02

Monday, March 19, 2007

New Last.fm Tagger for RubyOSA

Laurent Sansonetti was generous enough to ask me if I wanted to contribute my little Last.fm script to the RubyOSA samples directory. And of course, I was more than willing to do that. He actually updated the script to make it even better! Now, you simply select which track in iTunes you want to tag, and run the RubyOSA script. The script will then query Last.fm for the most popular tag, and set the genre to whatever the tag on Last.fm is.

Here's the updated code:

begin require 'rubygems'; rescue LoadError; end
require 'rbosa'
require 'net/http'
require 'cgi'
require 'rexml/document'
include REXML

itunes = OSA.app('iTunes')
selection = itunes.selection.get
if selection.empty?
$stderr.puts "Please select some tracks."
exit 1
end
selection.each do |track|
feed = "http://ws.audioscrobbler.com/1.0/album/#{CGI::escape(track.album)}/toptags.xml"
doc = Document.new(Net::HTTP.get(URI(feed)))
track.genre = doc.root[1][1].text
end


Remember, you can get RubyOSA with the Last.fm Tagger here.

Thanks to Laurent for making an awesome library. It makes playing with Ruby even more fun!

Labels: , , , , ,


This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]