et_catalog',
'get_playlist',
'get_song',
'get_track',
'pretty_json',
'set_log_level',
'set_codegen_path',
'set_api_key',
);
o
$_[0] );
}
sub set_api_key {
WWW::EchoNest::Config::set_api_key( $_[0] );
}
use JSON;
sub pretty_json { to_json( $_[0], { utf8 => 1, pretty => 1 } ) }
use WWW::EchoNest::Logger;
sub set_log_leve
# Imports:
# - get_artist
# - get_catalog
# - get_playlist
# - get_song
# - get_track
# - pretty_json
# - set_log_level
# - set_codegen_path
# - set_api_key
# Each of which can also be imported indiv
use JSON;
use overload
'""' => '_stringify',
'cmp' => '_compare',
'==' => '_compare',
;
# FUNCTIONS ############################################################
#
sub _json_rep {
JSON->new->utf8->pretty()->encode( $_[0] ) }
sub _stringify {
return _json_rep( $_[0]->list() );
}
sub _compare {
return $_[0]->_stringify() cmp $_[1]->_stringify();
}
##############
t qw[ WWW::EchoNest::CatalogProxy Exporter ];
use 5.010;
use strict;
use warnings;
use Carp;
use JSON;
use WWW::EchoNest::Logger qw( get_logger );
use WWW::EchoNest::Result::List;
use WWW::EchoNest:
$_[0]->get_name . q['>];
}
sub _types { WWW::EchoNest::CatalogProxy::_types }
sub _pretty_json { to_json( $_[0], { utf8 => 1, pretty => 1 } ) }
my @acceptable_actions = qw( delete update play skip
em_id"
if $item_id !~ /[[:alpha:][:digit:][:punct:]]+/;
}
my $data = _pretty_json( $items_aref );
$logger->debug('items: ' . $data);
my $result = $self->post_attribu
= qw( profile search_song identify );
}
use parent qw( WWW::EchoNest::SongProxy Exporter );
use JSON;
use WWW::EchoNest::Functional qw(
any
se->{songs};
return if ! $songs_ref;
# $logger->debug('$songs_ref : ', $json->encode($songs_ref));
$self->{tracks} = [] if ! @cached_tracks;
# Build the ar
1;
eval {
$data = { query => encode_json($query_obj_ref) };
};
croak "Could not encode json string: $@" if $@;
}
if ($has_data) {
my $req
make_stupid_accessor
);
# Required CPAN modules
eval {
use JSON;
};
croak "$@" if $@;
use overload
'""' => '_stringify',
;
# FUNCTIONS #############
my $json_url = $audio_summary->{analysis_url};
my $json_response = user_agent()->get($json_url);
my $json_string;
if ( $json_response->is_success() ) {
$json_str
ing = $json_response->decoded_content()
} else {
croak "Could not get $json_url: $json_response->status_line()";
}
my $analysis = decode_json( $json_string );
my $nes
use URI;
use URI::Escape;
use LWP::UserAgent;
use HTTP::Request::Common;
use HTTP::Response;
use JSON;
use WWW::EchoNest;
our $VERSION = $WWW::EchoNest::VERSION;
use WWW::EchoNest::Config;
use WWW:
our @EXPORT = qw[ ];
our @EXPORT_OK = qw[ call_api codegen fix_keys user_agent json_rep md5 ];
our %EXPORT_TAGS =
(
all => [ @EXPORT_OK ],
);
}
use pa
#######################################
#
# Set up a JSON pretty-printer
#
sub json_rep {
my $json = JSON->new->utf8->pretty();
return $json->encode( $_[0] )
}
# Set up the HTTP User Agent
$attr_name (@$attributes_ref) {
*{ $pkg . '::get_' . $attr_name } = sub {
use JSON;
my $self = $_[0];
my $args_ref = $_[1];
my $result = call_api(
{
format => 'json',
method => $api_method,
params => $a
$api_call = call_api(
{
format => 'json',
method => $api_method,
post