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().
This commit is contained in:
J0J0 Todos 2022-11-03 20:37:54 +01:00
parent fd4cecc29e
commit 6acee803f7

View file

@ -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} '