Added the remixer field from musicbrainz

This commit is contained in:
Bootjewolf 2022-11-15 12:47:53 +01:00
parent e201dd4fe5
commit 5f74bf4394
2 changed files with 17 additions and 0 deletions

View file

@ -202,6 +202,19 @@ def _flatten_artist_credit(credit):
)
def _get_remixer_names(relations):
""" Given a list representing the artist relationships extract the names of
the remixers and concatenate them.
"""
remixers = []
for relation in relations:
if relation['type'] == 'remixer':
remixers.append(relation['artist']['name'])
return ', '.join(remixers)
def track_info(recording, index=None, medium=None, medium_index=None,
medium_total=None):
"""Translates a MusicBrainz recording result dictionary into a beets
@ -231,6 +244,9 @@ def track_info(recording, index=None, medium=None, medium_index=None,
artist = recording['artist-credit'][0]['artist']
info.artist_id = artist['id']
if recording.get('artist-relation-list'):
info.remixer = _get_remixer_names(recording['artist-relation-list'])
if recording.get('length'):
info.length = int(recording['length']) / (1000.0)

View file

@ -466,6 +466,7 @@ class Item(LibModel):
'artist': types.STRING,
'artist_sort': types.STRING,
'artist_credit': types.STRING,
'remixer': types.STRING,
'album': types.STRING,
'albumartist': types.STRING,
'albumartist_sort': types.STRING,