NAME

WebService::MusicBrainz

SYNOPSIS

use WebService::MusicBrainz;

my $mb_ws = WebService::MusicBrainz->new();

my $area_result = $mb_ws->search(area => { x => 'y' });
my $artist_result = $mb_ws->search(artist => { x => 'Y' });
my $event_result = $mb_ws->search(event => { x => 'Y' });
my $instrument_result = $mb_ws->search(instrument => { x => 'Y' });
my $label_result = $mb_ws->search(label => { x => 'Y' });
my $recording_result = $mb_ws->search(recording => { x => 'Y' });
my $release_result = $mb_ws->search(release => { x => 'Y' });
my $release_group_result = $mb_ws->search(release_group => { x => 'Y' });
my $series_result = $mb_ws->search(series => { x => 'Y' });
my $work_result = $mb_ws->search(work => { x => 'Y' });
my $url_result = $mb_ws->search(url => { x => 'Y' });

DESCRIPTION

API to search the musicbrainz.org database

VERSION

Version 1.0 and future releases are not backward compatible with pre-1.0 releases. This is a complete re-write using version 2.0 of the MusicBrainz API and Mojolicious.

METHODS

new

my $mb = WebService::MusicBrainz->new();
my $results = $mb->search($resource => { param1 => 'value1' });

Valid values for $resource are:  area, artist, event, instrument, label, recording, release, release-group, series, work, url
The default is to return decoded JSON as a perl data structure.  Specify format => 'xml' to return the results as an instance of Mojo::DOM.

Search by MBID

my $result = $mb->search($resource => { mbid => 'xxxxxx' });

Search area

my $areas = $mb->search(area => { area => 'cincinnati' });
my $areas = $mb->search(area => { iso => 'US-OH' });

Search artist

# JSON example
my $artists = $mb->search(artist => { artist => 'Ryan Adams', type => 'Person' }); 

my $artist_country = $artists->{artists}->[0]->{country};

# XML example
my $artists = $mb->search(artist => { artist => 'Ryan Adams', type => 'Person', fmt => 'xml' }); 

my $artist_country = $artists->at('country')->text;

Search release

my $releases = $mb->search(release => { release => 'Love Is Hell', status => 'official' });
print "RELEASE COUNT: ", $releases->{count}, "\n";

DEBUG

Set environment variable MUSICBRAINZ_DEBUG=1

  • The URL that is generated for the search will output to STDOUT.

  • The formatted output (JSON or XML) will be output to STDOUT

AUTHOR

Bob Faist <bob.faist@gmail.com>

COPYRIGHT AND LICENSE

Copyright 2006-2017 by Bob Faist

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

SEE ALSO

http://musicbrainz.org/doc/Development/XML_Web_Service/Version_2