NAME

AudioFile::Identify::MusicBrainz::Query

DESCRIPTION

The main query object. This is probably the thing you want to use.

METHODS

userAgent()

returns a singleton LWP::UserAgent configured for use in retrieving data from MusicBrainz.org.

FileInfoLookup($query)

Perform a MusicBrainz FileInfoLookup query - this is the clever one that I care about. $query here is a hash / hashref where the keys are the information you know:

use AudioFile::Identify::MusicBrainz::Query;
my $query = AudioFile:::Identify::MusicBrainz::Query->new();
$query->FileInfoLookup(
    artist => 'coldplay',
    title => 'yellow',
    items => 30,
) or die "Could not query: " . $query->error();
print "I got ".scalar(@{$query->results})." results\n";

keys you can use in the query are:

trm

the trm - the audio fingerprint of the song. Generating this is a Future Project.

artist

the artist name. Either this key or artist_id must be supplied for a query to be valid.

artist_id

The artist ID assigned by MusicBrainz, without the 'http' portion. For example, '3d2b98e5-556f-4451-a3ff-c50ea18d57cb'.

album

the album name

album_id

The album ID assigned by MusicBrainz, without the 'http' portion. For example, '2d5d5d4c-d0d7-4772-962f-de7185605ff8'.

track

the track title

track_id

The track ID assigned by MusicBrainz, without the 'http' portion. For example, 'f27a903c-f5cc-465f-91c4-5c67d8b3d6d6'.

tracknum

the track number

secs

the track length in seconds

filename

the filename of the track

This function will return true on success, false on error, and an error will be accessible through the error function.

response

returns the unparsed RDF text of the response generated by Query.

error

returns the last error generated by Query.

results

returns a listref of AudioFile::Identify::MusicBrainz::Result objects.

result(index)

returns a given result, at a given index, or undef if the result set doesn't contain a result at that index value.

resultCount()

returns the number of items in the results set.