From 6acee803f7e74ccc656f33e79c7527f07a31c1ca Mon Sep 17 00:00:00 2001 From: J0J0 Todos Date: Thu, 3 Nov 2022 20:37:54 +0100 Subject: [PATCH] Exclude ID's when preserving flexible attributes - Bandcamp, Spotify, Deezer and Beatport ID's are saved in the library as flexible attributes. - On _reimports_ the method importer.ImportTask.reimport_metadata() takes care of preserving existing values for flexible attributes instead of applying new (and potentially empty) values. - In this case we don't want this behaviour and need to make sure that new values are applied. Therefore we check whether such ID's of metadata services are present in the reimported items and exclude them in reimport_metadata(). --- beets/importer.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/beets/importer.py b/beets/importer.py index c0319fc96..feebadc09 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -839,6 +839,19 @@ class ImportTask(BaseImportTask): dup_item.id, displayable_path(item.path) ) + # We exclude certain flexible attributes from the preserving + # process since they might have been fetched from MusicBrainz + # and been set in beets.autotag.apply_metadata(). + # discogs_albumid might also have been set but is not a + # flexible attribute, thus no exclude is required. + if item.get('bandcamp_album_id'): + dup_item.bandcamp_album_id = item.bandcamp_album_id + if item.get('spotify_album_id'): + dup_item.spotify_album_id = item.spotify_album_id + if item.get('deezer_album_id'): + dup_item.deezer_album_id = item.deezer_album_id + if item.get('beatport_album_id'): + dup_item.beatport_album_id = item.beatport_album_id item.update(dup_item._values_flex) log.debug( 'Reimported item flexible attributes {0} '