Module: Echowrap::API::Track
Constant Summary
Constants included from Utils
Utils::API_KEY_CANNOT_CALL_THIS_METHOD, Utils::INVALID_PARAMETER, Utils::MISSING_OR_INVALID_KEY, Utils::MISSING_PARAMETER, Utils::RATE_LIMIT_EXCEEDED, Utils::SUCCESS
Instance Method Summary collapse
-
#track_analysis(options = {}) ⇒ Echowrap::Track
Get analysis info on tracks given an analysis_url.
-
#track_profile(options = {}) ⇒ Echowrap::Track
Get info about tracks given an id or md5.
-
#track_upload(options = {}) ⇒ Echowrap::Track
Upload a track to The Echo Nest’s analyzer for analysis.
Instance Method Details
#track_analysis(options = {}) ⇒ Echowrap::Track
Get analysis info on tracks given an analysis_url. This method is not explicitly described by the Echowrap API and is provided as a helper.
56 57 58 59 60 |
# File 'lib/echowrap/api/track.rb', line 56 def track_analysis(={}) url = .delete(:url) response = send(:get, url, ) Echowrap::Analysis.new(response[:body]) end |
#track_profile(options = {}) ⇒ Echowrap::Track
Get info about tracks given an id or md5. The md5 parameter is the file md5.
20 21 22 23 |
# File 'lib/echowrap/api/track.rb', line 20 def track_profile(={}) .merge(:bucket => 'audio_summary') if [:bucket].nil? object_from_response(Echowrap::Track, :get, '/api/v4/track/profile', :track, ) end |
#track_upload(options = {}) ⇒ Echowrap::Track
Upload a track to The Echo Nest’s analyzer for analysis. The track will be analyzed. This method takes either a url parameter, or a local audio file, which should be the contents of the request body.
combined with url option
40 41 42 43 |
# File 'lib/echowrap/api/track.rb', line 40 def track_upload(={}) .merge(filetype: File.extname([:track]).gsub('.', '')) if [:track] && [:filetype].nil? object_from_response(Echowrap::Track, :post, '/api/v4/track/upload', :track, ) end |