From 00c621d26c31c8da46c3ec30c5952e746d584a8d Mon Sep 17 00:00:00 2001 From: Bin Jin Date: Wed, 9 May 2018 16:32:15 +0800 Subject: [PATCH] mbsync: fix updating album with invalid first track MBID MBID of recording could become invalid after merging. The existing code always copies metadata from first track after updating. But for albums with invalid track MBID that happens to be the first track, MusicBrainz changes won't be applied to whole album, only whose tracks with valid MBID. This is particularly annoying since those changes are actually displayed for every `beet mbsync` run, but never get applied. Fix this issue by finding any track that get MusicBrainz updates, and apply it to whole album. --- beetsplug/mbsync.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/beetsplug/mbsync.py b/beetsplug/mbsync.py index cf58c82d50..30564ef4fb 100644 --- a/beetsplug/mbsync.py +++ b/beetsplug/mbsync.py @@ -145,10 +145,13 @@ def albums(self, lib, query, move, pretend, write): with lib.transaction(): autotag.apply_metadata(album_info, mapping) changed = False + # Find any changed item to apply MusicBrainz changes to album. + any_changed_item = items[0] for item in items: item_changed = ui.show_model_changes(item) changed |= item_changed if item_changed: + any_changed_item = item apply_item_changes(lib, item, move, pretend, write) if not changed: @@ -158,7 +161,7 @@ def albums(self, lib, query, move, pretend, write): if not pretend: # Update album structure to reflect an item in it. for key in library.Album.item_keys: - a[key] = items[0][key] + a[key] = any_changed_item[key] a.store() # Move album art (and any inconsistent items).