both release and release group disambig (#87)

This joins the two strings with a comma if both are present.
This commit is contained in:
Adrian Sampson 2013-02-02 12:42:53 -08:00
parent 89f1ae302e
commit 50a89e790c
3 changed files with 14 additions and 4 deletions

View file

@ -188,10 +188,17 @@ def album_info(release):
info.va = info.artist_id == VARIOUS_ARTISTS_ID
info.asin = release.get('asin')
info.releasegroup_id = release['release-group']['id']
info.albumdisambig = release['release-group'].get('disambiguation')
info.country = release.get('country')
info.albumstatus = release.get('status')
# Build up the disambiguation string from the release group and release.
disambig = []
if release['release-group'].get('disambiguation'):
disambig.append(release['release-group'].get('disambiguation'))
if release.get('disambiguation'):
disambig.append(release.get('disambiguation'))
info.albumdisambig = u', '.join(disambig)
# Release type not always populated.
if 'type' in release['release-group']:
reltype = release['release-group']['type']

View file

@ -32,6 +32,8 @@ Other new stuff:
* Album listings in the importer UI now show the release medium (CD, Vinyl,
3xCD, etc.) as well as the disambiguation string. Thanks to Peter Schnebel.
* When getting data from MusicBrainz, the album disambiguation string
(``albumdisambig``) now reflects both the release and the release group.
* :doc:`/plugins/mpdupdate`: Sends an update message whenever *anything* in the
database changes---not just when importing. Thanks to Dang Mai Hai.
* When the importer UI shows a difference in track numbers or durations, they

View file

@ -23,12 +23,12 @@ class MBAlbumInfoTest(unittest.TestCase):
'title': 'ALBUM TITLE',
'id': 'ALBUM ID',
'asin': 'ALBUM ASIN',
'disambiguation': 'DISAMBIGUATION',
'disambiguation': 'R_DISAMBIGUATION',
'release-group': {
'type': 'Album',
'first-release-date': date_str,
'id': 'RELEASE GROUP ID',
'disambiguation': 'DISAMBIGUATION',
'disambiguation': 'RG_DISAMBIGUATION',
},
'artist-credit': [
{
@ -248,7 +248,8 @@ class MBAlbumInfoTest(unittest.TestCase):
def test_parse_disambig(self):
release = self._make_release(None)
d = mb.album_info(release)
self.assertEqual(d.albumdisambig, 'DISAMBIGUATION')
self.assertEqual(d.albumdisambig,
'RG_DISAMBIGUATION, R_DISAMBIGUATION')
def test_parse_disctitle(self):
tracks = [self._make_track('TITLE ONE', 'ID ONE', 100.0 * 1000.0),