From bd788544c20bad40421faa0b367587354e718f8a Mon Sep 17 00:00:00 2001 From: David Logie Date: Thu, 22 Feb 2018 18:46:14 +0000 Subject: [PATCH 1/3] Make sure release events are selected in preferred order. Previously, release events were selected based on the order that MusicBrainz listed them rather than the order defined in config.yaml. --- beets/autotag/mb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beets/autotag/mb.py b/beets/autotag/mb.py index 385dc64fb..9ce449a8b 100644 --- a/beets/autotag/mb.py +++ b/beets/autotag/mb.py @@ -118,8 +118,8 @@ def _preferred_release_event(release): """ countries = config['match']['preferred']['countries'].as_str_seq() - for event in release.get('release-event-list', {}): - for country in countries: + for country in countries: + for event in release.get('release-event-list', {}): try: if country in event['area']['iso-3166-1-code-list']: return country, event['date'] From d6b6ebbeb96212d5477e6aaf5244e3ec61a836e7 Mon Sep 17 00:00:00 2001 From: David Logie Date: Thu, 22 Feb 2018 18:44:51 +0000 Subject: [PATCH 2/3] mbcollection: Make sure missing albums are removed from collections correctly. --- beetsplug/mbcollection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beetsplug/mbcollection.py b/beetsplug/mbcollection.py index c01d544a4..d99c386c9 100644 --- a/beetsplug/mbcollection.py +++ b/beetsplug/mbcollection.py @@ -103,8 +103,8 @@ class MusicBrainzCollectionPlugin(BeetsPlugin): offset = 0 albums_in_collection, release_count = _fetch(offset) for i in range(0, release_count, FETCH_CHUNK_SIZE): - offset += FETCH_CHUNK_SIZE albums_in_collection += _fetch(offset)[0] + offset += FETCH_CHUNK_SIZE return albums_in_collection @@ -122,7 +122,7 @@ class MusicBrainzCollectionPlugin(BeetsPlugin): def remove_missing(self, collection_id, lib_albums): lib_ids = set([x.mb_albumid for x in lib_albums]) albums_in_collection = self._get_albums_in_collection(collection_id) - remove_me = list(lib_ids - set(albums_in_collection)) + remove_me = list(set(albums_in_collection) - lib_ids) for i in range(0, len(remove_me), FETCH_CHUNK_SIZE): chunk = remove_me[i:i + FETCH_CHUNK_SIZE] mb_call( From 5d2e203f2487c052e7d38180c1e7fa3d84683979 Mon Sep 17 00:00:00 2001 From: David Logie Date: Fri, 23 Feb 2018 21:43:12 +0000 Subject: [PATCH 3/3] Add changelog entry for #2816. --- docs/changelog.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index a38d5504a..d639b0e20 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -56,6 +56,9 @@ Fixes: incompatible between the source and target file formats. :bug:`2814` Thanks to :user:`autrimpo`. +* Importing a release with multiple release events now selects the + event based on the order of your :ref:`preferred` countries rather than + the order of release events in MusicBrainz. :bug:`2816` For developers: