Menno Blom > WebService-LastFM-SimilarArtists-0.02 > WebService::LastFM::SimilarArtists

Download:
WebService-LastFM-SimilarArtists-0.02.tar.gz

Dependencies

Annotate this POD (1)

View/Report Bugs
Module Version: 0.02   Source   Latest Release: WebService-LastFM-SimilarArtists-0.03

NAME ^

WebService::LastFM::SimilarArtists - Module to retrieve Related Artist information from audioscrobbler.net / last.fm

SYNOPSIS ^

  use strict;
  use WebService::LastFM::SimilarArtists;

  my $sa = WebService::LastFM::SimilarArtists->new(
              minmatch => 85,
          cache_time => '1 week',
          cache_dir  => '/var/cache/lastfm'
           );
  my @artists = $sa->lookup('Hate Forest');

  if(@artists) {
     print "<a href=\"$_->{'url'}\">$_->{'name'}</a> ".
           "(match: $_->{'match'})\n"
        foreach(@artists);
  }

DESCRIPTION ^

WebService::LastFM::SimilarArtists retrieves Similiar Artists (Related Artists) information from http://audioscrobbler.net/ (http://last.fm/), based on your input.

METHODS

new

new creates a new WebService::LastFM::SimilarArtists object using the configuration passed to it.

options

min_match

Specifies the minimal similarity match count that should be returned. Defaults to 0.75.

cache_time

Specifies the time the query should be cached to prevent hammering the audioscrobbler website. Webmaster suggested one week, which is the default.

Time can be specified in the same manner as with Cache::File. It can be set using seconds since the epoch, or using a slightly more readable form of e.g. '1 week', '2 months', etc. Valid units are s, second, seconds, sec, m, minute, minutes, min, h, hour, hours, w, week, weeks, M, month, months, y, year and years. You can also specify an absolute time, such as '16 Nov 94 22:28:20' or any other time that Date::Parse can understand.

cache_dir

Specifies the root directory for the caching. Defaults to /tmp/lastfm.cache. Directories are created when needed. The module will croak when it fails to create a directory.

lookup

Takes one argument, the band or artist to be queried. This method returns an array of anonymous hashes with the similar artists found (if any).

RETURN VALUES

The array returned contains anonymous hashes with the following information:

name

The artist/band name

mbid

The Musicbrainz ID (if available)

match

The similarity match count (on a scale of 0 to 100)

url

The URL to the artist's page at http://last.fm/

streamable

Whether the artist is "streamable", meaning, whether the rightholders of artist's work have submitted tracks to http://last.fm/.

1 for true, 0 for false.

BUGS ^

Please report any found bugs to http://rt.cpan.org/Public/Dist/Display.html?Name=WebService-LastFM-SimilarArtists or contact the author.

AUTHOR ^

M. Blom, <blom@cpan.org>, http://menno.b10m.net/perl/

COPYRIGHT ^

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

The full text of the license can be found in the LICENSE file included with this module.

NOTE: The datafeed from audioscrobbler.net is for non-commercial use only. Please see http://www.audioscrobbler.net/data/webservices/ for more licensing information.

SEE ALSO ^

syntax highlighting: