#!/usr/bin/perl -CS

use strict;
use warnings;

use Getopt::Long;
use Pod::Usage;

use App::LastStats;

my %opts;
GetOptions(\%opts, 'user=s', 'count=i', 'format=s', 'period=s', 'help');

if ($opts{help}) {
  pod2usage(1);
}

my $laststats;

if (@ARGV == 1) {
  $laststats = App::LastStats->new(username => $ARGV[0]);
} else {
  $laststats = App::LastStats->new(%opts);
}

$laststats->run;

__END__

=head1 NAME

laststats - A script to fetch and display Last.fm statistics

=head1 SYNOPSIS

  laststats [options]

=head1 DESCRIPTION

This script fetches and displays Last.fm statistics for a given user. It allows you to specify the time period, format, and number of artists to display.

=head1 OPTIONS

=over 4

=item B<--user>

Last.fm username (defaults to "davorg")

=item B<--count>

The number of artists to display (defaults to 10)

=item B<--format>

The format to display results in. Can be "text", "html" or "json" (defaults to "text")

=item B<--period>

The time period for the stats. Can be "overall", "7day", "1month", "3month", "6month", "12month" (defaults to "7day")

=item B<--api-key> B<--api-secret>

The authorisation details you need in order to use the Last.fm API. These can
either be passed as arguments to the constructor or, if omitted, they are
read from environment variables called C<LASTFM_API_KEY> and
C<LASTFM_API_SECRET>.

=back

=head1 AUTHOR

Dave Cross <dave@perlhacks.com>

=head1 LICENSE

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

=cut
