echonest-ruby-api 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Rakefile +1 -1
- data/fixtures/vcr_cassettes/profile.yml +1 -1
- data/fixtures/vcr_cassettes/song_profile.yml +98 -0
- data/fixtures/vcr_cassettes/song_search.yml +211 -1
- data/fixtures/vcr_cassettes/terms.yml +112 -29
- data/lib/echonest-ruby-api/artist.rb +2 -2
- data/lib/echonest-ruby-api/base.rb +13 -8
- data/lib/echonest-ruby-api/biography.rb +9 -7
- data/lib/echonest-ruby-api/blog.rb +10 -8
- data/lib/echonest-ruby-api/error.rb +14 -6
- data/lib/echonest-ruby-api/foreign_id.rb +14 -12
- data/lib/echonest-ruby-api/song.rb +10 -0
- data/lib/echonest-ruby-api/version.rb +1 -1
- data/spec/artist_spec.rb +12 -0
- data/spec/foreign_id_spec.rb +3 -3
- data/spec/song_spec.rb +31 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f288056fa5a3353428271b37081c449ec7032f7c
|
4
|
+
data.tar.gz: e12695b8c5b341a27135ee642f9f2529cbbfc33f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09b2ba497b597325561b85270b01be58df358ae6d34d72ad7e4d87f5470141431134b6b9213e78fabf64280a4aff1bdc49247de91462a8c887a58d1e551af0e2
|
7
|
+
data.tar.gz: 10bcb241f1e2cba792063962ef04043f97b494ec1a44cda8008861f98ddc3a94c47f27995b923c27286fb8c08eae96f834e6e0d44dc2ecd626c192d629d86400
|
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: http://developer.echonest.com/api/v4/artist/profile?api_key=BNOAEBT3IZYZI6WXI&format=json&id=ARH6W4X1187B99274F
|
5
|
+
uri: http://developer.echonest.com/api/v4/artist/profile?api_key=BNOAEBT3IZYZI6WXI&format=json&id=ARH6W4X1187B99274F
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -0,0 +1,98 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://developer.echonest.com/api/v4/song/search?api_key=BNOAEBT3IZYZI6WXI&format=json&id=SOCRHFJ12A67021D74
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 400
|
13
|
+
message: Bad Request
|
14
|
+
headers:
|
15
|
+
Date:
|
16
|
+
- Wed, 13 Nov 2013 01:24:56 GMT
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=utf-8
|
19
|
+
Content-Length:
|
20
|
+
- '104'
|
21
|
+
X-Request-Id:
|
22
|
+
- I8IxYezuT2+w1YUa3Mc9sA
|
23
|
+
X-Ratelimit-Remaining:
|
24
|
+
- '19'
|
25
|
+
Server:
|
26
|
+
- TornadoServer/3.1
|
27
|
+
X-Ratelimit-Limit:
|
28
|
+
- '20'
|
29
|
+
X-Api-Key:
|
30
|
+
- BNOAEBT3IZYZI6WXI
|
31
|
+
X-Ratelimit-Used:
|
32
|
+
- '1'
|
33
|
+
Connection:
|
34
|
+
- Keep-alive
|
35
|
+
Keep-Alive:
|
36
|
+
- timeout=15, max=100
|
37
|
+
Via:
|
38
|
+
- 1.1 ID-0000627501223666 uproxy-2
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ! '{"response": {"status": {"version": "4.2", "code": 5, "message":
|
42
|
+
"method - Invalid parameter: \"id\""}}}'
|
43
|
+
http_version:
|
44
|
+
recorded_at: Wed, 13 Nov 2013 01:24:56 GMT
|
45
|
+
- request:
|
46
|
+
method: get
|
47
|
+
uri: http://developer.echonest.com/api/v4/song/profile?api_key=BNOAEBT3IZYZI6WXI&format=json&id=SOCRHFJ12A67021D74
|
48
|
+
body:
|
49
|
+
encoding: US-ASCII
|
50
|
+
string: ''
|
51
|
+
headers: {}
|
52
|
+
response:
|
53
|
+
status:
|
54
|
+
code: 200
|
55
|
+
message: OK
|
56
|
+
headers:
|
57
|
+
Date:
|
58
|
+
- Wed, 13 Nov 2013 01:26:37 GMT
|
59
|
+
Content-Type:
|
60
|
+
- application/json; charset=utf-8
|
61
|
+
Content-Length:
|
62
|
+
- '201'
|
63
|
+
Vary:
|
64
|
+
- Accept-Encoding
|
65
|
+
X-Request-Id:
|
66
|
+
- NvdAOls0Qom57WkgmWTwmw
|
67
|
+
Etag:
|
68
|
+
- ! '"b756f588c500d1f36868111e5e3185c70788dcd9"'
|
69
|
+
X-Worker-Node:
|
70
|
+
- 2902a:22872
|
71
|
+
X-Ratelimit-Remaining:
|
72
|
+
- '19'
|
73
|
+
Server:
|
74
|
+
- TornadoServer/3.1
|
75
|
+
X-Ratelimit-Limit:
|
76
|
+
- '20'
|
77
|
+
X-Api-Key:
|
78
|
+
- BNOAEBT3IZYZI6WXI
|
79
|
+
Cache-Control:
|
80
|
+
- max-age=86400
|
81
|
+
Access-Control-Allow-Origin:
|
82
|
+
- ! '*'
|
83
|
+
X-Ratelimit-Used:
|
84
|
+
- '1'
|
85
|
+
Connection:
|
86
|
+
- Keep-alive
|
87
|
+
Keep-Alive:
|
88
|
+
- timeout=15, max=100
|
89
|
+
Via:
|
90
|
+
- 1.1 ID-0000627501223666 uproxy-3
|
91
|
+
body:
|
92
|
+
encoding: US-ASCII
|
93
|
+
string: ! '{"response": {"status": {"version": "4.2", "code": 0, "message":
|
94
|
+
"Success"}, "songs": [{"artist_id": "AR633SY1187B9AC3B9", "id": "SOCRHFJ12A67021D74",
|
95
|
+
"artist_name": "Weezer", "title": "El Scorcho"}]}}'
|
96
|
+
http_version:
|
97
|
+
recorded_at: Wed, 13 Nov 2013 01:26:37 GMT
|
98
|
+
recorded_with: VCR 2.7.0
|
@@ -67,4 +67,214 @@ http_interactions:
|
|
67
67
|
"Kate Truka", "title": "Hello"}]}}'
|
68
68
|
http_version:
|
69
69
|
recorded_at: Sat, 23 Feb 2013 13:15:51 GMT
|
70
|
-
|
70
|
+
- request:
|
71
|
+
method: get
|
72
|
+
uri: http://developer.echonest.com/api/v4/song/search?api_key=BNOAEBT3IZYZI6WXI&bucket=tracks&combined=weezer%20-%20El%20Scorcho&format=json
|
73
|
+
body:
|
74
|
+
encoding: US-ASCII
|
75
|
+
string: ''
|
76
|
+
headers: {}
|
77
|
+
response:
|
78
|
+
status:
|
79
|
+
code: 200
|
80
|
+
message: OK
|
81
|
+
headers:
|
82
|
+
Date:
|
83
|
+
- Fri, 08 Nov 2013 16:58:37 GMT
|
84
|
+
Content-Type:
|
85
|
+
- application/json; charset=utf-8
|
86
|
+
Content-Length:
|
87
|
+
- '16013'
|
88
|
+
Vary:
|
89
|
+
- Accept-Encoding
|
90
|
+
X-Request-Id:
|
91
|
+
- LgxMtaIBR0O+lGGIpSLtEw
|
92
|
+
Etag:
|
93
|
+
- ! '"3f970c2b6604bf09bfac5dc9db8575cc20b43492"'
|
94
|
+
X-Worker-Node:
|
95
|
+
- 96cdc:5825
|
96
|
+
X-Ratelimit-Remaining:
|
97
|
+
- '19'
|
98
|
+
Server:
|
99
|
+
- TornadoServer/3.1
|
100
|
+
X-Ratelimit-Limit:
|
101
|
+
- '20'
|
102
|
+
X-Api-Key:
|
103
|
+
- BNOAEBT3IZYZI6WXI
|
104
|
+
Cache-Control:
|
105
|
+
- max-age=86400
|
106
|
+
Access-Control-Allow-Origin:
|
107
|
+
- ! '*'
|
108
|
+
X-Ratelimit-Used:
|
109
|
+
- '1'
|
110
|
+
Connection:
|
111
|
+
- Keep-alive
|
112
|
+
Keep-Alive:
|
113
|
+
- timeout=15, max=100
|
114
|
+
Via:
|
115
|
+
- 1.1 ID-0000627501223666 uproxy-3
|
116
|
+
body:
|
117
|
+
encoding: US-ASCII
|
118
|
+
string: ! '{"response": {"status": {"version": "4.2", "code": 0, "message":
|
119
|
+
"Success"}, "songs": [{"title": "weezer tribute - a tribute to weezer - 09
|
120
|
+
- the stereo - el scorcho", "artist_name": "Weezer", "artist_foreign_ids":
|
121
|
+
[{"catalog": "7digital-US", "foreign_id": "7digital-US:artist:7516"}], "tracks":
|
122
|
+
[], "audio_md5": "e58e471ab8ff27057cea1d0dc02137e6", "artist_id": "AR633SY1187B9AC3B9",
|
123
|
+
"id": "SOFUENY12B0B80A2EC", "audio_summary": {"key": 1, "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/TRVOJHF123E85806AE/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1383930517&Signature=N9El1OYIixssSnev/%2BWJtGn4GDU%3D",
|
124
|
+
"energy": 0.54621717405125914, "liveness": 0.098055736102958091, "tempo":
|
125
|
+
70.117999999999995, "speechiness": 0.039930275002796278, "acousticness": 0.025835454965767436,
|
126
|
+
"mode": 1, "time_signature": 3, "duration": 259.39546000000001, "loudness":
|
127
|
+
-8.4740000000000002, "audio_md5": "e58e471ab8ff27057cea1d0dc02137e6", "valence":
|
128
|
+
0.15291152883100836, "danceability": 0.30119084566305093}}, {"title": "El
|
129
|
+
Scorcho", "artist_name": "Weezer", "artist_foreign_ids": [{"catalog": "7digital-US",
|
130
|
+
"foreign_id": "7digital-US:artist:7516"}], "tracks": [{"release_image": "http://cdn.7static.com/static/img/sleeveart/00/019/385/0001938573_200.jpg",
|
131
|
+
"foreign_release_id": "7digital-US:release:1938573", "preview_url": "http://previews.7digital.com/clips/34/20645785.clip.mp3",
|
132
|
+
"catalog": "7digital-US", "foreign_id": "7digital-US:track:20645785", "id":
|
133
|
+
"TRLJPRE13A79B0D1F9"}, {"release_image": "http://cdn.7static.com/static/img/sleeveart/00/019/177/0001917766_200.jpg",
|
134
|
+
"foreign_release_id": "7digital-US:release:1917766", "preview_url": "http://previews.7digital.com/clips/34/20989891.clip.mp3",
|
135
|
+
"catalog": "7digital-US", "foreign_id": "7digital-US:track:20989891", "id":
|
136
|
+
"TRXMMZF13A79B3D64B"}, {"release_image": "http://cdn.7static.com/static/img/sleeveart/00/019/177/0001917766_200.jpg",
|
137
|
+
"foreign_release_id": "7digital-US:release:1917766", "preview_url": "http://previews.7digital.com/clips/34/20989916.clip.mp3",
|
138
|
+
"catalog": "7digital-US", "foreign_id": "7digital-US:track:20989916", "id":
|
139
|
+
"TRXSOON13A79B3D656"}, {"release_image": "http://cdn.7static.com/static/img/sleeveart/00/019/177/0001917766_200.jpg",
|
140
|
+
"foreign_release_id": "7digital-US:release:1917766", "preview_url": "http://previews.7digital.com/clips/34/20989920.clip.mp3",
|
141
|
+
"catalog": "7digital-US", "foreign_id": "7digital-US:track:20989920", "id":
|
142
|
+
"TRCVEWJ13A79B3F532"}, {"release_image": "http://cdn.7static.com/static/img/sleeveart/00/019/177/0001917766_200.jpg",
|
143
|
+
"foreign_release_id": "7digital-US:release:1917766", "preview_url": "http://previews.7digital.com/clips/34/20989912.clip.mp3",
|
144
|
+
"catalog": "7digital-US", "foreign_id": "7digital-US:track:20989912", "id":
|
145
|
+
"TRQYBOB13A79B3F52C"}], "audio_md5": "92c409b359f3783d719f99da5d6bea30", "artist_id":
|
146
|
+
"AR633SY1187B9AC3B9", "id": "SOCRHFJ12A67021D74", "audio_summary": {"key":
|
147
|
+
1, "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/CGGZbgoAu3VCpEpnaOe2x7lAA6tqvAxM3HbsfVLA66ilt9OZrHaqHfVj5hpaTk3YtCnCF3uIBs8HV0uiM%3D/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1383930517&Signature=hdn0laDJTQeDN%2BYk6yhJznRE9V8%3D",
|
148
|
+
"energy": 0.72650664678888077, "liveness": 0.084808022338250355, "tempo":
|
149
|
+
148.999, "speechiness": 0.073141213941956662, "acousticness": 0.020281331756578286,
|
150
|
+
"mode": 1, "time_signature": 4, "duration": 243.66621000000001, "loudness":
|
151
|
+
-4.4100000000000001, "audio_md5": "92c409b359f3783d719f99da5d6bea30", "valence":
|
152
|
+
0.45570664322192195, "danceability": 0.45255827023781192}}, {"title": "El
|
153
|
+
Scorcho (Director''s Cut)", "artist_name": "Weezer", "artist_foreign_ids":
|
154
|
+
[{"catalog": "7digital-US", "foreign_id": "7digital-US:artist:7516"}], "tracks":
|
155
|
+
[], "audio_md5": "087de450515874932a719c5bd212d131", "artist_id": "AR633SY1187B9AC3B9",
|
156
|
+
"id": "SOPIIUL13E9067B376", "audio_summary": {"key": 8, "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/A3LwHwEzUl3zlWEoM8yk_sDA6dY6i07D9Bnx0l/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1383930517&Signature=S3HcvXe%2Bo0943UTnMNybI9SkngY%3D",
|
157
|
+
"energy": 0.40297031179122894, "liveness": 0.25457472757529687, "tempo": 74.524000000000001,
|
158
|
+
"speechiness": 0.035890067969342687, "acousticness": 0.44464887861795327,
|
159
|
+
"mode": 1, "time_signature": 4, "duration": 246.97556, "loudness": -16.719000000000001,
|
160
|
+
"audio_md5": "087de450515874932a719c5bd212d131", "valence": 0.26112877472791557,
|
161
|
+
"danceability": 0.53420358850477667}}, {"title": "El Scorcho (Live and Acoustic)",
|
162
|
+
"artist_name": "Weezer", "artist_foreign_ids": [{"catalog": "7digital-US",
|
163
|
+
"foreign_id": "7digital-US:artist:7516"}], "tracks": [], "audio_md5": "de9115b298f885336c2eed710369a85e",
|
164
|
+
"artist_id": "AR633SY1187B9AC3B9", "id": "SOGRRAZ12D9F5224B8", "audio_summary":
|
165
|
+
{"key": 8, "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/3NYbcgg3UNJA1PrlDLuulhAtdETbV_mWKOdTbtDpIs-s4hhX4e00_W-p9M3R3aeZjnzY6PkljxLs5dJmM%3D/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1383930517&Signature=RA0IGZJtjue%2BT8sQVNfVCEHQ3Ms%3D",
|
166
|
+
"energy": 0.46981245219290091, "liveness": 0.97454003516679888, "tempo": 145.86600000000001,
|
167
|
+
"speechiness": 0.044845720907872588, "acousticness": 0.18924426716678527,
|
168
|
+
"mode": 1, "time_signature": 4, "duration": 266.14621, "loudness": -7.5679999999999996,
|
169
|
+
"audio_md5": "de9115b298f885336c2eed710369a85e", "valence": 0.23762761233385088,
|
170
|
+
"danceability": 0.40321067187085752}}, {"title": "El Scorcho (Live Version)",
|
171
|
+
"artist_name": "Weezer", "artist_foreign_ids": [{"catalog": "7digital-US",
|
172
|
+
"foreign_id": "7digital-US:artist:7516"}], "tracks": [{"release_image": "http://cdn.7static.com/static/img/sleeveart/00/004/991/0000499182_200.jpg",
|
173
|
+
"foreign_release_id": "7digital-US:release:499182", "preview_url": "http://previews.7digital.com/clips/34/5529356.clip.mp3",
|
174
|
+
"catalog": "7digital-US", "foreign_id": "7digital-US:track:5529356", "id":
|
175
|
+
"TRSLLXR12E5AC92DB2"}], "audio_md5": "6c7315d2dc3f65c4424104bf30b6a6c9", "artist_id":
|
176
|
+
"AR633SY1187B9AC3B9", "id": "SOBXNXS12AB0184EC6", "audio_summary": {"key":
|
177
|
+
8, "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/ra2U2w5vPwUQCWsuTIn7oWudD8c-1vM0uT4ymwzRuz7q_mZXuTTPKxJI2rCbRKiv9dz8uKpBnVe9CDinw%3D/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1383930517&Signature=3nDVkOiptipWy7MQnyAZRP024Po%3D",
|
178
|
+
"energy": 0.72080595006041182, "liveness": 0.64565466975511177, "tempo": 79.956000000000003,
|
179
|
+
"speechiness": 0.052348155837272259, "acousticness": 0.0077265142199913085,
|
180
|
+
"mode": 1, "time_signature": 4, "duration": 255.93288000000001, "loudness":
|
181
|
+
-8.3369999999999997, "audio_md5": "6c7315d2dc3f65c4424104bf30b6a6c9", "valence":
|
182
|
+
0.21653892274580336, "danceability": 0.53605543872346018}}, {"title": "El
|
183
|
+
Scorcho (Live at Y100 Sonic Session)", "artist_name": "Weezer", "artist_foreign_ids":
|
184
|
+
[{"catalog": "7digital-US", "foreign_id": "7digital-US:artist:7516"}], "tracks":
|
185
|
+
[], "audio_md5": "c3b69376f35d484578fdc220d5568c46", "artist_id": "AR633SY1187B9AC3B9",
|
186
|
+
"id": "SONDZAR1315CD4C41B", "audio_summary": {"key": 8, "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/iMglUAwmfhJkuIGRiH7gi0FhPJULjsG2qEFTDwH9zAHnez8NT6G7zQk3j3CdBqm0KzL5tATQkvo0ZPQww%3D/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1383930517&Signature=8tmFzq/LBAgeMVk7am75HZXlAmA%3D",
|
187
|
+
"energy": 0.52511401575074823, "liveness": 0.72582678316129789, "tempo": 147.31299999999999,
|
188
|
+
"speechiness": 0.058873253695273908, "acousticness": 0.75866741005033456,
|
189
|
+
"mode": 1, "time_signature": 4, "duration": 247.62620999999999, "loudness":
|
190
|
+
-6.4900000000000002, "audio_md5": "c3b69376f35d484578fdc220d5568c46", "valence":
|
191
|
+
0.63914724946801416, "danceability": 0.45506128573100907}}, {"title": "El
|
192
|
+
Scorcho (Live at Reading Festival / 1996)", "artist_name": "Weezer", "artist_foreign_ids":
|
193
|
+
[{"catalog": "7digital-US", "foreign_id": "7digital-US:artist:7516"}], "tracks":
|
194
|
+
[], "audio_md5": "b407ea718a29237bbc6ca5284ddae516", "artist_id": "AR633SY1187B9AC3B9",
|
195
|
+
"id": "SOBMVWB135FF3AF240", "audio_summary": {"key": 8, "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/4w7ffQVBq71Bpo95vSCeb2Bg73Q4OHitBURo1AgIdyJXJfM1aFMfllpfiD50lfG7wV6Ehcy9-rwT2QuqA%3D/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1383930517&Signature=zCwY9Y5htPd7A/pZ55sh3kIaie4%3D",
|
196
|
+
"energy": 0.78829460831070974, "liveness": 0.42244526158305484, "tempo": 142.76499999999999,
|
197
|
+
"speechiness": 0.098870534355800455, "acousticness": 0.010468399530986489,
|
198
|
+
"mode": 1, "time_signature": 4, "duration": 249.90620999999999, "loudness":
|
199
|
+
-5.25, "audio_md5": "b407ea718a29237bbc6ca5284ddae516", "valence": 0.41112256785513629,
|
200
|
+
"danceability": 0.39942793001447202}}, {"title": "weezer tribute - a tribute
|
201
|
+
to weezer - 10 - mycomplex - tired of sex", "artist_name": "Weezer", "artist_foreign_ids":
|
202
|
+
[{"catalog": "7digital-US", "foreign_id": "7digital-US:artist:7516"}], "tracks":
|
203
|
+
[], "audio_md5": "f488bff37f84b285f46d3728e684db4e", "artist_id": "AR633SY1187B9AC3B9",
|
204
|
+
"id": "SOACLKS12B0B808694", "audio_summary": {"key": 6, "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/TRSFWHX123E85838E7/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1383930517&Signature=aJID86Ax47aWitkl9N/32OoWp7c%3D",
|
205
|
+
"energy": 0.97225208036384314, "liveness": 0.18269153860438919, "tempo": 70.388999999999996,
|
206
|
+
"speechiness": 0.05718956600918651, "acousticness": 0.00080035622524831003,
|
207
|
+
"mode": 1, "time_signature": 7, "duration": 172.40771000000001, "loudness":
|
208
|
+
-4.7350000000000003, "audio_md5": "f488bff37f84b285f46d3728e684db4e", "valence":
|
209
|
+
0.49186589889821719, "danceability": 0.12650025672223394}}, {"title": "weezer
|
210
|
+
tribute - a tribute to weezer - 03 - glasseater - holiday", "artist_name":
|
211
|
+
"Weezer", "artist_foreign_ids": [{"catalog": "7digital-US", "foreign_id":
|
212
|
+
"7digital-US:artist:7516"}], "tracks": [], "audio_md5": "efbbfb75e81cea52137a6a2bab3d9732",
|
213
|
+
"artist_id": "AR633SY1187B9AC3B9", "id": "SOXZNBO12B0B8086A5", "audio_summary":
|
214
|
+
{"key": 9, "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/TRAKGEB123E859105D/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1383930517&Signature=Eizk9E6DSJOY3Y1WyrKNJX0Gv1M%3D",
|
215
|
+
"energy": 0.89255902909529894, "liveness": 0.093744242368857547, "tempo":
|
216
|
+
126.16800000000001, "speechiness": 0.039012555826289874, "acousticness": 0.019778543837455618,
|
217
|
+
"mode": 1, "time_signature": 3, "duration": 195.52608000000001, "loudness":
|
218
|
+
-5.234, "audio_md5": "efbbfb75e81cea52137a6a2bab3d9732", "valence": 0.38544276742326905,
|
219
|
+
"danceability": 0.18880682341806618}}, {"title": "weezer tribute - a tribute
|
220
|
+
to weezer - 04 - grade - surf wax america", "artist_name": "Weezer", "artist_foreign_ids":
|
221
|
+
[{"catalog": "7digital-US", "foreign_id": "7digital-US:artist:7516"}], "tracks":
|
222
|
+
[], "audio_md5": "b1a755094e5ddb9ec3ff1273e2724872", "artist_id": "AR633SY1187B9AC3B9",
|
223
|
+
"id": "SOEMBQN12B0B808697", "audio_summary": {"key": 7, "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/TRXNSQO123E85951F7/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1383930517&Signature=RTgbxzMXm6T0/gCGS7/AAVUVEtI%3D",
|
224
|
+
"energy": 0.92630398861406593, "liveness": 0.068189884318534455, "tempo":
|
225
|
+
84.248000000000005, "speechiness": 0.036145658810747661, "acousticness": 0.00084735493308902578,
|
226
|
+
"mode": 1, "time_signature": 1, "duration": 165.30240000000001, "loudness":
|
227
|
+
-6.3099999999999996, "audio_md5": "b1a755094e5ddb9ec3ff1273e2724872", "valence":
|
228
|
+
0.26021874076212054, "danceability": 0.13559971069715798}}, {"title": "weezer
|
229
|
+
tribute - a tribute to weezer - 11 - the impossibles - the good life", "artist_name":
|
230
|
+
"Weezer", "artist_foreign_ids": [{"catalog": "7digital-US", "foreign_id":
|
231
|
+
"7digital-US:artist:7516"}], "tracks": [], "audio_md5": "ed395a54df6790005bb909b672e7b541",
|
232
|
+
"artist_id": "AR633SY1187B9AC3B9", "id": "SOLDOAD12B0B80A2E5", "audio_summary":
|
233
|
+
{"key": 4, "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/TRZBRJM123E857CBC6/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1383930517&Signature=epCvK3SBvVqegqmahsQ%2Bd/t43bM%3D",
|
234
|
+
"energy": 0.95156625736500766, "liveness": 0.44095669104264873, "tempo": 141.077,
|
235
|
+
"speechiness": 0.059233605635693964, "acousticness": 0.092905273118622525,
|
236
|
+
"mode": 0, "time_signature": 4, "duration": 235.38892999999999, "loudness":
|
237
|
+
-6.008, "audio_md5": "ed395a54df6790005bb909b672e7b541", "valence": 0.41867524997326178,
|
238
|
+
"danceability": 0.39053779633091734}}, {"title": "weezer tribute - a tribute
|
239
|
+
to weezer - 13 - the ataris - butterfly", "artist_name": "Weezer", "artist_foreign_ids":
|
240
|
+
[{"catalog": "7digital-US", "foreign_id": "7digital-US:artist:7516"}], "tracks":
|
241
|
+
[], "audio_md5": "e44a293bc2d324ea3a1a0bab78e2c52b", "artist_id": "AR633SY1187B9AC3B9",
|
242
|
+
"id": "SOKKIRO12B0B80A2F0", "audio_summary": {"key": 8, "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/TRJXDUZ123E85939FE/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1383930517&Signature=tSKZNyx1lU/zmHR0F1%2B14HXCHXQ%3D",
|
243
|
+
"energy": 0.46419827841911532, "liveness": 0.097025313508424846, "tempo":
|
244
|
+
68.858999999999995, "speechiness": 0.045660208030876337, "acousticness": 0.91660634736419566,
|
245
|
+
"mode": 0, "time_signature": 1, "duration": 166.13831999999999, "loudness":
|
246
|
+
-10.436999999999999, "audio_md5": "e44a293bc2d324ea3a1a0bab78e2c52b", "valence":
|
247
|
+
0.53248584708903968, "danceability": 0.37858614207448416}}, {"title": "weezer
|
248
|
+
tribute - a tribute to weezer - 07 - midtown - susanne", "artist_name": "Weezer",
|
249
|
+
"artist_foreign_ids": [{"catalog": "7digital-US", "foreign_id": "7digital-US:artist:7516"}],
|
250
|
+
"tracks": [], "audio_md5": "5522d190923a3f9621a4c28dc67e5c62", "artist_id":
|
251
|
+
"AR633SY1187B9AC3B9", "id": "SOBEOSW12B0B80869C", "audio_summary": {"key":
|
252
|
+
8, "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/TRQPBEZ123E859C64A/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1383930517&Signature=kyuKbkru6brzGw6BE1jlgUSZl1s%3D",
|
253
|
+
"energy": 0.95068602351804421, "liveness": 0.049794877149266885, "tempo":
|
254
|
+
104.34999999999999, "speechiness": 0.055598863217484418, "acousticness": 0.044226349944663935,
|
255
|
+
"mode": 1, "time_signature": 4, "duration": 142.78485000000001, "loudness":
|
256
|
+
-5.1079999999999997, "audio_md5": "5522d190923a3f9621a4c28dc67e5c62", "valence":
|
257
|
+
0.5786127998045637, "danceability": 0.1495080646105561}}, {"title": "weezer
|
258
|
+
tribute - a tribute to weezer - 08 - dashboard confessional - jamie", "artist_name":
|
259
|
+
"Weezer", "artist_foreign_ids": [{"catalog": "7digital-US", "foreign_id":
|
260
|
+
"7digital-US:artist:7516"}], "tracks": [], "audio_md5": "765620a5c329495eb45a186234f97b49",
|
261
|
+
"artist_id": "AR633SY1187B9AC3B9", "id": "SOPDMFX12B0B8086A1", "audio_summary":
|
262
|
+
{"key": 6, "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/TRNVMEH123E8599E31/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1383930517&Signature=y0YHKzrbZCrKbhcr7S2Q433x9lA%3D",
|
263
|
+
"energy": 0.35662478142932102, "liveness": 0.077308278136483305, "tempo":
|
264
|
+
114.18600000000001, "speechiness": 0.036597796265677718, "acousticness": 0.83105546723441048,
|
265
|
+
"mode": 1, "time_signature": 4, "duration": 248.58077, "loudness": -7.4720000000000004,
|
266
|
+
"audio_md5": "765620a5c329495eb45a186234f97b49", "valence": 0.67184389562526992,
|
267
|
+
"danceability": 0.6871513821219799}}, {"title": "weezer tribute - a tribute
|
268
|
+
to weezer - 06 - christopher john (elliot) - the world has turned", "artist_name":
|
269
|
+
"Weezer", "artist_foreign_ids": [{"catalog": "7digital-US", "foreign_id":
|
270
|
+
"7digital-US:artist:7516"}], "tracks": [], "audio_md5": "5e406bddbcdddc2821d3f3a53ee409c0",
|
271
|
+
"artist_id": "AR633SY1187B9AC3B9", "id": "SOPLFNT1376BBCCB99", "audio_summary":
|
272
|
+
{"key": 6, "analysis_url": "http://echonest-analysis.s3.amazonaws.com/TR/TRDWFER123E82F4CA1/3/full.json?AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1383930517&Signature=/UcbPPuXTYpn1d8ByDhAHuMTh4k%3D",
|
273
|
+
"energy": 0.35602189090641229, "liveness": 0.11037179813161779, "tempo": 133.36699999999999,
|
274
|
+
"speechiness": 0.036236986757947121, "acousticness": 0.55025235780908854,
|
275
|
+
"mode": 1, "time_signature": 4, "duration": 372.34893, "loudness": -9.5730000000000004,
|
276
|
+
"audio_md5": "5e406bddbcdddc2821d3f3a53ee409c0", "valence": 0.28790226452583439,
|
277
|
+
"danceability": 0.49932195809745156}}]}}'
|
278
|
+
http_version:
|
279
|
+
recorded_at: Fri, 08 Nov 2013 16:58:38 GMT
|
280
|
+
recorded_with: VCR 2.7.0
|
@@ -23,7 +23,7 @@ http_interactions:
|
|
23
23
|
X-Request-Id:
|
24
24
|
- gXpEgeizQAGGst47meOWAQ
|
25
25
|
Etag:
|
26
|
-
-
|
26
|
+
- '"6c7ad38226a2cb3f6808fed206c128221da1472e"'
|
27
27
|
X-Worker-Node:
|
28
28
|
- d1c7d:18043
|
29
29
|
X-Ratelimit-Remaining:
|
@@ -35,7 +35,7 @@ http_interactions:
|
|
35
35
|
Cache-Control:
|
36
36
|
- max-age=86400
|
37
37
|
Access-Control-Allow-Origin:
|
38
|
-
-
|
38
|
+
- '*'
|
39
39
|
X-Ratelimit-Used:
|
40
40
|
- '1'
|
41
41
|
Connection:
|
@@ -46,32 +46,115 @@ http_interactions:
|
|
46
46
|
- 1.1 ID-0000627501223666 uproxy-3
|
47
47
|
body:
|
48
48
|
encoding: US-ASCII
|
49
|
-
string:
|
50
|
-
"
|
51
|
-
|
52
|
-
|
53
|
-
"
|
54
|
-
"
|
55
|
-
"
|
56
|
-
"
|
57
|
-
"
|
58
|
-
"
|
59
|
-
"
|
60
|
-
"
|
61
|
-
"
|
62
|
-
"
|
63
|
-
"
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
0.
|
69
|
-
"
|
70
|
-
"
|
71
|
-
"
|
72
|
-
0.
|
73
|
-
|
74
|
-
|
49
|
+
string: '{"response": {"status": {"version": "4.2", "code": 0, "message": "Success"},
|
50
|
+
"start": 0, "terms": [{"frequency": 1.0, "name": "rock", "weight": 1.0}, {"frequency":
|
51
|
+
0.32362762914965709, "name": "alternative rock", "weight": 0.69780927835051543},
|
52
|
+
{"frequency": 0.44937160189619696, "name": "electronic", "weight": 0.68547496318114876},
|
53
|
+
{"frequency": 0.30395783840385909, "name": "alternative", "weight": 0.51113770250368185},
|
54
|
+
{"frequency": 0.3330351216068515, "name": "pop", "weight": 0.41310751104565535},
|
55
|
+
{"frequency": 0.12701643032455379, "name": "art rock", "weight": 0.37453976435935199},
|
56
|
+
{"frequency": 0.18900195035169701, "name": "90s", "weight": 0.32041605301914583},
|
57
|
+
{"frequency": 0.15086233578978614, "name": "electronica", "weight": 0.30660898379970547},
|
58
|
+
{"frequency": 0.15515439522510874, "name": "experimental", "weight": 0.28194035346097202},
|
59
|
+
{"frequency": 0.11026300031196913, "name": "modern rock", "weight": 0.27899484536082475},
|
60
|
+
{"frequency": 0.11311005144022887, "name": "post-punk", "weight": 0.2766936671575847},
|
61
|
+
{"frequency": 0.1958486968107972, "name": "jazz", "weight": 0.25717967599410896},
|
62
|
+
{"frequency": 0.076972709443209955, "name": "british pop", "weight": 0.23205081001472755},
|
63
|
+
{"frequency": 0.07795958505745175, "name": "experimental rock", "weight":
|
64
|
+
0.22984167893961707}, {"frequency": 0.11062690830619014, "name": "ambient",
|
65
|
+
"weight": 0.22505522827687777}, {"frequency": 0.060773261607601083, "name":
|
66
|
+
"british rock", "weight": 0.17396907216494845}, {"frequency": 0.043226336802103069,
|
67
|
+
"name": "alternative pop rock", "weight": 0.17286450662739322}, {"frequency":
|
68
|
+
0.043338377308222591, "name": "indietronica", "weight": 0.17249631811487481},
|
69
|
+
{"frequency": 0.067005410887189226, "name": "grunge", "weight": 0.1639359351988218},
|
70
|
+
{"frequency": 0.069209522653945518, "name": "progressive rock", "weight":
|
71
|
+
0.16053019145802652}, {"frequency": 0.082315134619655381, "name": "80s", "weight":
|
72
|
+
0.14202871870397643}, {"frequency": 0.085107639075017574, "name": "indie",
|
73
|
+
"weight": 0.13871502209131076}, {"frequency": 0.070086224148814005, "name":
|
74
|
+
"soundtrack", "weight": 0.12039764359351988}]}}'
|
75
75
|
http_version:
|
76
76
|
recorded_at: Tue, 16 Apr 2013 15:36:58 GMT
|
77
|
-
|
77
|
+
- request:
|
78
|
+
method: get
|
79
|
+
uri: http://developer.echonest.com/api/v4/artist/terms?api_key=BNOAEBT3IZYZI6WXI&format=json&id=ARH6W4X1187B99274F
|
80
|
+
body:
|
81
|
+
encoding: US-ASCII
|
82
|
+
string: ''
|
83
|
+
headers: {}
|
84
|
+
response:
|
85
|
+
status:
|
86
|
+
code: 200
|
87
|
+
message: OK
|
88
|
+
headers:
|
89
|
+
Date:
|
90
|
+
- Sat, 12 Oct 2013 12:28:53 GMT
|
91
|
+
Content-Type:
|
92
|
+
- application/json; charset=utf-8
|
93
|
+
Content-Length:
|
94
|
+
- '2795'
|
95
|
+
Vary:
|
96
|
+
- Accept-Encoding
|
97
|
+
X-Request-Id:
|
98
|
+
- X0WI5W4YTSqVg3ChIufjdA
|
99
|
+
Etag:
|
100
|
+
- '"ca47178456bf833f4236e57ad2db739adaaf845a"'
|
101
|
+
X-Worker-Node:
|
102
|
+
- 2d6ca:24235
|
103
|
+
X-Ratelimit-Remaining:
|
104
|
+
- '19'
|
105
|
+
Server:
|
106
|
+
- TornadoServer/3.1
|
107
|
+
X-Ratelimit-Limit:
|
108
|
+
- '20'
|
109
|
+
X-Api-Key:
|
110
|
+
- BNOAEBT3IZYZI6WXI
|
111
|
+
Cache-Control:
|
112
|
+
- max-age=86400
|
113
|
+
Access-Control-Allow-Origin:
|
114
|
+
- '*'
|
115
|
+
X-Ratelimit-Used:
|
116
|
+
- '1'
|
117
|
+
Connection:
|
118
|
+
- Keep-alive
|
119
|
+
Keep-Alive:
|
120
|
+
- timeout=15, max=100
|
121
|
+
Via:
|
122
|
+
- 1.1 ID-0000627501223666 uproxy-3
|
123
|
+
body:
|
124
|
+
encoding: UTF-8
|
125
|
+
string: '{"response": {"status": {"version": "4.2", "code": 0, "message": "Success"},
|
126
|
+
"start": 0, "terms": [{"frequency": 1.0, "name": "rock", "weight": 1.0}, {"frequency":
|
127
|
+
0.50056445167152541, "name": "electronic", "weight": 0.76179177451826285},
|
128
|
+
{"frequency": 0.29054535637337708, "name": "alternative rock", "weight": 0.6259706643658326},
|
129
|
+
{"frequency": 0.41711702389033906, "name": "pop", "weight": 0.51704055220017253},
|
130
|
+
{"frequency": 0.27481688997448123, "name": "alternative", "weight": 0.46138912855910269},
|
131
|
+
{"frequency": 0.14477044187279242, "name": "art rock", "weight": 0.42608570606844981},
|
132
|
+
{"frequency": 0.18768888908047751, "name": "experimental", "weight": 0.34023583549036523},
|
133
|
+
{"frequency": 0.16288987379250486, "name": "electronica", "weight": 0.33031348863963189},
|
134
|
+
{"frequency": 0.1867971502729068, "name": "90s", "weight": 0.31607707794075351},
|
135
|
+
{"frequency": 0.1510795216447437, "name": "ambient", "weight": 0.30644233534656312},
|
136
|
+
{"frequency": 0.22557046127642771, "name": "jazz", "weight": 0.29587287891860797},
|
137
|
+
{"frequency": 0.093852065975919011, "name": "british pop", "weight": 0.28206787460454413},
|
138
|
+
{"frequency": 0.095061528373122664, "name": "experimental rock", "weight":
|
139
|
+
0.27991084268047167}, {"frequency": 0.15281722054220978, "name": "soundtrack",
|
140
|
+
"weight": 0.26186367558239859}, {"frequency": 0.15842776261614069, "name":
|
141
|
+
"indie", "weight": 0.25769341386252514}, {"frequency": 0.096748185840265413,
|
142
|
+
"name": "post-punk", "weight": 0.23619499568593616}, {"frequency": 0.091995700478839704,
|
143
|
+
"name": "modern rock", "weight": 0.23209663503019845}, {"frequency": 0.088619945150828675,
|
144
|
+
"name": "grunge", "weight": 0.21620649985619786}, {"frequency": 0.10941427818931845,
|
145
|
+
"name": "80s", "weight": 0.18845268909979868}, {"frequency": 0.058871852681638602,
|
146
|
+
"name": "00s", "weight": 0.18277250503307449}, {"frequency": 0.078837608640815418,
|
147
|
+
"name": "progressive rock", "weight": 0.18241299971239575}, {"frequency":
|
148
|
+
0.12049584640252849, "name": "metal", "weight": 0.18097497842968077}, {"frequency":
|
149
|
+
0.076360092189907885, "name": "indie rock", "weight": 0.1622088006902502},
|
150
|
+
{"frequency": 0.051549088378287804, "name": "post rock", "weight": 0.16113028472821397},
|
151
|
+
{"frequency": 0.081416315447692789, "name": "electro", "weight": 0.15703192407247626},
|
152
|
+
{"frequency": 0.063773730992766717, "name": "classic rock", "weight": 0.14387402933563417},
|
153
|
+
{"frequency": 0.068399828845829846, "name": "psychedelic", "weight": 0.13812194420477422},
|
154
|
+
{"frequency": 0.041850069189502591, "name": "trip hop", "weight": 0.12108139200460166},
|
155
|
+
{"frequency": 0.042195287172128608, "name": "british rock", "weight": 0.12036238136324418},
|
156
|
+
{"frequency": 0.044040217303918695, "name": "emo", "weight": 0.11662352602818522},
|
157
|
+
{"frequency": 0.044880652784358821, "name": "indie pop", "weight": 0.11496980155306298}]}}'
|
158
|
+
http_version:
|
159
|
+
recorded_at: Sat, 12 Oct 2013 12:28:53 GMT
|
160
|
+
recorded_with: VCR 2.6.0
|
@@ -75,13 +75,13 @@ module Echonest
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def profile(options = {})
|
78
|
-
options = {
|
78
|
+
options = (@id ? {id: @id} : {name: @name}).merge(options)
|
79
79
|
artist_data = get_response(options)[:artist]
|
80
80
|
Artist.new(@api_key, artist_data[:name], artist_data[:foreign_ids], artist_data[:id])
|
81
81
|
end
|
82
82
|
|
83
83
|
def terms(options = {})
|
84
|
-
options = {
|
84
|
+
options = (@id ? { id: @id } : { name: @name }).merge(options)
|
85
85
|
get_response(options)[:terms]
|
86
86
|
end
|
87
87
|
|
@@ -51,16 +51,21 @@ module Echonest
|
|
51
51
|
#
|
52
52
|
# Returns a response as a Hash
|
53
53
|
def get(endpoint, options = {})
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
54
|
+
options.merge!(api_key: @api_key,
|
55
|
+
format: "json")
|
56
|
+
|
57
|
+
httparty_options = { query_string_normalizer: HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER,
|
58
|
+
query: options }
|
59
|
+
|
60
|
+
response = HTTParty.get("#{ Base.base_uri }#{ endpoint }", httparty_options)
|
60
61
|
json = MultiJson.load(response.body, symbolize_keys: true)
|
61
62
|
response_code = json[:response][:status][:code]
|
62
63
|
|
63
|
-
response_code.eql?(0)
|
64
|
+
if response_code.eql?(0)
|
65
|
+
json[:response]
|
66
|
+
else
|
67
|
+
raise Echonest::Error.new(response_code, response), "Error code #{ response_code }"
|
68
|
+
end
|
64
69
|
end
|
65
70
|
|
66
71
|
# Cross-platform way of finding an executable in the $PATH.
|
@@ -78,4 +83,4 @@ module Echonest
|
|
78
83
|
end
|
79
84
|
|
80
85
|
end
|
81
|
-
end
|
86
|
+
end
|
@@ -1,11 +1,13 @@
|
|
1
|
-
|
1
|
+
module Echonest
|
2
|
+
class Biography
|
2
3
|
|
3
|
-
|
4
|
+
attr_accessor :text, :site, :url
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
def initialize(options = {})
|
7
|
+
@text = options[:text]
|
8
|
+
@site = options[:site]
|
9
|
+
@url = options[:url]
|
10
|
+
end
|
10
11
|
|
12
|
+
end
|
11
13
|
end
|
@@ -1,11 +1,13 @@
|
|
1
|
-
|
1
|
+
module Echonest
|
2
|
+
class Blog
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
attr_accessor :name, :summary, :url, :date_posted
|
5
|
+
def initialize(options = {})
|
6
|
+
@name = options[:name]
|
7
|
+
@summary = options[:summary]
|
8
|
+
@url = options[:url]
|
9
|
+
@date_posted = options[:date_posted]
|
10
|
+
end
|
10
11
|
|
12
|
+
end
|
11
13
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
module Echonest
|
2
2
|
|
3
3
|
class Error < Exception
|
4
|
-
|
4
|
+
attr_reader :error_code, :response
|
5
|
+
|
6
|
+
ERRORS = { '-1' => 'Unknown Error',
|
5
7
|
'0' => 'Success',
|
6
8
|
'1' => 'Invalid/Missing API Key',
|
7
9
|
'2' => 'This API key is not allowed to call that method',
|
@@ -11,17 +13,23 @@ module Echonest
|
|
11
13
|
'6' => 'Missing echoprint-codegen binary on $PATH'
|
12
14
|
}
|
13
15
|
|
14
|
-
|
15
|
-
# Create a new Echonest::Error object
|
16
|
-
def initialize(error_code)
|
16
|
+
def initialize(error_code, response = nil)
|
17
17
|
@error_code = error_code
|
18
|
+
@response = response
|
18
19
|
end
|
19
20
|
|
20
|
-
|
21
21
|
def description
|
22
22
|
ERRORS[@error_code.to_s]
|
23
23
|
end
|
24
24
|
|
25
|
+
def details
|
26
|
+
if error_code == 3
|
27
|
+
# Returns a hash similar to {"remaining"=>0, "limit"=>20, "used"=>29}.
|
28
|
+
Hash[response.headers.select{|k,v| k =~ /x-ratelimit/}.
|
29
|
+
map{ |k,v| [k.sub('x-ratelimit-', ''), v.first.to_i] }]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
25
33
|
end
|
26
34
|
|
27
|
-
end
|
35
|
+
end
|
@@ -1,18 +1,20 @@
|
|
1
|
-
|
1
|
+
module Echonest
|
2
|
+
class ForeignId
|
2
3
|
|
3
|
-
|
4
|
+
attr_accessor :catalog, :foreign_id, :catalog_id
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
def initialize(options = {})
|
7
|
+
@catalog = options[:catalog]
|
8
|
+
@foreign_id = options[:foreign_id]
|
9
|
+
@catalog_id = foreign_id.split(":").last
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
def self.parse_array(array = [])
|
13
|
+
foreign_ids = []
|
14
|
+
array.each do |fid|
|
15
|
+
foreign_ids << ForeignId.new(fid)
|
16
|
+
end
|
17
|
+
foreign_ids
|
15
18
|
end
|
16
|
-
foreign_ids
|
17
19
|
end
|
18
20
|
end
|
@@ -20,6 +20,16 @@ module Echonest
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def profile(options = {})
|
24
|
+
raise ArgumentError, 'You must include a song id' if options[:id].nil?
|
25
|
+
defaults = { api_key: @api_key }
|
26
|
+
response = get_response(options)
|
27
|
+
songs = []
|
28
|
+
response[:songs].each do |song|
|
29
|
+
songs << song
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
23
33
|
def identify(code)
|
24
34
|
raise ArgumentError, 'Not a valid Echoprint or ENFMP fingerprint' if code.empty?
|
25
35
|
response = get_response(code: code)
|
data/spec/artist_spec.rb
CHANGED
@@ -236,5 +236,17 @@ describe Echonest::Artist do
|
|
236
236
|
end
|
237
237
|
end
|
238
238
|
|
239
|
+
it 'should work even when artist has both name and id' do
|
240
|
+
# If we try, echonest will respond with error:
|
241
|
+
# 'limit - Only one of \"name\" or \"id\" is allowed'
|
242
|
+
VCR.use_cassette('terms') do
|
243
|
+
create_valid_artist_with_id
|
244
|
+
@a.name = "Weezer"
|
245
|
+
expect {
|
246
|
+
@a.terms
|
247
|
+
}.to_not raise_error
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
239
251
|
end
|
240
252
|
end
|
data/spec/foreign_id_spec.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe ForeignId do
|
3
|
+
describe Echonest::ForeignId do
|
4
4
|
|
5
5
|
it 'should parse the catalog id' do
|
6
|
-
foreign_id = ForeignId.new(catalog: "musicbrainz", foreign_id: "musicbrainz:artist:6fe07aa5-fec0-4eca-a456-f29bff451b04")
|
6
|
+
foreign_id = Echonest::ForeignId.new(catalog: "musicbrainz", foreign_id: "musicbrainz:artist:6fe07aa5-fec0-4eca-a456-f29bff451b04")
|
7
7
|
foreign_id.catalog_id.should eq("6fe07aa5-fec0-4eca-a456-f29bff451b04")
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should parse an array of results' do
|
11
11
|
results = [{catalog: "musicbrainz", foreign_id: "123"},{catalog: "musicbrainz", foreign_id: "456"}]
|
12
|
-
ForeignId.parse_array(results).count.should be 2
|
12
|
+
Echonest::ForeignId.parse_array(results).count.should be 2
|
13
13
|
end
|
14
14
|
|
15
15
|
end
|
data/spec/song_spec.rb
CHANGED
@@ -8,6 +8,26 @@ describe Echonest::Song do
|
|
8
8
|
a.should be_a Echonest::Song
|
9
9
|
end
|
10
10
|
|
11
|
+
describe "#profile" do
|
12
|
+
it "should return the song for a given id" do
|
13
|
+
VCR.use_cassette('song_profile') do
|
14
|
+
a = Echonest::Song.new('BNOAEBT3IZYZI6WXI')
|
15
|
+
options = { id: 'SOCRHFJ12A67021D74' }
|
16
|
+
a.profile(options).each do |song|
|
17
|
+
song.keys.should include :id, :artist_id, :artist_name, :title
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
it "raises an ArgumentError if id is not provided" do
|
23
|
+
VCR.use_cassette('song_profile') do
|
24
|
+
a = Echonest::Song.new('BNOAEBT3IZYZI6WXI')
|
25
|
+
options = { id: nil }
|
26
|
+
expect{a.profile(options)}.to raise_exception(ArgumentError)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
11
31
|
describe '#search' do
|
12
32
|
|
13
33
|
it 'should return an array of tracks' do
|
@@ -28,6 +48,16 @@ describe Echonest::Song do
|
|
28
48
|
end
|
29
49
|
end
|
30
50
|
|
51
|
+
it 'should support multiple bucket query params to return track data' do
|
52
|
+
VCR.use_cassette('song_search') do
|
53
|
+
a = Echonest::Song.new('BNOAEBT3IZYZI6WXI')
|
54
|
+
options = { combined: "weezer - El Scorcho", bucket: ["id:7digital-US", "audio_summary", "tracks"] }
|
55
|
+
a.search(options).each do |song|
|
56
|
+
song.keys.should include :id, :artist_id, :artist_name, :title, :artist_foreign_ids, :tracks, :audio_summary
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
31
61
|
it 'should happily find slow songs' do
|
32
62
|
VCR.use_cassette('song_search_slow') do
|
33
63
|
a = Echonest::Song.new('BNOAEBT3IZYZI6WXI')
|
@@ -88,4 +118,4 @@ describe Echonest::Song do
|
|
88
118
|
end
|
89
119
|
|
90
120
|
|
91
|
-
end
|
121
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: echonest-ruby-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Woolf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -167,6 +167,7 @@ files:
|
|
167
167
|
- fixtures/vcr_cassettes/search_2.yml
|
168
168
|
- fixtures/vcr_cassettes/single_biography.yml
|
169
169
|
- fixtures/vcr_cassettes/song_identify.yml
|
170
|
+
- fixtures/vcr_cassettes/song_profile.yml
|
170
171
|
- fixtures/vcr_cassettes/song_search.yml
|
171
172
|
- fixtures/vcr_cassettes/song_search_slow.yml
|
172
173
|
- fixtures/vcr_cassettes/songs.yml
|