Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gravityblast/musix_match

API wrapper for musixmatch.com API's
https://github.com/gravityblast/musix_match

Last synced: about 10 hours ago
JSON representation

API wrapper for musixmatch.com API's

Awesome Lists containing this project

README

        

= 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

* Repository: git://github.com/pilu/musix_match.git
* Musixmatch site: {musixmatch.com}[http://musixmatch.com]
* Musixmatch API: {developer.musixmatch.com}[http://developer.musixmatch.com]

== Author

Andrea Franz - {http://gravityblast.com}[http://gravityblast.com]