Sha256: d0d78f027624844622af4243025e96c40b9407fb725c8413ac9399df9ff7a8d0

Contents?: true

Size: 682 Bytes

Versions: 1

Compression:

Stored size: 682 Bytes

Contents

class Caboodle::Lastfm < Caboodle::Kit
  description "Displays your recent and all time top Last.fm plays"
  
  required [:lastfm_username]
  
  def scrape 
    @last ||= Caboodle.scrape("http://www.last.fm/user/#{Caboodle::Site.lastfm_username}")
  end
  
  menu "Listening" do

    @recent = scrape.css("#recentTracks .module-body").to_html
    @recent.gsub!("href=\"/", 'href="http://last.fm/')
    @top = scrape.css(".modulechartsartists .module-body").to_html
    @top.gsub!("href=\"/", 'href="http://last.fm/')
    
    haml :listening
  end
  
  credit "http://www.last.fm/listen/user/#{Caboodle::Site.lastfm_username}", "#{Caboodle::Site.lastfm_username} on Last.fm"
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
caboodle-0.2.16 lib/caboodle/kits/lastfm/lastfm.rb