1WebService::MusicBrainzU(s3e)r Contributed Perl DocumentaWteiboSnervice::MusicBrainz(3)
2
3
4

NAME

6       WebService::MusicBrainz
7

SYNOPSIS

9           use WebService::MusicBrainz;
10
11           my $mb = WebService::MusicBrainz->new();
12
13           my $result = $mb->search($resource => { $search_key => 'search value' });
14           my $result = $mb->search($resource => { $search_key => 'search value', fmt => 'json' });  # fmt => 'json' is default
15
16           my $result_dom = $mb->search($resource => { $search_key => 'search value', fmt => 'xml' });
17

DESCRIPTION

19       API to search the musicbrainz.org database
20

VERSION

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

METHODS

27   new
28        my $mb = WebService::MusicBrainz->new();
29
30   search
31        my $result_list = $mb->search($resource => { param1 => 'value1' });
32
33        my $result = $mb->search($resource => { mbid => 'mbid' });
34
35        my $result_more = $mb->search($resource => { mbid => 'mbid', inc => 'extra stuff' });
36
37        Valid values for $resource are:  area, artist, event, instrument, label, recording, release, release-group, series, work, url
38       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.
39
40       Search by MBID
41
42         my $result = $mb->search($resource => { mbid => 'xxxxxx' });
43
44       The "inc" search parameter is only allowed when searching for any
45       particular "mbid".
46
47       Search area
48
49         my $area_list_results = $mb_ws->search(area => { iso => 'US-OH' });
50         my $area_list_results = $mb_ws->search(area => { area => 'cincinnati' });
51         my $area_list_results = $mb_ws->search(area => { alias => 'new york' });
52         my $area_list_results = $mb_ws->search(area => { sortname => 'new york' });
53         my $area_list_results = $mb_ws->search(area => { area => 'new york', type => 'city' });
54
55         my $area_result = $mb_ws->search(area => { mbid => '0573177b-9ff9-4643-80bc-ed2513419267' });
56         my $area_result = $mb_ws->search(area => { mbid => '0573177b-9ff9-4643-80bc-ed2513419267', inc => 'area-rels' });
57
58       Search artist
59
60        # JSON example
61        my $artists = $mb->search(artist => { artist => 'Ryan Adams' });
62        my $artists = $mb->search(artist => { artist => 'Ryan Adams', type => 'person' });
63
64        my $artist_country = $artists->{artists}->[0]->{country};
65
66        # XML example
67        my $artists = $mb->search(artist => { artist => 'Ryan Adams', type => 'person', fmt => 'xml' });
68
69        my $artist_country = $artists->at('country')->text;
70
71        # find this particular artist
72        my $artist = $mb->search(artist => { mbid => '5c2d2520-950b-4c78-84fc-78a9328172a3' });
73
74        # find this particular artist and include release and artist relations (members of the band)
75        my $artist = $mb->search(artist => { mbid => '5c2d2520-950b-4c78-84fc-78a9328172a3', inc => ['releases','artist-rels'] });
76
77        # artists that started in Cincinnati
78        my $artists = $mb->search(artist => { beginarea => 'Cincinnati' });
79
80       Search label
81
82        my $labels = $mb->search(label => { label => 'Death' });
83
84       Search recording
85
86        my $recordings = $mb->search(recording => { artist => 'Taylor Swift' });
87
88       Search release
89
90        my $releases = $mb->search(release => { release => 'Love Is Hell', status => 'official' });
91        print "RELEASE COUNT: ", $releases->{count}, "\n";
92

DEBUG

94       Set environment variable MUSICBRAINZ_DEBUG=1
95
96       ·
97        The URL that is generated for the search will output to STDOUT.
98
99       ·
100        The formatted output (JSON or XML) will be output to STDOUT
101

AUTHOR

103       Bob Faist <bob.faist@gmail.com>
104
106       Copyright 2006-2017 by Bob Faist
107
108       This library is free software; you can redistribute it and/or modify it
109       under the same terms as Perl itself.
110

SEE ALSO

112       http://musicbrainz.org/doc/Development/XML_Web_Service/Version_2
113
114
115
116perl v5.30.0                      2019-10-08        WebService::MusicBrainz(3)
Impressum