Net::CDDBSearch - String search interface to CDDB database
use Net::CDDBSearch; Grab a list of all albums for 'Megadeth' $cddb = Net::CDDBSearch->new(); $cddb->get_albums_artist('Megadeth'); $albums = $cddb->albums(); print @{$albums->{$_}}[0],"\n" foreach keys %{$albums};
Net::CDDBSearch is an interface to the www.freedb.org website; or more specifically to their online search engine for the cddb database. Originally based on Net::CDDBScan by David J. Shultz. This module allows you to take any artist name like 'Madonna' and get all albums from said artist and all songs and some additional info on ANY album said artist has ever worked on. [This is assuming the cddb database has a record of the given artist / album / song.]
You first must create a Net::CDDBSearch object.
my $cddb = Net::CDDBSearch->new();
new() has the following optional parameters:
DEBUG
$cddb = Net::CDDBSearch->new(DEBUG => 1);
DEBUG: enables debug mode. Debug mode shows all internal function calls, all urls, albums and songs as it finds them.
get_albums_artist()
$cddb->get_albums_artist('Megadeth'); $albums = $cddb->albums(); print @{$albums->{$_}}[0],"\n" foreach keys %{$albums};
Returns a reference to a hash of album urls. The key is the url and the value is the reference to array [Artist_Name,Album_Name].
get_albums_album()
$cddb->get_albums_album('Youthanasia'); $albums = $cddb->albums(); print @{$albums->{$_}}[0],"\n" foreach keys %{$albums};
$cddb->get_songs_album($album_url); $info = $cddb->info(); $tracks = $cddb->tracks(); print "Album info\n"; print $_,"\t ==> ",$info->{$_},"\n" foreach keys %{$info}; print "Track list :\n"; print $_," : ",$tracks->{$_}, "\n" foreach (sort keys %{$tracks});
Method info() returns reference to a hash of album info. The keys are : Title,Year,Label,Artist.
Method tracks() returns reference to a hash of album info. The key is the track number and the value is track title.
NOTE: $album_url in example above is a result of get_albums_artist() or get_albums_albums(). This is unique URL to album in freedb.org. Usually it looks like 'http://www.freedb.org/freedb_search_fmt.php?cat=misc&id=2210a203'
Vitaliy Babiy <admin@mpscope.net>.
David J. Shultz <dshultz@redchip.com> for original module Net::CDDBScan
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl(1).
To install Net::CDDBSearch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::CDDBSearch
CPAN shell
perl -MCPAN -e shell install Net::CDDBSearch
For more information on module installation, please visit the detailed CPAN module installation guide.