AudioFile::Identify::MusicBrainz - A pure-perl MusicBrainz client implementation
A::I::M is, at heart, a pure-perl implementation of the MusicBrainz client protocol, encapsulated in some sensible Track/Album/Artist objects that have the sort of methods you'd expect. So I can, given a Track object, go
my $some_title = $track->album->track(4)->artist->title;
Eventually, this is intended to be merely a plugin to a more general AudioFile::Identify architecture, along with such exciting things as A::I::Amazon, A::I::CDDB, etc, but until they're ready and we have a decent API for it, it's useful to have this out in the wild, as it's very useful.
See the AudioFile::Identify::MusicBrainz::Query manpage for details, but in summary:
use AudioFile::Identify::MusicBrainz::Query; my $query = AudioFile::Identify::MusicBrainz::Query->new(); $query->FileInfoLookup( artist => 'coldplay', title => 'yellow', items => 5, ) or die "Could not query: " . $query->error(); print "I got ".scalar(@{$query->results})." results\n";
print "Most likely album is '". $query->result(0)->album->title ."'\n"; print "Most likely trackNum is '". $query->result(0)->track->trackNum ."'\n";
See the AudioFile::Identify::MusicBrainz::Album manpage, the AudioFile::Identify::MusicBrainz::Artist manpage and the AudioFile::Identify::MusicBrainz::Track manpage for details of the methods you can call on these returned objects.
There's an example of its use in the examples folder in the tarball, tagger.pl (see tagger.pl). This is a utility that examines the ID3 tags of an MP3 file, and will print what MusicBrainz suggests for the rest of the tags.
Tom Insam <tom@jerakeen.org>
This program is free software, licensed under the terms of the GNU LGPL.
Most code is Copyright 2003 Tom Insam <tom@jerakeen.org>. The sole exception is the source for the RDF module, which contains a derivative work of a file Copyright 2000 Robert Kaye, see the AudioFile::Identify::MusicBrainz::RDF manpage for details of this.
Paul Mison <paulm@husk.org> provided the inspiration and
badgering that all modules require to get released, and has spent many
hours shouting at his laptop as he tried to get a 'real' RDF parser to
work. I have used XML::DOM to parse the XML in this module, which is Bad
and Wrong and will get me in Trouble. I didn't use his work, as it
doesn't, but he deserves credit for trying to do the Right Thing. I'm
sure a later version will be better.
The RDF module is programmatically generated from queries.h in the libmusicbrainz client library distribution. See the AudioFile::Identify::MusicBrainz::RDF manpage for specific copyright information.
Mike McCallister <mike@metalogue.com> contibuted a fantastic patch in March 2004 to fix the module after a protocol change and added lazy object loading and lots of nice abstractions. Lovely stuff.
I use XML::DOM, and not something in the RDF space. I have also
reverse-engineered the protocol from looking at HTTP dumps, as opposed
to actually trying to understand the C libraries. On the other hand,
this is exactly why XML and RDF are so cool.
the MusicBrainz::Client manpage, the MusicBrainz::Queries manpage, for the original implementation of this protocol, using the C-based libmusicbrainz client library.