-
Notifications
You must be signed in to change notification settings - Fork 18
Playlist API Methods
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.
Some properties of a basic playlist:
- Songs are never repeated
- Artists may be repeated
A number of different algorithms can be used to select songs for the playlist. These are specified with the type parameter.
Echonest.playlist_basic(:artist => 'Vampire Weekend', :results => 3) =>
[#<Echonest::Song:0x007f8fb2270a08 @attrs={:artist_id=>"AR2ZPMX1187FB4E4B6",
:id=>"SOMWTWK12AB01860CD", :artist_name=>"Vampire Weekend", :title=>"White Sky"}>,
#<Echonest::Song:0x007f8fb22709e0 @attrs={:artist_id=>"AR5AEGG1187FB4AFD2",
:id=>"SOPECCK13DC4E02E07", :artist_name=>"The Virgins", :title=>"Impressions of You"}>,
#<Echonest::Song:0x007f8fb22709b8 @attrs={:artist_id=>"ARL93GT1187B9A1057",
:id=>"SODTAZA13B0D1D86BE", :artist_name=>"Metric", :title=>"Artificial Nocturne"}>]Returns a static playlist. A static playlist is generated once from an initial set of parameters, and returned as an ordered list of songs.
Some properties of a static playlist:
- Songs are never repeated
- Artists may be repeated
A number of different algorithms can be used to select songs for the playlist. These are specified with the type parameter.
Echonest.song_profile(:id=> 'SOCZMFK12AC468668F') =>
#<Echonest::Song:0x007fa8abbaa490 @attrs={:artist_id=>"ARZHQSP12FE086C216",
:id=>"SOCZMFK12AC468668F", :artist_name=>"Wil-Lean", :title=>"Stay Fly"}>Search for songs given different query types
Echonest.song_search(:artist => 'Macklemore', :results => 3) =>
[#<Echonest::Song:0x007fc8e0a3f560 @attrs={:artist_id=>"AR2XDHU1187B9B484F",
:id=>"SOAFRBZ1312A8A5536", :artist_name=>"Macklemore", :title=>"And We Danced (feat. Ziggy Stardust)"}>,
#<Echonest::Song:0x007fc8e0a3f538 @attrs={:artist_id=>"AR2XDHU1187B9B484F",
:id=>"SOEPGXT1338A5D83A5", :artist_name=>"Macklemore", :title=>"Can't Hold Us (Feat. Ray Dalton)"}>,
#<Echonest::Song:0x007fc8e0a3f510 @attrs={:artist_id=>"AR2XDHU1187B9B484F", :id=>"SOCRYSC1313438D0DF",
:artist_name=>"Macklemore", :title=>"The Town"}>]
Echonest.song_search(:key => 2,
:mode => 0,
:min_energy => 0.35,
:max_energy => 0.65,
:min_danceability => 0.90,
:results => 3,
:sort => 'song_hotttnesss-desc') =>
[#<Echonest::Song:0x007fa82ab52c08 @attrs={:artist_id=>"ARHFDOW1187B9A6B6D",
:id=>"SOIIWOX13CCFBAB235", :artist_name=>"Late Night Alumni", :title=>"Empty Streets"}>,
#<Echonest::Song:0x007fa82ab52be0 @attrs={:artist_id=>"AR23C041187FB4D534",
:id=>"SOMTSZB13B366AE759", :artist_name=>"50 Cent", :title=>"Disco Inferno"}>,
#<Echonest::Song:0x007fa82ab52bb8 @attrs={:artist_id=>"AR8RQVM1187B9A2645",
:id=>"SOBNGDP12A8C13A26D", :artist_name=>"Fujiya & Miyagi", :title=>"UH"}>]
Echonest.song_search(:artist => 'Macklemore',
:bucket => ['audio_summary', 'artist_location'],
:results => 1) =>
[#<Echonest::Song:0x007fc8392e1a40 @attrs={:title=>"And We Danced (feat. Ziggy Stardust)",
:artist_name=>"Macklemore", :audio_summary=>{:key=>2, :analysis_url=>"http://echonest-
analysis.s3.amazonaws.com/TR/0pLbjgoRCq6L4-Nnk5wTpFeG6Ouk1NwWMYcKEP/3/full.json?
AWSAccessKeyId=AKIAJRDFEY23UEVW42BQ&Expires=1375508042&Signature=CjFhM1lnr05rmVhcYdxRPR3Nw5Q%3D",
:energy=>0.6722788937963255, :liveness=>0.08902066450149933, :tempo=>125.013,
:speechiness=>0.07387994905866357, :acousticness=>0.07404369808174743, :mode=>0, :time_signature=>4,
:duration=>246.21333, :loudness=>-7.133, :audio_md5=>"928960fb6130be91984ed5197bf1b6cb",
:valence=>0.6466419050880391, :danceability=>0.7551415447533787}, :artist_id=>"AR2XDHU1187B9B484F",
:id=>"SOAFRBZ1312A8A5536", :artist_location=>{:latitude=>47.6036, :location=>"Seattle, WA, US",
:longitude=>-122.329}}>]