API wrapper for musixmatch.com API's
Ruby
Clone or download
Latest commit 95bcfff Jul 7, 2011
Permalink
Failed to load latest commit information.
lib added restricted attribute to lyrics Jul 6, 2011
spec removed deprecated API methods May 14, 2011
.gitignore updated gitignore Sep 19, 2010
LICENSE added LICENSE Sep 19, 2010
README.rdoc updated README May 14, 2011
Rakefile fixed lyrics specs Nov 15, 2010
VERSION version 0.2.0 Jul 6, 2011
musix_match.gemspec version 0.2.0 Jul 6, 2011

README.rdoc

Musix Match

 _                                                                              _
| |       _                                                            _       | |
| |      | |                                                          | |      | |
| | _  _ | |                                                          | | _  _ | |
| || || || |    MusixMatch is a wrapper for the musixmatch.com API's. | || || || |
| || || || |  With this library you can search for lyrics and tracks  | || || || |
| |  || || |        using the http://musixmatch.com service.          | |  || || |
|          |                                                          |          |
|          |                                                          |          |
\          /                                                          \          /
 ----------                                                            ----------

Installation

gem install musix_match

Usage

require 'musix_match'

MusixMatch::API::Base.api_key = 'YOUR_API_KEY'

Track search

response = MusixMatch.search_track(:q_artist => 'Pantera')
if response.status_code == 200
  response.each do |track|
    puts "#{track.track_id}: #{track.track_name} (#{track.artist_name})"
  end
end

Available options for the search_track methods are:

  • q: a string that will be searched in every data field

  • q_track: string to be searched among tracks titles

  • q_artist: string to be searched among artists names

  • page: requested page of results

  • page_size: desired number of items per result page

  • f_has_lyrics: exclude tracks without an available lyrics

Getting lyrics

response = MusixMatch.get_lyrics(track_id)
if response.status_code == 200 && lyrics = response.lyrics
  puts lyrics.lyrics_body
end

Getting track

response = MusixMatch.get_track(track_id)
if response.status_code == 200 && track = response.track
  puts "#{track.track_name} (#{track.artist_name})"
  puts "Lyrics id: #{track.lyrics_id}"
end

Are you feeling lucky?

puts MusixMatch.i_m_feeling_lucky("Guns'n'Roses - Welcome to the jungle")

Lyrics

The Lyrics object has the following attributes:

  • lyrics_id

  • lyrics_body

  • lyrics_language

  • script_tracking_url

  • lyrics_copyright

  • track_name

  • artist_name

Track

The track object has the following attributes:

  • track_id

  • track_mbid

  • track_name

  • track_mbid

  • track_length

  • lyrics_id

  • instrumental

  • subtitle_id

  • artist_id

  • artist_mbid

  • artist_name

  • artist_mbid

  • album_name

  • album_id

  • album_coverart_100x100

Sending Feedback

MusixMatch.post_feedback(track_id, lyrics_id, feedback_type)

Feedback type should be one of the following:

  • wrong_attribution (the lyrics shown are not by the artist that I selected.)

  • bad_characters (there are strange characters and/or words that are partially scrambled.)

  • lines_too_long (the text for each verse is too long!)

  • wrong_verses (there are some verses missing from the beginning or at the end.)

  • wrong_formatting (the text looks horrible, please fix it!)

Links

Author

Andrea Franz - gravityblast.com