1

The documentation for the Python musicbrainz2 library tells me that this is how I search for a release by disc id:

>>> import musicbrainz2.webservice as ws
>>> q = ws.Query()
>>> filter = ws.ReleaseFilter(discId='8jJklE258v6GofIqDIrE.c5ejBE-')
>>> results = q.getReleases(filter=filter)
>>> results[0].score
100
>>> results[0].release.title
u'Under the Pink'

But for a double CD I get the same release (as it should be) but different tracks when I search for the disc ID for the two CDs. This is also as it should be, but I don't see a way to get the disc number from the result of the query. Is it there somewhere? I think it is there in the XML, as a "medium".

dkagedal
  • 578
  • 2
  • 7
  • 14
  • Like you say it seems that the `count` attribute of the `` tag is the number of discs in the release. However I can't also find it anywhere in the module API and a quick grep of the source code doesn't find any reference to that tag either. – Pedro Romano Sep 21 '12 at 22:31
  • Time for a patch then. But I'm not sure I can find the time right now. – dkagedal Sep 22 '12 at 10:56

1 Answers1

3

The musicbrainz2 package, despite its name, seems to support only the deprecated version 1 of the web service's schema, which, as far as I could find, does not provide media information.

The solution seems to be to use instead, the musicbrainzngs package, which supports the MusicBrainz NGS web service (version 2). Then you just need to do something like the following (based on the example provided in the package's source):

>>> from pprint import pprint
>>> import musicbrainzngs
>>> musicbrainzngs.set_useragent("application", "0.01", "http://example.com")
>>> pprint(musicbrainzngs.get_release_by_id("e94757ff-2655-4690-b369-4012beba6114",["media"]))
{'release': {'barcode': '9421021463277',
             'country': 'NZ',
             'date': '2008-07-04',
             'id': 'e94757ff-2655-4690-b369-4012beba6114',
             'medium-list': [{'format': 'CD',
                              'position': '1',
                              'track-list': []}],
             'quality': 'normal',
             'status': 'Official',
             'text-representation': {'language': 'eng', 'script': 'Latn'},
             'title': 'Affordable Pop Music'}}

And voilà: medium-list information available!

Pedro Romano
  • 10,973
  • 4
  • 46
  • 50