From 5f74bf4394350905bc4ded74d215d52308d32f47 Mon Sep 17 00:00:00 2001 From: Bootjewolf <35065763+Bootjewolf@users.noreply.github.com> Date: Tue, 15 Nov 2022 12:47:53 +0100 Subject: [PATCH] Added the remixer field from musicbrainz --- beets/autotag/mb.py | 16 ++++++++++++++++ beets/library.py | 1 + 2 files changed, 17 insertions(+) diff --git a/beets/autotag/mb.py b/beets/autotag/mb.py index 3bd7e8c81..4728b6f7c 100644 --- a/beets/autotag/mb.py +++ b/beets/autotag/mb.py @@ -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) diff --git a/beets/library.py b/beets/library.py index becf19390..981563974 100644 --- a/beets/library.py +++ b/beets/library.py @@ -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,