diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-03-19 01:08:27 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-03-19 01:08:27 -0500 |
commit | 9fe8ff40302731eda487511dd80525f333bb2a4f (patch) | |
tree | 5313202dc4643ce0794c5f8c7c97f7fe97996fca | |
parent | b42c092e6c9cedbc56cfe93f94937dcf85aae5e3 (diff) | |
download | lastfm-export-9fe8ff40302731eda487511dd80525f333bb2a4f.tar.gz lastfm-export-9fe8ff40302731eda487511dd80525f333bb2a4f.zip |
add docs
-rw-r--r-- | lib/LastFM/Export.pm | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/lib/LastFM/Export.pm b/lib/LastFM/Export.pm index dfad065..24b2829 100644 --- a/lib/LastFM/Export.pm +++ b/lib/LastFM/Export.pm @@ -7,6 +7,35 @@ use Net::LastFM; with 'MooseX::Getopt'; +=head1 SYNOPSIS + + use LastFM::Export; + + my $exporter = LastFM::Export->new(user => 'doyster'); + my $stream = $exporter->tracks; + + while (my $block = $stream->next) { + for my $track (@$block) { + # ... + } + sleep 1; + } + +=head1 DESCRIPTION + +This module uses the L<http://last.fm/> API to allow you to export your +scrobbling data from your account. Currently, the only thing this lets you +export is your actual scrobble data, but more features may be added in the +future (especially if the feature requests come with patches!). + +=cut + +=attr user + +last.fm user to export data for. Required. + +=cut + has user => ( is => 'ro', isa => 'Str', @@ -32,6 +61,15 @@ has lastfm => ( }, ); +=method track_count(%params) + +Returns the number of tracks the user has scrobbled. + +C<%params> can contain C<from> and C<to> keys, as documented +L<here|http://www.last.fm/api/show/user.getRecentTracks>. + +=cut + sub track_count { my $self = shift; my (%params) = @_; @@ -43,6 +81,21 @@ sub track_count { return $self->lastfm->request(%params)->{recenttracks}{'@attr'}{total}; } +=method tracks(%params) + +Returns a L<Data::Stream::Bulk> object, which will stream the entire list of +tracks that the user has scrobbled. Note that calling C<all> on this object is +B<not> recommended, since you will likely hit the last.fm API's rate limit. +Each call to C<next> on this stream will require a separate API call. + +C<%params> can contain C<page>, C<limit>, C<from>, and C<to> keys, as +documented L<here|http://www.last.fm/api/show/user.getRecentTracks>. C<page> +will default to C<1> and C<limit> will default to C<200> if not specified. + +Returns + +=cut + sub tracks { my $self = shift; my (%params) = @_; @@ -67,4 +120,48 @@ sub tracks { __PACKAGE__->meta->make_immutable; no Moose; +=head1 BUGS + +No known bugs. + +Please report any bugs through RT: email +C<bug-lastfm-export at rt.cpan.org>, or browse to +L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=LastFM-Export>. + +=head1 SEE ALSO + +L<Net::LastFM> + +L<http://last.fm/> + +=head1 SUPPORT + +You can find this documentation for this module with the perldoc command. + + perldoc LastFM::Export + +You can also look for information at: + +=over 4 + +=item * AnnoCPAN: Annotated CPAN documentation + +L<http://annocpan.org/dist/LastFM-Export> + +=item * CPAN Ratings + +L<http://cpanratings.perl.org/d/LastFM-Export> + +=item * RT: CPAN's request tracker + +L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=LastFM-Export> + +=item * Search CPAN + +L<http://search.cpan.org/dist/LastFM-Export> + +=back + +=cut + 1; |