Skip to Content Collective Idea Home

Post your weekly top 5 Last.fm artists to Campfire

by Brian Ryckbost

A Ruby script that posts your Top 5 Weekly Artists from Last.fm to a Campfire room using Scrobbler and Tinder.

require "rubygems"
require 'scrobbler'
require 'tinder'
user = Scrobbler::User.new('lastfm_username')

output = "#{user.username}'s Top 5 Weekly Artists\n" + ("-" * (user.username.length + 30)) + "\n"
user.weekly_artist_chart[0..4].each {|t| output += "#{t.name} (#{t.playcount})\n" }

campfire = Tinder::Campfire.new 'subdomain', :token => 'some_long_token_hash'
room = campfire.find_room_by_name('Room Name')
room.paste output

What you’d see in your Campfire room:

nsain's Top 5 Weekly Artists
-----------------------------------
Scissor Sisters (12)
My Morning Jacket (10)
The Streets (10)
Phoenix (9)
Death Cab for Cutie (7)

What’s your weekly top 5?