Module: Rockstar

Extended by:
Rockstar
Included in:
Rockstar
Defined in:
lib/rockstar/tag.rb,
lib/rockstar.rb,
lib/rockstar/geo.rb,
lib/rockstar/auth.rb,
lib/rockstar/base.rb,
lib/rockstar/rest.rb,
lib/rockstar/user.rb,
lib/rockstar/album.rb,
lib/rockstar/chart.rb,
lib/rockstar/event.rb,
lib/rockstar/metro.rb,
lib/rockstar/track.rb,
lib/rockstar/venue.rb,
lib/rockstar/artist.rb,
lib/rockstar/playing.rb,
lib/rockstar/session.rb,
lib/rockstar/version.rb,
lib/rockstar/scrobble.rb,
lib/rockstar/tokenauth.rb,
lib/rockstar/simpleauth.rb

Overview

Below are examples of how to find an artists top tracks and similar artists.

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

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

puts

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

Would output something similar to:

Top Tracks
==========
(8797) Before He Cheats
(3574) Don't Forget to Remember Me
(3569) Wasted
(3246) Some Hearts
(3142) Jesus, Take the Wheel
(2600) Starts With Goodbye
(2511) Jesus Take The Wheel
(2423) Inside Your Heaven
(2328) Lessons Learned
(2040) I Just Can't Live a Lie
(1899) Whenever You Remember
(1882) We're Young and Beautiful
(1854) That's Where It Is
(1786) I Ain't in Checotah Anymore
(1596) The Night Before (Life Goes On)

Similar Artists
===============
(100%) Rascal Flatts
(84.985%) Keith Urban
(84.007%) Kellie Pickler
(82.694%) Katharine McPhee
(81.213%) Martina McBride
(79.397%) Faith Hill
(77.121%) Tim McGraw
(75.191%) Jessica Simpson
(75.182%) Sara Evans
(75.144%) The Wreckers
(73.034%) Kenny Chesney
(71.765%) Dixie Chicks
(71.084%) Kelly Clarkson
(69.535%) Miranda Lambert
(66.952%) LeAnn Rimes
(66.398%) Mandy Moore
(65.817%) Bo Bice
(65.279%) Diana DeGarmo
(65.115%) Gretchen Wilson
(62.982%) Clay Aiken
(62.436%) Ashlee Simpson
(62.160%) Christina Aguilera

Defined Under Namespace

Modules: REST Classes: Album, Artist, Auth, Base, Chart, Event, Geo, Metro, Playing, Scrobble, Session, SimpleAuth, Tag, TokenAuth, Track, User, Venue

Constant Summary collapse

API_URL =
'http://ws.audioscrobbler.com/'
API_VERSION =
'2.0'
Version =
File.open(File.join(File.dirname(__FILE__), "../../VERSION"), "r").read.strip
AUTH_URL =
'http://post.audioscrobbler.com'
AUTH_VER =
'1.2.1'

Instance Method Summary collapse

Instance Method Details

#lastfm=(args) ⇒ Object



38
39
40
41
# File 'lib/rockstar.rb', line 38

def lastfm=(args)
  @api_key    = args["api_key"]
  @api_secret = args["api_secret"]
end

#lastfm_api_keyObject



43
44
45
# File 'lib/rockstar.rb', line 43

def lastfm_api_key
  @api_key
end

#lastfm_api_secretObject



47
48
49
# File 'lib/rockstar.rb', line 47

def lastfm_api_secret
  @api_secret
end