Net::CDDBSearch - String search interface to CDDB database


Net-CDDBSearch documentation  | view source Contained in the Net-CDDBSearch distribution.

Index


NAME

Top

Net::CDDBSearch - String search interface to CDDB database

SYNOPSIS

Top

  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};

DESCRIPTION

Top

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.]

USING Net::CDDBSearch

Top

1. Creating a Net::CDDBSearch object

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.

2. Getting a list of all albums of a given artist.

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].

3. Getting a list of all albums similar to a given album.

get_albums_album()

  $cddb->get_albums_album('Youthanasia');
  $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].

4. Getting a track listing and info of a given album.

get_albums_album()

  $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'

AUTHOR

Top

Vitaliy Babiy <admin@mpscope.net>.

THANKS

Top

David J. Shultz <dshultz@redchip.com> for original module Net::CDDBScan

COPYRIGHT

Top

SEE ALSO

Top

perl(1).


Net-CDDBSearch documentation  | view source Contained in the Net-CDDBSearch distribution.