echowrap 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +22 -0
- data/.travis.yml +16 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +22 -0
- data/README.md +111 -0
- data/Rakefile +1 -0
- data/echowrap.gemspec +24 -0
- data/lib/echowrap/analysis.rb +39 -0
- data/lib/echowrap/api/artist.rb +387 -0
- data/lib/echowrap/api/oauth.rb +25 -0
- data/lib/echowrap/api/playlist.rb +248 -0
- data/lib/echowrap/api/sandbox.rb +45 -0
- data/lib/echowrap/api/song.rb +111 -0
- data/lib/echowrap/api/taste_profile.rb +296 -0
- data/lib/echowrap/api/track.rb +64 -0
- data/lib/echowrap/api/utils.rb +57 -0
- data/lib/echowrap/artist.rb +73 -0
- data/lib/echowrap/asset.rb +12 -0
- data/lib/echowrap/audio_summary.rb +15 -0
- data/lib/echowrap/base.rb +88 -0
- data/lib/echowrap/biography.rb +13 -0
- data/lib/echowrap/blog.rb +8 -0
- data/lib/echowrap/call_list.rb +8 -0
- data/lib/echowrap/category_map.rb +8 -0
- data/lib/echowrap/client.rb +80 -0
- data/lib/echowrap/configurable.rb +84 -0
- data/lib/echowrap/default.rb +88 -0
- data/lib/echowrap/doc_counts.rb +8 -0
- data/lib/echowrap/echonest_id.rb +8 -0
- data/lib/echowrap/error/bad_gateway.rb +11 -0
- data/lib/echowrap/error/bad_request.rb +10 -0
- data/lib/echowrap/error/client_error.rb +35 -0
- data/lib/echowrap/error/configuration_error.rb +8 -0
- data/lib/echowrap/error/forbidden.rb +10 -0
- data/lib/echowrap/error/gateway_timeout.rb +11 -0
- data/lib/echowrap/error/internal_server_error.rb +11 -0
- data/lib/echowrap/error/not_acceptable.rb +10 -0
- data/lib/echowrap/error/not_found.rb +10 -0
- data/lib/echowrap/error/server_error.rb +28 -0
- data/lib/echowrap/error/service_unavailable.rb +11 -0
- data/lib/echowrap/error/too_many_requests.rb +12 -0
- data/lib/echowrap/error/unauthorized.rb +10 -0
- data/lib/echowrap/error/unprocessable_entity.rb +10 -0
- data/lib/echowrap/error.rb +32 -0
- data/lib/echowrap/familiarity.rb +8 -0
- data/lib/echowrap/feed.rb +14 -0
- data/lib/echowrap/foreign_id.rb +10 -0
- data/lib/echowrap/genre.rb +8 -0
- data/lib/echowrap/hotttnesss.rb +8 -0
- data/lib/echowrap/image.rb +15 -0
- data/lib/echowrap/item.rb +95 -0
- data/lib/echowrap/item_request.rb +8 -0
- data/lib/echowrap/keyvalues.rb +8 -0
- data/lib/echowrap/license.rb +10 -0
- data/lib/echowrap/location.rb +8 -0
- data/lib/echowrap/meta.rb +9 -0
- data/lib/echowrap/news_article.rb +8 -0
- data/lib/echowrap/options.rb +10 -0
- data/lib/echowrap/playlist.rb +47 -0
- data/lib/echowrap/prediction.rb +7 -0
- data/lib/echowrap/rate_limit.rb +47 -0
- data/lib/echowrap/reference.rb +8 -0
- data/lib/echowrap/request/multipart_with_file.rb +36 -0
- data/lib/echowrap/response/parse_json.rb +25 -0
- data/lib/echowrap/response/raise_error.rb +31 -0
- data/lib/echowrap/review.rb +8 -0
- data/lib/echowrap/rule.rb +8 -0
- data/lib/echowrap/sandbox.rb +11 -0
- data/lib/echowrap/seeds.rb +9 -0
- data/lib/echowrap/sequenced_data/bar.rb +4 -0
- data/lib/echowrap/sequenced_data/beat.rb +4 -0
- data/lib/echowrap/sequenced_data/section.rb +6 -0
- data/lib/echowrap/sequenced_data/segment.rb +4 -0
- data/lib/echowrap/sequenced_data/tatum.rb +4 -0
- data/lib/echowrap/sequenced_data.rb +12 -0
- data/lib/echowrap/song.rb +24 -0
- data/lib/echowrap/status.rb +12 -0
- data/lib/echowrap/taste_profile.rb +28 -0
- data/lib/echowrap/term.rb +8 -0
- data/lib/echowrap/track.rb +21 -0
- data/lib/echowrap/update_info.rb +8 -0
- data/lib/echowrap/urls.rb +9 -0
- data/lib/echowrap/version.rb +18 -0
- data/lib/echowrap/video.rb +7 -0
- data/lib/echowrap/years_active.rb +8 -0
- data/lib/echowrap.rb +78 -0
- data/spec/echonest/api/artist_spec.rb +901 -0
- data/spec/echonest/api/oauth_spec.rb +29 -0
- data/spec/echonest/api/playlist_spec.rb +274 -0
- data/spec/echonest/api/sandbox_spec.rb +67 -0
- data/spec/echonest/api/song_spec.rb +326 -0
- data/spec/echonest/api/taste_profile_spec.rb +403 -0
- data/spec/echonest/api/track_spec.rb +167 -0
- data/spec/echonest/base_spec.rb +119 -0
- data/spec/echonest/client_spec.rb +174 -0
- data/spec/echonest/error_spec.rb +20 -0
- data/spec/echonest/rate_limit_spec.rb +76 -0
- data/spec/echonest_spec.rb +65 -0
- data/spec/fixtures/artist/biographies.json +1 -0
- data/spec/fixtures/artist/blogs.json +1 -0
- data/spec/fixtures/artist/extract.json +1 -0
- data/spec/fixtures/artist/familiarity.json +1 -0
- data/spec/fixtures/artist/hotttnesss.json +1 -0
- data/spec/fixtures/artist/images.json +1 -0
- data/spec/fixtures/artist/list_genres.json +1 -0
- data/spec/fixtures/artist/list_terms.json +1 -0
- data/spec/fixtures/artist/news.json +1 -0
- data/spec/fixtures/artist/profile.json +1 -0
- data/spec/fixtures/artist/reviews.json +1 -0
- data/spec/fixtures/artist/search.json +1 -0
- data/spec/fixtures/artist/similar.json +1 -0
- data/spec/fixtures/artist/songs.json +1 -0
- data/spec/fixtures/artist/suggest.json +1 -0
- data/spec/fixtures/artist/terms.json +1 -0
- data/spec/fixtures/artist/top_hottt.json +1 -0
- data/spec/fixtures/artist/top_terms.json +1 -0
- data/spec/fixtures/artist/twitter.json +1 -0
- data/spec/fixtures/artist/urls.json +1 -0
- data/spec/fixtures/artist/video.json +1 -0
- data/spec/fixtures/billie_jean_fingerprint.txt +1 -0
- data/spec/fixtures/billie_jean_query.json +16 -0
- data/spec/fixtures/oauth/timestamp.json +1 -0
- data/spec/fixtures/playlist/basic.json +1 -0
- data/spec/fixtures/playlist/dynamic/create.json +1 -0
- data/spec/fixtures/playlist/dynamic/delete.json +1 -0
- data/spec/fixtures/playlist/dynamic/feedback.json +1 -0
- data/spec/fixtures/playlist/dynamic/info.json +1 -0
- data/spec/fixtures/playlist/dynamic/next.json +1 -0
- data/spec/fixtures/playlist/dynamic/restart.json +1 -0
- data/spec/fixtures/playlist/dynamic/steer.json +1 -0
- data/spec/fixtures/playlist/static.json +1 -0
- data/spec/fixtures/sandbox/access.json +19 -0
- data/spec/fixtures/sandbox/list.json +1 -0
- data/spec/fixtures/song/identify.json +19 -0
- data/spec/fixtures/song/profile.json +1 -0
- data/spec/fixtures/song/search.json +1 -0
- data/spec/fixtures/taste_profile/ban.json +9 -0
- data/spec/fixtures/taste_profile/create.json +1 -0
- data/spec/fixtures/taste_profile/delete.json +11 -0
- data/spec/fixtures/taste_profile/favorite.json +9 -0
- data/spec/fixtures/taste_profile/feed.json +1 -0
- data/spec/fixtures/taste_profile/keyvalues.json +4 -0
- data/spec/fixtures/taste_profile/list.json +1 -0
- data/spec/fixtures/taste_profile/play.json +9 -0
- data/spec/fixtures/taste_profile/predict.json +1 -0
- data/spec/fixtures/taste_profile/profile.json +1 -0
- data/spec/fixtures/taste_profile/rate.json +9 -0
- data/spec/fixtures/taste_profile/read.json +1 -0
- data/spec/fixtures/taste_profile/similar.json +14 -0
- data/spec/fixtures/taste_profile/skip.json +9 -0
- data/spec/fixtures/taste_profile/status.json +2 -0
- data/spec/fixtures/taste_profile/update.json +10 -0
- data/spec/fixtures/taste_profile/update_request_data.json +4 -0
- data/spec/fixtures/technolol-music.mp3 +0 -0
- data/spec/fixtures/track/analysis.json +3 -0
- data/spec/fixtures/track/profile.json +35 -0
- data/spec/fixtures/track/upload.json +21 -0
- data/spec/helper.rb +50 -0
- metadata +323 -0
@@ -0,0 +1,248 @@
|
|
1
|
+
require 'echowrap/api/utils'
|
2
|
+
|
3
|
+
module Echowrap
|
4
|
+
module API
|
5
|
+
module Playlist
|
6
|
+
include Echowrap::API::Utils
|
7
|
+
|
8
|
+
# Returns a basic playlist. A basic playlist is generated once from an initial set of parameters, and returned as an ordered list of songs. Basic playlist functionality is supported, see the static and dynamic playlist APIs for advanced contextual and personalized playlisting.
|
9
|
+
# Some properties of a basic playlist:
|
10
|
+
# Songs are never repeated
|
11
|
+
# Artists may be repeated
|
12
|
+
# A number of different algorithms can be used to select songs for the playlist. These are specified with the type parameter.
|
13
|
+
# @see http://developer.echonest.com/docs/v4/playlist.html#basic
|
14
|
+
# @authentication Requires api key
|
15
|
+
# @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
|
16
|
+
# @return [Array] Array of songs.
|
17
|
+
# @param options [Hash] A customizable set of options.
|
18
|
+
# @option options [String] :type The type of the playlist to be generated. Not required, must be one of ['artist-radio', 'song-radio', 'genre-radio']
|
19
|
+
# @option options [String] :artist_id ID(s) of seed artist(s) for the playlist. Echo Nest or Rosetta IDs. Not required, may use multiple, no more than 5 total artist_id, artist, track_id, and song_id parameters. Example: 'ARH6W4X1187B99274F' or '7digital-US:artist:304'.
|
20
|
+
# @option options [String] :artist Name(s) of seed artist(s) for the playlist. Not required, may use multiple, no more than 5 total artist_id, artist, track_id, and song_id parameters. Example: 'Weezer, the+beatles'.
|
21
|
+
# @option options [String] :song_id ID(s) of seed song(s) for the playlist. Echo Nest or Rosetta IDs. Not required, may use multiple, no more than 5 total artist_id, artist, track_id, and song_id parameters. Example: 'SOCZMFK12AC468668F'.
|
22
|
+
# @option options [String] :genre A musical genre such as rock, jazz, or dance pop. See the artist method list_genres for details on what genres are currently available, only allowed for genre-radio playlist types and required for genre-radio playlist types. Example: 'jazz, metal'.
|
23
|
+
# @option options [String] :track_id ID(s) of seed track(s) for the playlist. Echo Nest or Rosetta IDs. Not required, may use multiple, no more than 5 total artist_id, artist, track_id, and song_id parameters. Example: 'TRTLKZV12E5AC92E11'.
|
24
|
+
# @option options [Integer] :results The desired number of songs in the playlist, the valid range is 0 to 100, with 15 as the default
|
25
|
+
# @option options [String] :bucket Specifies which extra information should be returned in the playlist. Not require, may use multiple, must be one of ['id:catalog-name', 'tracks']. When specifying idspace buckets (those starting with "id:") the results will be returned in a "foreign_ids" key/element. See Project Rosetta Stone for more information on ID spaces. Example: "tracks".
|
26
|
+
# @option options [String] :limit If 'true', limit the results to any of the given rosetta id space. Must be on of ['true', 'false'] with 'false' as the default. If limit is set to anything but false, at least one idspace must also be provided in the bucket parameter.
|
27
|
+
# @option options [String] :dmca If true or 'styleb' the playlist delivered will meet the DMCA rules. When the DMCA parameter is set to true, the playlist will conform to the following rules: No more than 2 songs in a row from the same album, no more than 3 songs from an album in a 3 hour period, no more than 3 different songs in a row by the same artist, no more than 4 songs by the same artist in a 3 hour period. Skipped songs are not considered to have been played for DMCA conformance purposes. If dmca is set to 'styleb', skipped songs are considered to have been played for DMCA purposes.
|
28
|
+
# @return [Array<Echowrap::Song>]
|
29
|
+
# @example Return an array of songs with artist 'Daft Punk'
|
30
|
+
# Echowrap.playlist_basic(:artist => "Daft Punk")
|
31
|
+
def playlist_basic(options={})
|
32
|
+
objects_from_response(Echowrap::Song, :get, '/api/v4/playlist/basic', :songs, options)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Returns a static playlist. A static playlist is generated once from an initial set of parameters, and returned as an ordered list of songs.
|
36
|
+
# Some properties of a static playlist:
|
37
|
+
# Songs are never repeated
|
38
|
+
# Artist may be repeated
|
39
|
+
# A number of different algorithms can be used to select songs for the playlist. These are specified with the type parameter.
|
40
|
+
# @see http://developer.echonest.com/docs/v4/playlist.html#static
|
41
|
+
# @authentication Requires api key
|
42
|
+
# @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
|
43
|
+
# @return [Array] Array of songs.
|
44
|
+
# @param options [Hash] A customizable set of options.
|
45
|
+
# @option options [String] :type The type of the playlist to be generated. Not required, must be one of ['artist', 'artist-radio', 'artist-description', 'song-radio', 'catalog', 'catalog-radio', 'genre-radio'], 'artist' is default.
|
46
|
+
# @option options [String] :artist_pick The artist_pick parameter is used to determine how songs are picked for each artist in artist-type playlists. If the asc or desc suffix is ommitted, artist_pick defaults to descending. Not required, must one of ['song_hotttnesss-desc', 'tempo', 'duration', 'loudness', 'mode', 'key']
|
47
|
+
# @option options [Float] :variety The maximum variety of artists to be represented in the playlist. A higher number will allow for more variety in the artists. Must be between 0.0 and 1.0, default is 0.5. Example: 0.7.
|
48
|
+
# @option options [String] :distribution Controls the distribution of artists in the playlist. A focused distribution yields a playlist of songs that are tightly clustered around the seeds, whereas a wandering distribution yields a playlist from a broader range of artists. Not required, must be on of ['focused', 'wandering'], 'focused' is default.
|
49
|
+
# @option options [Float] :adventurousness Controls the trade between known music and unknown music. A value of 0 means no adventurousness, only known and preferred music will be played. A value of 1 means high adventurousness, mostly unknown music will be played. A value of auto indicates that the adventurousness should be automatically determined based upon the taste profile of the user. This parameter only applies to catalog and catalog-radio type playlists. Not required must greater than 0.0 and less than 1.0, default is 0.2.
|
50
|
+
# @option options [String] :artist_id ID(s) of seed artist(s) for the playlist. Echo Nest or Rosetta IDs. Not required, may use multiple, no more than 5 total artist_id, artist, track_id, and song_id parameters. Example: 'ARH6W4X1187B99274F' or '7digital-US:artist:304'.
|
51
|
+
# @option options [String] :artist Name(s) of seed artist(s) for the playlist. Not required, may use multiple, no more than 5 total artist_id, artist, track_id, and song_id parameters. Example: 'Weezer, the+beatles'.
|
52
|
+
# @option options [String] :seed_catalog ID of seed catalog for playlist. Not required. Example: 'CAKSMUX1321A708AA4'.
|
53
|
+
# @option options [String] :song_id ID(s) of seed song(s) for the playlist. Echo Nest or Rosetta IDs. Not required, may use multiple, no more than 5 total artist_id, artist, track_id, and song_id parameters. Example: 'SOCZMFK12AC468668F'.
|
54
|
+
# @option options [String] :track_id ID(s) of seed track(s) for the playlist. Echo Nest or Rosetta IDs. Not required, may use multiple, no more than 5 total artist_id, artist, track_id, and song_id parameters. Example: 'TRTLKZV12E5AC92E11'.
|
55
|
+
# @option options [String] :description Description of the type of songs that can be included in the playlist. Not required, may use multiple. Example: 'alt-rock,-emo,harp^2'.
|
56
|
+
# @option options [String] :genre A musical genre such as rock, jazz, or dance pop. See the artist method list_genres for details on what genres are currently available, only allowed for genre-radio playlist types and required for genre-radio playlist types. Example: 'jazz, metal'.
|
57
|
+
# @option options [String] :style A musical style or genre like rock, jazz, or funky, some examples are: 'jazz', 'metal^2'.
|
58
|
+
# @option options [String] :mood A mood like happy or sad, some examples are: 'happy', 'sad^.5'.
|
59
|
+
# @option options [Integer] :results The desired number of songs in the playlist, the valid range is 0 to 100, with 15 as the default
|
60
|
+
# @option options [Float] :max_tempo The maximum tempo for any song on the playlist, the valid range for max_tempo is 0.0 to 500.0 (BPM), with 500.0 as default.
|
61
|
+
# @option options [Float] :min_tempo The minimum tempo for any song on the playlist, the valid range for min_tempo is 0.0 to 500.0 (BPM), with 0.0 as default.
|
62
|
+
# @option options [Float] :max_duration The maximum duration of any song on the playlist, the valid range for max_duration is 0.0 to 3600.0 (seconds), with 3600.0 as default.
|
63
|
+
# @option options [Float] :min_duration The minimum duration of any song on the playlist, the valid range for min_duration is 0.0 to 3600.0 (seconds), with 0.0 as default.
|
64
|
+
# @option options [Float] :max_loudness The maximum loudness of any song on the playlist, the valid range for max_loudness is -100.0 to 100.0 (decibels), with 100.0 as default.
|
65
|
+
# @option options [Float] :min_loudness The minimum loudness of any song on the playlist, the valid range for min_loudness is 0.0 to -100.0 (decibels), with -100.0 as default.
|
66
|
+
# @option options [Float] :max_danceability The maximum danceability of any song, the valid range for max_danceability is 0.0 to 1.0, with 1.0 as default.
|
67
|
+
# @option options [Float] :min_danceability The minimum danceability of any song, the valid range for min_danceability is 0.0 to 1.0, with 0.0 as default.
|
68
|
+
# @option options [Float] :max_energy The maximum energy of any song, the valid range for max_energy is 0.0 to 1.0, with 1.0 as default.
|
69
|
+
# @option options [Float] :min_energy The minimum energy of any song, the valid range for min_energy is 0.0 to 1.0, with 0.0 as default.
|
70
|
+
# @option options [Float] :max_liveness The maximum liveness of any song, the valid range for max_liveness is 0.0 to 1.0, with 1.0 as default.
|
71
|
+
# @option options [Float] :min_liveness The minimum liveness of any song, the valid range for min_liveness is 0.0 to 1.0, with 0.0 as default.
|
72
|
+
# @option options [Float] :max_speechiness The maximum speechiness of any song, the valid range for max_speechiness is 0.0 to 1.0, with 1.0 as default.
|
73
|
+
# @option options [Float] :min_speechiness The minimum speechiness of any song, the valid range for min_speechiness is 0.0 to 1.0, with 0.0 as default.
|
74
|
+
# @option options [Float] :artist_max_familiarity The maximum artist familiarity of any song on the playlist, the valid range for artist_max_familiarity is 0.0 to 1.0, with 1.0 as default.
|
75
|
+
# @option options [Float] :artist_min_familiarity The minimum artist familiarity of any song on the playlist, the valid range for artist_min_familiarity is 0.0 to 1.0, with 0.0 as default.
|
76
|
+
# @option options [Float] :artist_max_hotttnesss The maximum artist hotttnesss of any song on the playlist, the valid range for artist_max_hotttnesss is 0.0 to 1.0, with 1.0 as default.
|
77
|
+
# @option options [Float] :artist_min_hotttnesss The minimum artist hotttnesss of any song on the playlist, the valid range for the artist_min_hotttnesss is 0.0 to 1.0, with 0.0 as default.
|
78
|
+
# @option options [String] :song_type Controls the type of songs returned. Supported song_types are: 'christmas', 'live' and 'studio'. A song type can optionally be followed by ':' and a state, where the state can be one of 'true', 'false' or 'any'. If no state is given, the desired state is assumed to be 'true'.
|
79
|
+
# @option options [String] :artist_start_year_before Matches artists that have an earliest start year before the given value, some examples are '1970', '2011', 'present'.
|
80
|
+
# @option options [String] :artist_start_year_after Matches artists that have an earliest start year after the given value, some examples are '1970', '2011', 'present'.
|
81
|
+
# @option options [String] :artist_end_year_before Matches artists that have an latest start year before the given value, some examples are '1970', '2011', 'present'.
|
82
|
+
# @option options [String] :artist_end_year_after Matches artists that have an latest start year after the given value, some examples are '1970', '2011', 'present'.
|
83
|
+
# @option options [Float] :song_max_hotttnesss The maximum hotttnesss of any song, the valid range for song_max_hotttnesss is 0.0 to 1.0, with 1.0 as default.
|
84
|
+
# @option options [Float] :song_min_hotttnesss The minimum hotttnesss of any song, the valid range for the song_min_hotttnesss is 0.0 to 1.0, with 0.0 as default.
|
85
|
+
# @option options [Float] :max_longitude The maximum longitude of the primary artist location, the valid range for max_longitude is -180.0 to 180.0, with 180.0 as default.
|
86
|
+
# @option options [Float] :min_longitude The minimum longitude of the primary artist location, the valid range for min_longitude is -180.0 to 180.0, with -180.0 as default.
|
87
|
+
# @option options [Float] :max_latitude The maximum latitude of the primary artist location, the valid range for max_latitude is -90.0 to 90.0, with 90.0 as default.
|
88
|
+
# @option options [Float] :min_latitude The minimum longitude of the primary artist location, the valid range for max_latitude is -90.0 to 90.0, with -90.0 as default.
|
89
|
+
# @option options [Integer] :mode The mode of songs, must be one of [0, 1] (minor, major), with 0 representing minor and 1 represeting major.
|
90
|
+
# @option options [Integer] :key The key of songs in the playlist, the valid range for key is 0 to 11 (C, C-sharp, D, D-sharp, E... with 0 representing C and 11 representing B).
|
91
|
+
# @option options [String] :bucket Indicates what data should be returned for each song. If specifying the "tracks" bucket, a bucket with an id space must also be specified. Must be one of ['audio_summary', 'artist_familiarity', 'artist_hotttnesss', 'artist_location', 'song_hotttnesss', 'song_type', 'tracks', 'id:Rosetta-space'].
|
92
|
+
# @option options [String] :sort Indicates how the songs results should be ordered. Must be one of ['tempo-asc', 'duration-asc', 'loudness-asc', 'speechiness-asc', 'liveness-asc', 'artist_familiarity-asc', 'artist_hotttnesss-asc', 'artist_start_year-asc', 'artist_start_year-desc', 'artist_end_year-asc', 'artist_end_year-desc', 'song_hotttness-asc', 'latitude-asc', 'longitude-asc', 'mode-asc', 'key-asc', 'tempo-desc', 'duration-desc', 'loudness-desc', 'liveness-desc', 'speechiness-desc', 'artist_familiarity-desc', 'artist_hotttnesss-desc', 'song_hotttnesss-desc', 'latitude-desc', 'longitude-desc', 'mode-desc', 'key-desc', 'energy-asc', 'energy-desc', 'danceability-asc', 'danceability-desc'].
|
93
|
+
# @option options [String] :limit If 'true', limit the results to any of the given rosetta id space. Must be on of ['true', 'false'] with 'false' as the default. If limit is set to anything but false, at least one idspace must also be provided in the bucket parameter.
|
94
|
+
# @option options [String] :dmca If true or 'styleb' the playlist delivered will meet the DMCA rules. When the DMCA parameter is set to true, the playlist will conform to the following rules: No more than 2 songs in a row from the same album, no more than 3 songs from an album in a 3 hour period, no more than 3 different songs in a row by the same artist, no more than 4 songs by the same artist in a 3 hour period. Skipped songs are not considered to have been played for DMCA conformance purposes. If dmca is set to 'styleb', skipped songs are considered to have been played for DMCA purposes.
|
95
|
+
# @return [Array<Echowrap::Song>
|
96
|
+
# @example Return an array of songs with artist 'Daft Punk'
|
97
|
+
# Echowrap.playlist_static(:artist => "Daft Punk")
|
98
|
+
def playlist_static(options={})
|
99
|
+
objects_from_response(Echowrap::Song, :get, '/api/v4/playlist/static', :songs, options)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Creates a new dynamic playlist session. A dynamic playlist is created with an initial set of parameters that define rules for generating the playlist. A session identifier is returned that can be used with other dynamic methods to get new songs, provide feedback or to steer the playlist. Songs in the playlist can be fetched, one at a time, using the dynamic/next method. The playlist is dynamic in that it is adapted dynamically based on the listener's feedback and steering.
|
103
|
+
# The dynamic playlist will adapt the playlist session based upon a number of factors:
|
104
|
+
# Played songs
|
105
|
+
# Skipped songs
|
106
|
+
# Rated songs/artists
|
107
|
+
# Favorited songs/artists
|
108
|
+
# Banned songs/artists
|
109
|
+
# Playlist steering
|
110
|
+
# The dynamic/create method accepts the same set of parameters as the playlist/static method with the exception of the results parameter.
|
111
|
+
# @see http://developer.echonest.com/docs/v4/playlist.html#dynamic-create
|
112
|
+
# @authentication Requires api key
|
113
|
+
# @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
|
114
|
+
# @return [Echowrap::Playlist]
|
115
|
+
# @param options [Hash] A customizable set of options.
|
116
|
+
# @option options [String] :session_catalog The IDs of catalogs that should be updated with session information (plays, skips, ratings,bans, favorites, etc). Multiple session catalogs can be listed and all will be updated with the same information. The session catalogs must have been previously created using the same API key as used in this call. May use muliple up to 5. Example: 'CAKSMUX1321A708AA4'
|
117
|
+
#
|
118
|
+
# @option
|
119
|
+
# @return [Echowrap::Playlist]
|
120
|
+
# @example Return a playlist with a session ID
|
121
|
+
# Echowrap.playlist_dynamic_create(:artist => "Daft Punk")
|
122
|
+
def playlist_dynamic_create(options={})
|
123
|
+
object_from_response(Echowrap::Playlist, :get, '/api/v4/playlist/dynamic/create', nil, options)
|
124
|
+
end
|
125
|
+
|
126
|
+
# Restarts a playlist session. Given the session ID and a new set of playlist parameters, this method restarts the playlist session based upon the new parameters. The session history is maintained. Everything else is reset. This method takes all the same parameters as dynamic/create, plus the session ID. Returns the given session ID.
|
127
|
+
# @see http://developer.echonest.com/docs/v4/playlist.html#dynamic-restart
|
128
|
+
# @authentication Requires api key
|
129
|
+
# @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
|
130
|
+
# @return [Echowrap::Playlist]
|
131
|
+
# @param options [Hash] A customizable set of options.
|
132
|
+
# @option options [String] :session_id ID of session. Required. Example: '7bf982d80ed8421c8c94dbd6de565e9d'
|
133
|
+
#
|
134
|
+
# @option
|
135
|
+
# @return [Echowrap::Playlist]
|
136
|
+
# @example Return a playlist with a session ID
|
137
|
+
# Echowrap.playlist_dynamic_restart(:session_id => '7bf982d80ed8421c8c94dbd6de565e9d', :artist => "Daft Punk")
|
138
|
+
def playlist_dynamic_restart(options={})
|
139
|
+
object_from_response(Echowrap::Playlist, :get, '/api/v4/playlist/dynamic/restart', nil, options)
|
140
|
+
end
|
141
|
+
|
142
|
+
# Returns the next songs in the playlist. Results includes two lists of songs - one list (called next) contains the next songs to play, the other (called lookahead) contains the lookahead songs (controlled via the lookahead parameter). The next songs returned by this method will be considered to be played starting at the time the call returns. Use the dynamic/feedback method to indicate that the song was skipped or not played.
|
143
|
+
# @see http://developer.echonest.com/docs/v4/playlist.html#dynamic-restart
|
144
|
+
# @authentication Requires api key
|
145
|
+
# @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
|
146
|
+
# @return [Echowrap::Playlist]
|
147
|
+
# @param options [Hash] A customizable set of options.
|
148
|
+
# @option options [String] :session_id ID of session. Required. Example: '7bf982d80ed8421c8c94dbd6de565e9d'
|
149
|
+
# @option options [Integer] :results The desired number of next songs returned. Maybe be one of [0, 1, 5]. Requesting zero results, when combined with a non-zero lookahead, allows you to retrieve the next 1-5 songs without any assumptions about songs being played. Requesting zero results returns the lookahead only, no 'results' will be returned. No songs are assumed played nor are any added to the history or any associated session catalogs. The playlist is not advanced. Making consecutive dynamic/next calls with zero results will return the exact same set of lookahead tracks. You must provide feedback (via the dynamic/feedback api), to explicitly play and/or skip songs in the playlist in order to advance the playlist when 'results' is set to zero.
|
150
|
+
# @option options [Integer] :lookahead Number of lookahead songs to return. Lookahead songs are the next songs that will be returned to be played if no user feedback or steering occurs before the next dynamic/next method call. Not required, may be 0 to 5.
|
151
|
+
#
|
152
|
+
# @option
|
153
|
+
# @return [Echowrap::Playlist]
|
154
|
+
# @example Return a playlist with songs and lookaheads
|
155
|
+
# Echowrap.playlist_dynamic_next(:session_id => 7bf982d80ed8421c8c94dbd6de565e9d')
|
156
|
+
def playlist_dynamic_next(options={})
|
157
|
+
object_from_response(Echowrap::Playlist, :get, '/api/v4/playlist/dynamic/next', nil, options)
|
158
|
+
end
|
159
|
+
|
160
|
+
# Give feedback on the given items (artists or songs) or the last played song. This method allows you to give user feedback such as rating, favoriting, banning of a song or artist. Feedback is applied to the item specified by the given song_id or track_id. If no song_id or track_id is specified, then the feedback is applied to the most recent song returned by dynamic/next. Multiple feedbacks can be given at any time. Specified songs need not be in the session history. This allows the pre-seeding of a session with played tracks, skipped tracks, favorites, ratings and bans.
|
161
|
+
# @see http://developer.echonest.com/docs/v4/playlist.html#dynamic-feedback
|
162
|
+
# @authentication Requires api key
|
163
|
+
# @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
|
164
|
+
# @return [Boolean]
|
165
|
+
# @param options [Hash] A customizable set of options.
|
166
|
+
# @option options [String] :session_id ID of session. Required. Example: '7bf982d80ed8421c8c94dbd6de565e9d'
|
167
|
+
# @option options [String] :ban_artist The given artist, or the artist associated with the given song or track is banned from the session and will never appear again. Use 'last' to ban the artist of the most recently returned song. Examples: 'ARH6W4X1187B99274F' or 'SOCZMFK12AC468668F' or 'TRTLKZV12E5AC92E11' or 'last'.
|
168
|
+
# @option options [String] :favorite_artist The given artist, or the artist associated with the given song or track is favorited. Use 'last' to favorite the artist of the most recently returned song. Examples: 'ARH6W4X1187B99274F' or 'SOCZMFK12AC468668F' or 'TRTLKZV12E5AC92E11' or 'last'.
|
169
|
+
# @option options [String] :ban_song The given song is banned from the session and will never appear again. Use 'last' to ban the most recently returned song. Examples: 'SOCZMFK12AC468668F' or 'TRTLKZV12E5AC92E11' or 'last'.
|
170
|
+
# @option options [String] :skip_song If the given song is in the session history, it is considered to be skipped. The play timestamp of subsequent songs in the session history are adjusted to reflect the skipped song. The skipped song will never appear again in the session. Use last to skip the most recently returned song. Use 'last' to ban the most recently returned song. Examples: 'SOCZMFK12AC468668F' or 'TRTLKZV12E5AC92E11' or 'last'.
|
171
|
+
# @option options [String] :favorite_song The given song is favorited. Use 'last' to favorite the most recently returned song. Examples: 'SOCZMFK12AC468668F' or 'TRTLKZV12E5AC92E11' or 'last'.
|
172
|
+
# @option options [String] :unplay_song This given song is considered not played. Unlike the skip_song operation, the song may appear again in the session. This operation is typically used when a song is retrieved by the dynamic/next call but for whatever reason is not actually played in the client. Use 'last' to unplay the most recently returned song. Examples: 'SOCZMFK12AC468668F' or 'TRTLKZV12E5AC92E11' or 'last'.
|
173
|
+
# @option options [String] :rate_song The given rating is applied to the song Ratings are of the form: song_id^rating where rating is a value between 0 and 10. Use 'last' to rate the most recently returned song. Examples: 'SOCZMFK12AC468668F^5' or 'TRTLKZV12E5AC92E11^8' or 'last^1'.
|
174
|
+
# @option options [String] :update_catalog This parameter controls whether or not this given feedback is pushed to the seed_catalog. By default, all feedback is pushed to the seed_catalog. If this parameter is false then feedback is not pushed to the catalog. This parameter has no effect if there is no seed_catalog associated with the playlist session. Not required must be one of ['true', 'false'].
|
175
|
+
# @option options [String] :invalidate_song The given song is removed from the play history and will never appear again in the playlist session. This feedback is typically used to discard a song that is unplayable. Examples: 'ARH6W4X1187B99274F' or 'SOCZMFK12AC468668F' or 'TRTLKZV12E5AC92E11' or 'last'.
|
176
|
+
# @option options [String] :invalidate_artist The given artist, or the artist associated with the given song or track is removed from the play history and will never appear again in this playlist session. This feedback is typically used to discard an artist that is unplayable. Examples: 'ARH6W4X1187B99274F' or 'SOCZMFK12AC468668F' or 'TRTLKZV12E5AC92E11' or 'last'.
|
177
|
+
#
|
178
|
+
# @option
|
179
|
+
# @return [Boolean]
|
180
|
+
# @example Return boolean with status of response
|
181
|
+
# Echowrap.playlist_dynamic_feedback(:session_id => 7bf982d80ed8421c8c94dbd6de565e9d', :favorite_song => 'SOCZMFK12AC468668F')
|
182
|
+
def playlist_dynamic_feedback(options={})
|
183
|
+
boolean_from_response(:get, '/api/v4/playlist/dynamic/feedback', options)
|
184
|
+
end
|
185
|
+
|
186
|
+
|
187
|
+
# Steers the playlist based upon the given constraints. Steerings are additive and can be reset with the reset parameter.
|
188
|
+
# @see http://developer.echonest.com/docs/v4/playlist.html#dynamic-steer
|
189
|
+
# @authentication Requires api key
|
190
|
+
# @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
|
191
|
+
# @return [Boolean]
|
192
|
+
# @param options [Hash] A customizable set of options.
|
193
|
+
# @option options [String] :session_id ID of session. Required. Example: '7bf982d80ed8421c8c94dbd6de565e9d'
|
194
|
+
# @option options [Float] :min_xxx Prefer songs that have a value for xxx that is greater than or equal to the given value where xxx can be tempo, loudness, danceability, energy, liveness, speechiness, song_hotttnesss, artist_hotttnesss, artist_familiarity. Not required, may send multiple. Examples 'min_song_hotness=0.0', 'min_artist_hotttnesss' => 0.2.
|
195
|
+
# @option options [Float] :max_xxx Prefer songs that have a value for xxx that is less than or equal to the given value where xxx can be tempo, loudness, danceability, energy, liveness, speechiness, song_hotttnesss, artist_hotttnesss, artist_familiarity.
|
196
|
+
# @option options [String] :target_xxx Pefer songs that have a value for xxx that are closer to the given value where xxx can be tempo, loudness, danceability, energy, liveness, speechiness, song_hotttnesss, artist_hotttnesss, artist_familiarity.
|
197
|
+
# @option options [String] :more_like_this Prefer songs that are more similar to the given song ID with the given optional boost. song_id can be last to use the most recently returned song. Boost can be an integer between 0 and 5. The default is 1. Examples: 'SO12341234^2', 'SO123412341234^5'.
|
198
|
+
# @option options [String] :less_like_this Prefer songs that are less similar to the given song ID with the given optional boost. song_id can be last to use the most recently returned song. Boost can be an integer between 0 and 5. The default is 1. Examples: 'SO12341234^2', 'SO123412341234^5'.
|
199
|
+
# @option options [Float] :adventerousness Adjust the adventurousness of the session. A value of 0 means no adventurousness, only known and preferred music will be played. A value of 1 means high adventurousness, mostly unknown music will be played. This parameter only applies to catalog and catalog-radio type playlists. Examples: '0.14', '0.7', '1.0'.
|
200
|
+
# @option options [Float] :variety Adjust the variety of the session. A higher number will allow for more variety in the artists. Examples: '0.14', '0.7', '1.0'.
|
201
|
+
# @option options [String] :description Prefer songs by artists that match the given general description. Not required, may use multiple. Example: 'alt-rock,-emo,harp^2'.
|
202
|
+
# @option options [String] :style Prefer songs by artists that match the given style some examples are: 'jazz', 'metal^2'.
|
203
|
+
# @option options [String] :song_type Prefers songs that match the given song type. Supported song_types are: 'christmas', 'live' and 'studio'. A song type can optionally be followed by ':' and a state, where the state can be one of 'true', 'false' or 'any'. If no state is given, the desired state is assumed to be 'true'.
|
204
|
+
# @option options [String] :mood Prefer songs by artists that match the given mood, some examples are: 'happy', 'sad^.5'.
|
205
|
+
# @option options [String] :reset Resets any playlist steering that has been done on this session to the default state. False is default.
|
206
|
+
#
|
207
|
+
# @option
|
208
|
+
# @return [Boolean]
|
209
|
+
# @example Return boolean with status of response
|
210
|
+
# Echowrap.playlist_dynamic_steer(:session_id => 7bf982d80ed8421c8c94dbd6de565e9d', :min_danceability => 0.4)
|
211
|
+
def playlist_dynamic_steer(options={})
|
212
|
+
boolean_from_response(:get, '/api/v4/playlist/dynamic/steer', options)
|
213
|
+
end
|
214
|
+
|
215
|
+
# Returns information about a dynamic playlist session
|
216
|
+
# @see http://developer.echonest.com/docs/v4/playlist.html#dynamic-info
|
217
|
+
# @authentication Requires api key
|
218
|
+
# @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
|
219
|
+
# @return [Echowrap::Playlist]
|
220
|
+
# @param options [Hash] A customizable set of options.
|
221
|
+
# @option options [String] :session_id ID of session. Required. Example: '7bf982d80ed8421c8c94dbd6de565e9d'
|
222
|
+
#
|
223
|
+
# @option
|
224
|
+
# @return [Echowrap::Playlist]
|
225
|
+
# @example Return boolean with status of response
|
226
|
+
# Echowrap.playlist_dynamic_info(:session_id => 7bf982d80ed8421c8c94dbd6de565e9d')
|
227
|
+
def playlist_dynamic_info(options={})
|
228
|
+
object_from_response(Echowrap::Playlist, :get, '/api/v4/playlist/dynamic/info', nil, options)
|
229
|
+
end
|
230
|
+
|
231
|
+
# Deletes a previously created session. A non-commercial API can have, at most 1,000 active playlist sessions.
|
232
|
+
# @see http://developer.echonest.com/docs/v4/playlist.html#dynamic-delete
|
233
|
+
# @authentication Requires api key
|
234
|
+
# @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
|
235
|
+
# @return [Boolean]
|
236
|
+
# @param options [Hash] A customizable set of options.
|
237
|
+
# @option options [String] :session_id ID of session. Required. Example: '7bf982d80ed8421c8c94dbd6de565e9d'
|
238
|
+
#
|
239
|
+
# @option
|
240
|
+
# @return [Boolean]
|
241
|
+
# @example Return boolean with status of response
|
242
|
+
# Echowrap.playlist_dynamic_delete(:session_id => 7bf982d80ed8421c8c94dbd6de565e9d')
|
243
|
+
def playlist_dynamic_delete(options={})
|
244
|
+
boolean_from_response(:get, '/api/v4/playlist/dynamic/delete', options)
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'echowrap/api/utils'
|
2
|
+
|
3
|
+
module Echowrap
|
4
|
+
module API
|
5
|
+
module Sandbox
|
6
|
+
include Echowrap::API::Utils
|
7
|
+
|
8
|
+
# Lists detailed information about each asset in the sandbox. This method describes each asset in detail but does not provide direct access to the assets. This method does not require an approved API key. Note that different sandboxes may return different sets of data and metadata.
|
9
|
+
#
|
10
|
+
# @see http://developer.echonest.com/docs/v4/sandbox.html#list
|
11
|
+
# @authentication Requires api key
|
12
|
+
# @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
|
13
|
+
# @raise [Echowrap::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
14
|
+
# @return [Echowrap::Sandbox] The sandbox
|
15
|
+
# @param options [Hash] A customizable set of options.
|
16
|
+
# @option options [String] :sandbox The name of the sandbox. Required. Example: 'emi_evanescence'.
|
17
|
+
# @option options [Integer] :results The number of results desired. Not required, defaults to 15, must be between 0 and 100.
|
18
|
+
# @option options [Integer] :start The desired index of the first result returned. Not required, defaults to 0, must be one of [0, 15, 30].
|
19
|
+
#
|
20
|
+
# @example sandbox_list
|
21
|
+
# Echowrap.sandbox_list(:sandbox => 'emi_evanescence')
|
22
|
+
def sandbox_list(options={})
|
23
|
+
object_from_response(Echowrap::Sandbox, :get, '/api/v4/sandbox/list', nil, options)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Gets access to the listed assets. This method returns a secure token or URL that can be used by the application to access the asset. This method requires an API key that has been approved for the sandbox.
|
27
|
+
# NOTE: This method uses Oauth, the oauth parameters are generated and inserted by this gem automatically and do not need to be manually added.
|
28
|
+
#
|
29
|
+
# @see http://developer.echonest.com/docs/v4/sandbox.html#access
|
30
|
+
# @authentication Requires api key
|
31
|
+
# @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
|
32
|
+
# @raise [Echowrap::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
33
|
+
# @return [Echowrap::Sandbox] The sandbox
|
34
|
+
# @param options [Hash] A customizable set of options.
|
35
|
+
# @option options [String] :sandbox The name of the sandbox. Required. Example: 'emi_evanescence'.
|
36
|
+
# @option options [String] :The ID of the asset. Required, may send multiple. Example: 'c1b89c9b9e0ee9e53650f1d4e393d716'.
|
37
|
+
#
|
38
|
+
# @example sandbox_access
|
39
|
+
# Echowrap.sandbox_access(:sandbox => 'emi_evanescence', :id => 'c1b89c9b9e0ee9e53650f1d4e393d716')
|
40
|
+
def sandbox_access(options={})
|
41
|
+
objects_from_response(Echowrap::Asset, :get, '/api/v4/sandbox/access', :assets, options.merge(:oauth_request => true))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require 'echowrap/api/utils'
|
2
|
+
|
3
|
+
module Echowrap
|
4
|
+
module API
|
5
|
+
module Song
|
6
|
+
include Echowrap::API::Utils
|
7
|
+
|
8
|
+
# Identifies a song given an Echoprint or Echo Nest Musical Fingerprint hash codes.
|
9
|
+
#
|
10
|
+
# @see http://developer.echonest.com/docs/v4/song.html
|
11
|
+
# @authentication Requires api key
|
12
|
+
# @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.
|
13
|
+
# @return [Echowrap::Track] The identified song.
|
14
|
+
# @param options [Hash] A customizable set of options.
|
15
|
+
# @option options [String] :query The JSON query. Use only with POST. Example: See "Here is a sample query:" at http://developer.echonest.com/docs/v4/song.html#identify.
|
16
|
+
# @option options [String] :code The FP hashcodes for the track. Use only with GET. Example: See "Identifying Songs with GET at http://developer.echonest.com/docs/v4/song.html#identify."
|
17
|
+
# @option options [String] :artist The name of the artist from the ID3 tag. Use only with GET, not required. Example: 'Michael+Jackson'
|
18
|
+
# @option options [String] :title The title of the track from the ID3 tag. Use only with GET, not required. Example: 'Billie+Jean'
|
19
|
+
# @option options [String] :release The title of the track from the ID3 tag. Use only with GET, not required. Example: 'Thriller'
|
20
|
+
# @option options [String] :duration The length of time of the track, in seconds. Use only with GET, not required. Example: '296.15'
|
21
|
+
# @option options [String] :genre The genre from the ID3 tag. Use only with GET, not required. Example: 'pop'
|
22
|
+
# @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
|
23
|
+
# @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.
|
24
|
+
# @example Identify via json query file
|
25
|
+
# Echowrap.song_identify(:query => File.new('query.json'))
|
26
|
+
def song_identify(options={})
|
27
|
+
if options.key?(:query)
|
28
|
+
objects_from_response(Echowrap::Song, :post, '/api/v4/song/identify', :songs, options).first
|
29
|
+
else
|
30
|
+
objects_from_response(Echowrap::Song, :get, '/api/v4/song/identify', :songs, options).first
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
# Get info about songs given a song id or track id.
|
36
|
+
#
|
37
|
+
# @see http://developer.echonest.com/docs/v4/song.html
|
38
|
+
# @authentication Requires api key
|
39
|
+
# @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.
|
40
|
+
# @return [Echowrap::Song] The song.
|
41
|
+
# @param options [Hash] A customizable set of options.
|
42
|
+
# @option options [String] :id The ID of the song. Required if track_id is not provided. Example: 'SOCZMFK12AC468668F'.
|
43
|
+
# @option options [String] :track_id The ID of the track. Required if id is not provided. Example: 'TRTLKZV12E5AC92E11'.
|
44
|
+
# @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.
|
45
|
+
# @example Profile via id
|
46
|
+
# Echowrap.song_profile(:id => 'SOCZMFK12AC468668F')
|
47
|
+
def song_profile(options={})
|
48
|
+
objects_from_response(Echowrap::Song, :get, '/api/v4/song/profile', :songs, options).first
|
49
|
+
end
|
50
|
+
|
51
|
+
# Search for songs given different query types
|
52
|
+
#
|
53
|
+
# @see http://developer.echonest.com/docs/v4/song.html
|
54
|
+
# @authentication Requires api key
|
55
|
+
# @raise [Echowrap::Error::Unauthorized] Error raised when supplied api key is not valid.
|
56
|
+
# @return [Array] Array of songs.
|
57
|
+
# @param options [Hash] A customizable set of options.
|
58
|
+
# @option options [String] :title The title of the song.
|
59
|
+
# @option options [String] :artist The artist of the song.
|
60
|
+
# @option options [String] :combined Query both artist and title fields.
|
61
|
+
# @option options [String] :description A description of the artist, some examples are: 'alt-rock','-emo', 'harp^2'. Warning Description cannot be used in conjunction with title, artist, combined, or artist_id.
|
62
|
+
# @option options [String] :style A musical style or genre like rock, jazz, or funky, some examples are: 'jazz', 'metal^2'.
|
63
|
+
# @option options [String] :mood A mood like happy or sad, some examples are: 'happy', 'sad^.5'.
|
64
|
+
# @option options [String] :rank_type For search by description, style or mood indicates whether results should be ranked by query relevance or by artist familiarity, must be one of ['relevance', 'familiarity'], with 'relevance' as default
|
65
|
+
# @option options [String] :artist_id The artist ID. An Echo Nest ID or a Rosetta ID.
|
66
|
+
# @option options [Integer] :results The desired number of results to return, the valid range is 0 to 100, with 15 as the default
|
67
|
+
# @option options [Integer] :start The desired index of the first result returned, must be on of [0, 15, 30] with 0 as the default
|
68
|
+
# @option options [String] :song_type Controls the type of songs returned. Supported song_types are: 'christmas', 'live' and 'studio'. A song type can optionally be followed by ':' and a state, where the state can be one of 'true', 'false' or 'any'. If no state is given, the desired state is assumed to be 'true'.
|
69
|
+
# @option options [Float] :max_tempo The maximum tempo for the song, the valid range for max_tempo is 0.0 to 500.0 (BPM), with 500.0 as default.
|
70
|
+
# @option options [Float] :min_tempo The minimum tempo for the song, the valid range for min_tempo is 0.0 to 500.0 (BPM), with 0.0 as default.
|
71
|
+
# @option options [Float] :max_duration The maximum duration of any song, the valid range for max_duration is 0.0 to 3600.0 (seconds), with 3600.0 as default.
|
72
|
+
# @option options [Float] :min_duration The minimum duration of any song, the valid range for min_duration is 0.0 to 3600.0 (seconds), with 0.0 as default.
|
73
|
+
# @option options [Float] :max_loudness The maximum loudness of any song, the valid range for max_loudness is -100.0 to 100.0 (decibels), with 100.0 as default.
|
74
|
+
# @option options [Float] :min_loudness The minimum loudness of any song, the valid range for min_loudness is 0.0 to -100.0 (decibels), with -100.0 as default.
|
75
|
+
# @option options [Float] :artist_max_familiarity The maximum familiarity of any song, the valid range for artist_max_familiarity is 0.0 to 1.0, with 1.0 as default.
|
76
|
+
# @option options [Float] :artist_min_familiarity The minimum familiarity of any song, the valid range for artist_min_familiarity is 0.0 to 1.0, with 0.0 as default.
|
77
|
+
# @option options [String] :artist_start_year_before Matches artists that have an earliest start year before the given value, some examples are '1970', '2011', 'present'.
|
78
|
+
# @option options [String] :artist_start_year_after Matches artists that have an earliest start year after the given value, some examples are '1970', '2011', 'present'.
|
79
|
+
# @option options [String] :artist_end_year_before Matches artists that have an latest start year before the given value, some examples are '1970', '2011', 'present'.
|
80
|
+
# @option options [String] :artist_end_year_after Matches artists that have an latest start year after the given value, some examples are '1970', '2011', 'present'.
|
81
|
+
# @option options [Float] :song_max_hotttnesss The maximum hotttnesss of any song, the valid range for song_max_hotttnesss is 0.0 to 1.0, with 1.0 as default.
|
82
|
+
# @option options [Float] :song_min_hotttnesss The minimum hotttnesss of any song, the valid range for the song_min_hotttnesss is 0.0 to 1.0, with 0.0 as default.
|
83
|
+
# @option options [Float] :artist_max_hotttnesss The maximum hotttnesss of any song's artist, the valid range for artist_max_hotttnesss is 0.0 to 1.0, with 1.0 as default.
|
84
|
+
# @option options [Float] :artist_min_hotttnesss The minimum hotttnesss of any song's artist, the valid range for the artist_min_hotttnesss is 0.0 to 1.0, with 0.0 as default.
|
85
|
+
# @option options [Float] :max_longitude The maximum longitude of the primary artist location, the valid range for max_longitude is -180.0 to 180.0, with 180.0 as default.
|
86
|
+
# @option options [Float] :min_longitude The minimum longitude of the primary artist location, the valid range for min_longitude is -180.0 to 180.0, with -180.0 as default.
|
87
|
+
# @option options [Float] :max_latitude The maximum latitude of the primary artist location, the valid range for max_latitude is -90.0 to 90.0, with 90.0 as default.
|
88
|
+
# @option options [Float] :min_latitude The minimum longitude of the primary artist location, the valid range for max_latitude is -90.0 to 90.0, with -90.0 as default.
|
89
|
+
# @option options [Float] :max_danceability The maximum danceability of any song, the valid range for max_danceability is 0.0 to 1.0, with 1.0 as default.
|
90
|
+
# @option options [Float] :min_danceability The minimum danceability of any song, the valid range for min_danceability is 0.0 to 1.0, with 0.0 as default.
|
91
|
+
# @option options [Float] :max_energy The maximum energy of any song, the valid range for max_energy is 0.0 to 1.0, with 1.0 as default.
|
92
|
+
# @option options [Float] :min_energy The minimum energy of any song, the valid range for min_energy is 0.0 to 1.0, with 0.0 as default.
|
93
|
+
# @option options [Float] :max_liveness The maximum liveness of any song, the valid range for max_liveness is 0.0 to 1.0, with 1.0 as default.
|
94
|
+
# @option options [Float] :min_liveness The minimum liveness of any song, the valid range for min_liveness is 0.0 to 1.0, with 0.0 as default.
|
95
|
+
# @option options [Float] :max_speechiness The maximum speechiness of any song, the valid range for max_speechiness is 0.0 to 1.0, with 1.0 as default.
|
96
|
+
# @option options [Float] :min_speechiness The minimum speechiness of any song, the valid range for min_speechiness is 0.0 to 1.0, with 0.0 as default.
|
97
|
+
# @option options [Integer] :key The key of songs in the playlist, the valid range for key is 0 to 11 (C, C-sharp, D, D-sharp, E... with 0 representing C and 11 representing B).
|
98
|
+
# @option options [Integer] :mode The mode of songs, must be one of [0, 1] (minor, major), with 0 representing minor and 1 represeting major.
|
99
|
+
# @option options [String] :bucket Indicates what data should be returned for each song. If specifying the "tracks" bucket, a bucket with an id space must also be specified. Must be one of ['audio_summary', 'artist_familiarity', 'artist_hotttnesss', 'artist_location', 'song_hotttnesss', 'song_type', 'tracks', 'id:Rosetta-space'].
|
100
|
+
# @option options [String] :sort Indicates how the songs results should be ordered. Must be one of ['tempo-asc', 'duration-asc', 'loudness-asc', 'speechiness-asc', 'liveness-asc', 'artist_familiarity-asc', 'artist_hotttnesss-asc', 'artist_start_year-asc', 'artist_start_year-desc', 'artist_end_year-asc', 'artist_end_year-desc', 'song_hotttness-asc', 'latitude-asc', 'longitude-asc', 'mode-asc', 'key-asc', 'tempo-desc', 'duration-desc', 'loudness-desc', 'liveness-desc', 'speechiness-desc', 'artist_familiarity-desc', 'artist_hotttnesss-desc', 'song_hotttnesss-desc', 'latitude-desc', 'longitude-desc', 'mode-desc', 'key-desc', 'energy-asc', 'energy-desc', 'danceability-asc', 'danceability-desc'].
|
101
|
+
# @option options [String] :limit If 'true', limit the results to any of the given idspaces or catalogs. Must be on of ['true', 'false'] with 'false' as the default.
|
102
|
+
# @return [Array<Echowrap::Song>]
|
103
|
+
# @example Return an array of songs with artist 'Daft Punk'
|
104
|
+
# Echowrap.song_search(:artist => "Daft Punk")
|
105
|
+
def song_search(options={})
|
106
|
+
objects_from_response(Echowrap::Song, :get, '/api/v4/song/search', :songs, options)
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|