ABOUT


This Ruby gem wraps small RESTful clients to hit popular music APIs to find recommended music. Current clients include last.fm and Yahoo! Music.

www.last.fm/api developer.yahoo.com/music/

TEST


Tests can be run by running:

rake test

To run actual integration tests against RESTful services, you will need to provide an API key for last.fm and Yahoo! Music.

SAMPLE USAGE


To find similar songs via last.fm:

last_fm_client = SunDawg::LastFmClient.new last_fm_client.api_key = “abcdefg” # YOUR KEY tracks = last_fm_client.get_similar_tracks(“Creep”, “Radiohead”) tracks.each { |t|

puts "TRACK [#{t}]"

}

To find similar artists via last.fm:

artists = last_fm_client.get_similar_artists(“Bob Dylan”)

To find similar artists via Yahoo Music!: yahoo_music_client = SunDawg::YahooMusicClient.new yahoo_music_client.app_id = “abcdefg” # YOUR KEY artists = yahoo_music_client.get_similar_artists(“The Killers”)

Note: The Yahoo! Music API requires that two RESTful calls, one to search for the artist by name to receive the artist ID, then a second call to find similar artists. The get_similar_artists call will implicitly take the first result from the artist search service when finding similar artists. For more granularity, the following methods are supported:

get_artists(name) get_similar_artists_by_id(id, options)

GEM INSTALL


This gem is hosted gemcutter.org. To install the gem, you should install gemcutter as so:

sudo gem install gemcutter gem tumble

This will add gemcutter to your gem repository for downloading the country_codes gem.

RAILS INSTALL


config.gem ‘sundawg_music_rec’, :lib => ‘last_fm_client’ config.gem ‘sundawg_music_rec’, :lib => ‘yahoo_music_client’

TO DO


  • Integrate more recommendation engines.

  • Build a meta-client that calls all API clients.

  • Code improvement.