WWW::TheEchoNest::Playlist - Wrapper for The Echo Nest API of music intelligence playlist calls
version 1.1
my $api_key = 'YOUR API KEY'; my $artist = 'Weezer'; my $playlist = WWW::TheEchoNest::Playlist->new( api_key => $api_key ); my $artist_obj = WWW::TheEchoNest::Artist->new( api_key => $api_key ); my @genres = $artist_obj->list_genres(); $playlist->basic( artist => $artist, results => 20, type => 'artist-radio' ); my $first_song_id = $playlist->get( 'songs[0].id' ); $playlist->basic( artist => $artist, results => 2, type => 'artist-radio', bucket => [ 'id:7digital-US' , 'tracks' ], limit => 'true' ); # if you are using dynamic playlists you need to keep track of the session $playlist->dynamic_create( artist => $artist, results => 20, type => 'artist-radio' ); my $session_id = $playlist->get( 'session_id' ); # the session_id is a 32 md5 hash $playlist->dynamic_next( session_id => $session ); my $first_song_tile = $playlist->get( 'songs[0].title' );
WWW::TheEchoNest::Playlist
my $song_id = "SOHTZUF12A8C13582B"; $playlist->basic( song_id => $song_id , results => 20, type => 'song-radio'); my $first_song_tile = $playlist->get( 'songs[0].title' );
$playlist->static( genre => "dance pop", results => 20, type => 'genre-radio' ); my $first_song_tile = $playlist->get( 'songs[0].title' );
Create a dynamic playlist, which is similar to playlists with less complexity
$playlist->dynamic_create( artist => $artist, results => 20, type => 'artist-radio' ); # it is important that you keep track of the session id as this is how you will interact with it. my $session_id = $playlist->get( 'session_id' );
special case, returns the actual session_id if request was successful
Delete a previously created dynamic playlist, you need to pass in the session_id
$playlist->dynamic_delete( session_id => $session );
$playlist->dynamic_feedback();
$playlist->dynamic_info();
$playlist->dynamic_next( session_id => $session );
Allows you to reset the playlist with a new seed artist
$playlist->dynamic_restart( session_id => $session_id, type => 'artist-radio', artist => 'Queen' );
Allows you influence the playlist by asking for "more like this" etc.
my $playlist_song = 'VALID SONG ID'; $playlist->dynamic_steer( session_id => $session_id, more_like_this => $playlist_song );
Aaron Johnson <aaronjjohnson@gmail.com>
This software is copyright (c) 2014 by Aaron Johnson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install WWW::TheEchoNest, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::TheEchoNest
CPAN shell
perl -MCPAN -e shell install WWW::TheEchoNest
For more information on module installation, please visit the detailed CPAN module installation guide.