From 9fe8ff40302731eda487511dd80525f333bb2a4f Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 19 Mar 2012 01:08:27 -0500 Subject: add docs --- lib/LastFM/Export.pm | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) 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 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 and C keys, as documented +L. + +=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 object, which will stream the entire list of +tracks that the user has scrobbled. Note that calling C on this object is +B recommended, since you will likely hit the last.fm API's rate limit. +Each call to C on this stream will require a separate API call. + +C<%params> can contain C, C, C, and C keys, as +documented L. C +will default to C<1> and C 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, or browse to +L. + +=head1 SEE ALSO + +L + +L + +=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 + +=item * CPAN Ratings + +L + +=item * RT: CPAN's request tracker + +L + +=item * Search CPAN + +L + +=back + +=cut + 1; -- cgit v1.2.3-54-g00ecf