NAME

WebService::8tracks - Handle 8tracks API

SYNOPSIS

use WebService::8tracks;

my $api = WebService::8tracks->new;

# explore
my $res = $api->mixes({ sort => 'recent' });
foreach my $mix (@{$res->{mixes}}) {
    print "$mix->{user}->{name} $mix->{name} id=$mix->{id}\n";
}

# listen
my $session = $api->create_session($res->{mixes}->[0]->{id});
my $res = $session->play;
my $media_url = $res->{set}->{track}->{url};
...
$res = $session->next;
$res = $session->skip;

# authenticated API
my $api = WebService::8tracks->new(username => ..., password => ...);
$api->fav(23); # fav a track

DESCRIPTION

WebService::8tracks provides Perl interface to 8tracks API.

Currently, all response objects are almost naive hashrefs.

METHODS

new
my $api = WebService::8tracks->new([ username => ..., password => ... ]);

Create API object. Pass username and password args to use methods that require login (like, fav, follow).

mixes([ \%qparam ])
my $res = $api->mixes({ page => 2 });
my $res = $api->mixes({ q => 'miles davis' });

List mixes.

user($id_or_name)
my $res = $api->user(1);
my $res = $api->user('remi');

View user info.

user_mixes($id_or_name[, \%qparam ])
my $res = $api->user_mixes(2);
my $res = $api->user_mixes('dp', { view => 'liked' });

List mixes made by a user.

create_session($mix_id)
my $session = $api->create_session($mix_id);
my $res = $session->play;
my $res = $session->next;
my $res = $session->skip;

Start playing mix. Returns a WebService::8tracks::Session.

like / unlike / toggle_like($mix_id)
my $res = $api->toggle_like($mix_id);

Like/unlike/toggle_like a mix. Requires username and password.

fav / unfav / toggle_fav($track_id)
my $res = $api->fav($track_id);

Fav/unfav/toggle_fav a track. Requires username and password.

follow / unfollow / toggle_follow($user_id)
my $res = $api->follow($user_id);

Follow/unfollow/toggle_follow a user. Requires username and password.

AUTHOR

motemen <motemen@gmail.com>

SEE ALSO

8tracks Playback API. http://docs.google.com/Doc?docid=0AQstf4NcmkGwZGdia2c5ZjNfNDNjbW01Y2dmZw

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.