module Echowrap::API::Song

Public Instance Methods

song_identify(options={}) click to toggle source

Identifies a song given an Echoprint or Echo Nest Musical Fingerprint hash codes.

@see developer.echonest.com/docs/v4/song.html @authentication Requires api key @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid. # @raise [Echowrap::Error::Unauthorized] Error raised when supplied user credentials are not valid. @return [Echowrap::Track] The identified song. @param options [Hash] A customizable set of options. @option options [String] :query The JSON query. Use only with POST. Example: See “Here is a sample query:” at developer.echonest.com/docs/v4/song.html#identify. @option options [String] :code The FP hashcodes for the track. Use only with GET. Example: See “Identifying Songs with GET at developer.echonest.com/docs/v4/song.html#identify.” @option options [String] :artist The name of the artist from the ID3 tag. Use only with GET, not required. Example: ‘Michael+Jackson’ @option options [String] :title The title of the track from the ID3 tag. Use only with GET, not required. Example: ‘Billie+Jean’ @option options [String] :release The title of the track from the ID3 tag. Use only with GET, not required. Example: ‘Thriller’ @option options [String] :duration The length of time of the track, in seconds. Use only with GET, not required. Example: ‘296.15’ @option options [String] :genre The genre from the ID3 tag. Use only with GET, not required. Example: ‘pop’ @option options [String] :version Version of codegen used to generate the code. Not required. Example: For ENMFP use 3.15, for Echoprint use 4.12, defaults to 3.15 @option options [String] :bucket The type of track data that should be returned. Must be one of [‘audio_summary’, ‘artist_familiarity’, ‘artist_hotttnesss’, ‘artist_location’, ‘song_hotttnesss’, ‘song_type’, ‘tracks’, ‘id:Rosetta-space’]. Example: audio_summary. @example Identify via json query file

Echowrap.song_identify(:query => File.new('query.json'))
# File lib/echowrap/api/song.rb, line 26
def song_identify(options={})
  if options.key?(:query)
    objects_from_response(Echowrap::Song, :post, '/api/v4/song/identify', :songs, options).first
  else
    objects_from_response(Echowrap::Song, :get, '/api/v4/song/identify', :songs, options).first
  end
end
song_profile(options={}) click to toggle source

Get info about songs given a song id or track id.

@see developer.echonest.com/docs/v4/song.html @authentication Requires api key @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid. # @raise [Echowrap::Error::Unauthorized] Error raised when supplied user credentials are not valid. @return [Echowrap::Song] The song. @param options [Hash] A customizable set of options. @option options [String] :id The ID of the song. Required if track_id is not provided. Example: ‘SOCZMFK12AC468668F’. @option options [String] :track_id The ID of the track. Required if id is not provided. Example: ‘TRTLKZV12E5AC92E11’. @option options [String] :bucket The type of track data that should be returned. Must be one of [‘audio_summary’, ‘artist_familiarity’, ‘artist_hotttnesss’, ‘artist_location’, ‘song_hotttnesss’, ‘song_type’, ‘tracks’, ‘id:Rosetta-space’]. Example: audio_summary. @example Profile via id

Echowrap.song_profile(:id => 'SOCZMFK12AC468668F')
# File lib/echowrap/api/song.rb, line 47
def song_profile(options={})
  objects_from_response(Echowrap::Song, :get, '/api/v4/song/profile', :songs, options).first
end