GNATLib

GNATLib is a Python library for looking up Musicbrainz IDs and URIs from music metadata. Metadata can be read from the ID3 tags of audio files or entered manually.

Requirements

Installation

Currently GNATLib is in pre-release beta and can only be checked out from the subversion repository.


svn co https://motools.svn.sourceforge.net/svnroot/motools/gnatlib/src gnatlib_src
cd gantlib_src
python setup.py install

Usage

There are two basic functions available in GNATLib - filelookup() and metadatalookup. Both are demonstrated in the following listing:


>> import gnatlib
>> result = gnatlib.filelookup('test.mp3')
20.04.09 17:11:34 DEBUG     - Trying to guess an ID for track "Light My Fire", artist "Jay Dee", release "Donuts", track number 4
20.04.09 17:11:34 DEBUG    ID Found !
>> result['artistURI']
u'http://musicbrainz.org/artist/cbcbb22c-3a8d-46af-b4ba-09c98f0d7931'

>> gnatlib.metadatalookup(artist='Jay Dee', release='Donuts')
20.04.09 17:21:07 DEBUG     - Trying to guess an ID for track "None", artist "Jay Dee", release "Donuts", track number None
20.04.09 17:21:07 DEBUG    ID Found !

{'artist': ,
 'artistMbz': u'http://musicbrainz.org/artist/cbcbb22c-3a8d-46af-b4ba-09c98f0d7931',
 'artistURI': u'http://dbtune.org/musicbrainz/resource/artist/cbcbb22c-3a8d-46af-b4ba-09c98f0d7931',
 'releaceMbz': u'http://musicbrainz.org/release/e3655e9f-3db1-434d-bb4b-3529d09b2989',
 'release': ,
 'releaseURI': u'http://dbtune.org/musicbrainz/resource/release/e3655e9f-3db1-434d-bb4b-3529d09b2989',
 'score': 88,
 'track': None}

Notice this actually returns the more accurate result for 'J-Dilla' the pseudonym
used by Jay Dee when the album 'Donuts' was released.

Known Issues

2009-08-27

  • @param use_cache=False does not seem to work correctly - sorry you've got to use the cache for now...
  • turning off verbose seems to not work
  • no clean up of the ./cache directory - you have to do this yourself
  • we use dbtune.org/musicbrainz URIs - it is not clear this is best
  • no support for PUID MusicDNS lookup