public
Fork of kschrader/scrobbler
Description: Scrobbler is a wrapper for the audioscrobbler (last.fm) web services.
Homepage: http://github.com/xhochy/scrobbler
Clone URL: git://github.com/xhochy/scrobbler.git
name age message
file .gitignore Sat Oct 10 07:33:34 -0700 2009 Added yardoc rake task [xhochy]
file .loadpath Sat Oct 10 07:33:34 -0700 2009 Added yardoc rake task [xhochy]
file .project Sat Oct 10 07:33:34 -0700 2009 Added yardoc rake task [xhochy]
directory .settings/ Sat Oct 10 08:30:20 -0700 2009 DRY: Cleaned up Artist and Album classes. [xhochy]
file History.txt Tue Apr 14 04:56:28 -0700 2009 Updated some doc to 2.0 [xhochy]
file MIT-LICENSE Tue Apr 14 04:56:28 -0700 2009 Updated some doc to 2.0 [xhochy]
file Manifest Sun May 17 11:45:22 -0700 2009 Removed nearly all reference to code which uses... [xhochy]
file README.rdoc Sat Oct 10 07:33:34 -0700 2009 Added yardoc rake task [xhochy]
file Rakefile Mon May 18 16:18:27 -0700 2009 Using Jeweler as new gem build system [xhochy]
file VERSION.yml Mon May 18 16:18:27 -0700 2009 Using Jeweler as new gem build system [xhochy]
directory examples/ Fri Sep 11 15:25:13 -0700 2009 Fixed album example to work with the 2.0 version [xhochy]
directory lib/ Sat Oct 10 09:06:08 -0700 2009 FIX: Album class now uses the mixin method too. [xhochy]
file setup.rb Thu May 10 07:14:23 -0700 2007 initial commit of scrobbler gem git-svn-id: h... [jnunemaker]
directory tasks/ Sat Oct 10 07:33:34 -0700 2009 Added yardoc rake task [xhochy]
directory test/ Sun Sep 13 03:28:29 -0700 2009 FIX: class to register_uri are now compilant to... [xhochy]
directory website/ Fri Apr 17 04:04:26 -0700 2009 Removed reach out of website [xhochy]
README.rdoc

Scrobbler

Scrobbler is a wrapper for the audioscrobbler web services (www.audioscrobbler.net/data/webservices/).

Currently updating to use the 2.0 API. It is very much a work in progress.

Below is just a sampling of how easy this lib is to use, full documentation of all functions is available at rdoc.info/projects/xhochy/scrobbler

Initialization

  Scrobbler::Base.api_key = 'foo123'

Users

  user = Scrobbler::User.new('jnunemaker')

  puts "#{user.username}'s Recent Tracks"
  puts "=" * (user.username.length + 16)
  user.recent_tracks.each { |t| puts t.name }

  puts
  puts

  puts "#{user.username}'s Top Tracks"
  puts "=" * (user.username.length + 13)
  user.top_tracks.each { |t| puts "(#{t.playcount}) #{t.name}" }

Albums

  album = Scrobbler::Album.new('Some Hearts', :artist => 'Carrie Underwood', :include_info => true)

  puts "Album: #{album.name}"
  puts "Artist: #{album.artist}"
  puts "Playcount: #{album.playcount}"
  puts "URL: #{album.url}"
  puts "Release Date: #{album.release_date.strftime('%m/%d/%Y')}"

Artists

  artist = Scrobbler::Artist.new('Carrie Underwood')

  puts 'Top Tracks'
  puts "=" * 10
  artist.top_tracks.each { |t| puts "(#{t.playcount}) #{t.name}" }

  puts

  puts 'Similar Artists'
  puts "=" * 15
  artist.similar.each { |a| puts "(#{a.match}%) #{a.name}" }

Geo

  geo = Scrobbler::Geo.new()

  puts 'Events'
  puts "=" * 10
  geo.events(:location => 'Manchester').each { |e| puts "(#{e.id}) #{e.title}" }

  puts

  puts 'Top Artists'
  puts "=" * 10
  geo.top_artists(:location => 'Manchester').each { |a| puts "(#{a.name}) #{a.playcount}" }

  puts

  puts 'Top Tracks'
  puts "=" * 10
  geo.top_tracks(:location => 'Manchester').each { |t| puts "(#{a.name}) #{a.playcount}" }

Tags

  tag = Scrobbler::Tag.new('country')

  puts 'Top Albums'
  tag.top_albums.each { |a| puts "(#{a.count}) #{a.name} by #{a.artist}" }

  puts

  puts 'Top Tracks'
  tag.top_tracks.each { |t| puts "(#{t.count}) #{t.name} by #{t.artist}" }

Tracks

  track = Scrobbler::Track.new('Carrie Underwood', 'Before He Cheats')
  puts 'Fans'
  puts "=" * 4
  track.top_fans.each { |u| puts "(#{u.weight}) #{u.username}" }

Simple Authentication (for Scrobbling)

  work in progress...

Scrobbling

  work in progress...

Now Playing Submission

  work in progress...