WebService::LastFM::SimilarArtists - Module to retrieve Related Artist information from audioscrobbler.net / last.fm
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); }
WebService::LastFM::SimilarArtists retrieves Similiar Artists (Related Artists) information from http://audioscrobbler.net/ (http://last.fm/), based on your input.
WebService::LastFM::SimilarArtists
new creates a new WebService::LastFM::SimilarArtists object using the configuration passed to it.
new
Specifies the minimal similarity match count that should be returned. Defaults to 0.75.
0.75
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.
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.
/tmp/lastfm.cache
croak
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).
The array returned contains anonymous hashes with the following information:
The artist/band name
The Musicbrainz ID (if available)
The similarity match count (on a scale of 0 to 100)
The URL to the artist's page at http://last.fm/
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.
Please report any found bugs to http://rt.cpan.org/Public/Dist/Display.html?Name=WebService-LastFM-SimilarArtists or contact the author.
M. Blom, <blom@cpan.org>, http://menno.b10m.net/perl/
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.
http://www.last.fm/
http://www.audioscrobbler.net/
http://www.audioscrobbler.net/data/webservices/
http://www.musicbrainz.org/
Cache::File, LWP::Simple, URI::Escape, XML::Simple
WebService::LastFM
To install WebService::LastFM::SimilarArtists, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::LastFM::SimilarArtists
CPAN shell
perl -MCPAN -e shell install WebService::LastFM::SimilarArtists
For more information on module installation, please visit the detailed CPAN module installation guide.