public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Gerald B Cox <gbcox@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/beets] f44: rhbz#2532646
Date: Sun, 13 Sep 2026 04:25:32 GMT [thread overview]
Message-ID: <178927353221.1.288385783883692398.rpms-beets-6dfd976cad3f@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/beets
Branch : f44
Commit : 6dfd976cad3f9d8be16d5992f6a4bb2baf11c2f6
Author : Gerald B Cox <gbcox@fedoraproject.org>
Date : 2026-09-12T21:20:09-07:00
Stats : +189/-0 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/beets/c/6dfd976cad3f9d8be16d5992f6a4bb2baf11c2f6?branch=f44
Log:
rhbz#2532646
---
diff --git a/beets.spec b/beets.spec
index e0b8fe5..e4c6b23 100644
--- a/beets.spec
+++ b/beets.spec
@@ -7,6 +7,7 @@ URL: http://pypi.org/project/beets/
Source0: %{pypi_source beets}
Patch: allow-python3.15-build.patch
+Patch1: fix-import-duplicate-mbids.patch
BuildRequires: python-requests-ratelimiter
diff --git a/fix-import-duplicate-mbids.patch b/fix-import-duplicate-mbids.patch
new file mode 100644
index 0000000..2490305
--- /dev/null
+++ b/fix-import-duplicate-mbids.patch
@@ -0,0 +1,188 @@
+diff --git a/beets/importer/tasks.py b/beets/importer/tasks.py
+index 614281e9b..b7083426d 100644
+--- a/beets/importer/tasks.py
++++ b/beets/importer/tasks.py
+@@ -90,6 +90,23 @@ def _dup_items(obj: library.Album | library.Item) -> list[library.Item]:
+ return [obj]
+
+
++def _musicbrainz_album_ids_match(
++ new_album: library.Album, old_album: library.Album
++) -> bool:
++ """Compare MusicBrainz album IDs in order of specificity.
++
++ A release ID identifies a particular release, so it takes precedence over
++ the broader release-group ID. If either side lacks an ID at both levels,
++ callers must fall back to the configured duplicate keys.
++ """
++ for field in ("mb_albumid", "mb_releasegroupid"):
++ new_id = new_album.get(field)
++ old_id = old_album.get(field)
++ if new_id and old_id:
++ return new_id == old_id
++ return True
++
++
+ def resolve_upgrade(
+ new_items: list[library.Item],
+ old_items: list[library.Item],
+@@ -590,6 +607,9 @@ class ImportTask(BaseImportTask):
+
+ duplicates = []
+ for album in lib.albums(dup_query):
++ if not _musicbrainz_album_ids_match(tmp_album, album):
++ continue
++
+ # Check whether the album paths are all present in the task
+ # i.e. album is being completely re-imported by the task,
+ # in which case it is not a duplicate (will be replaced).
+diff --git a/beets/util/__init__.py b/beets/util/__init__.py
+index 993b25ff0..cfa2fb518 100644
+--- a/beets/util/__init__.py
++++ b/beets/util/__init__.py
+@@ -819,6 +819,7 @@ def get_most_common_tags(items: Sequence[Item]) -> Likelies:
+ "year",
+ "disctotal",
+ "mb_albumid",
++ "mb_releasegroupid",
+ "label",
+ "barcode",
+ "catalognum",
+@@ -1253,6 +1254,7 @@ class Likelies(AttrDict[Any]):
+ year: int
+ disctotal: int
+ mb_albumid: str
++ mb_releasegroupid: str
+ label: str
+ barcode: str
+ catalognum: str
+diff --git a/docs/changelog.rst b/docs/changelog.rst
+index 98c8e5ec9..f34f3b11e 100644
+--- a/docs/changelog.rst
++++ b/docs/changelog.rst
+@@ -13,9 +13,12 @@ Unreleased
+ New features
+ ~~~~~~~~~~~~
+
+-..
+- Bug fixes
+- ~~~~~~~~~
++Bug fixes
++~~~~~~~~~
++
++- Album imports no longer treat releases with conflicting MusicBrainz release or
++ release-group IDs as duplicates merely because their album artist and title
++ match.
+
+ ..
+ For plugin developers
+diff --git a/test/test_importer.py b/test/test_importer.py
+index 351dbb2a1..5043f7b19 100644
+--- a/test/test_importer.py
++++ b/test/test_importer.py
+@@ -1497,6 +1497,105 @@ class TestImportDuplicateAlbum(PluginMixin, ImportHelper):
+ return album
+
+
++class TestAsIsImportDuplicateAlbum(ImportHelper):
++ def setup_beets(self):
++ super().setup_beets()
++ self.album = self.add_album_fixture()
++ self.prepare_album_for_import(1)
++ self.importer = self.setup_importer(
++ autotag=False,
++ duplicate_action="skip",
++ duplicate_keys={"album": "albumartist album"},
++ )
++
++ @pytest.mark.parametrize(
++ "old_album_id,new_album_id,old_group_id,new_group_id,album_count",
++ [
++ pytest.param(
++ "43ca95e6-8d1e-4165-99a8-e6fd5a993500",
++ "7a36ef45-f1c4-44c5-ae5a-7d9cabfe2718",
++ "cbe55545-7a3e-3f8c-8c5f-33984a818e91",
++ "6258df90-78c7-3395-8830-e7b4328a002c",
++ 2,
++ id="different-releases-and-release-groups",
++ ),
++ pytest.param(
++ "old-release",
++ "new-release",
++ "same-release-group",
++ "same-release-group",
++ 2,
++ id="different-releases-same-release-group",
++ ),
++ pytest.param(
++ "",
++ "",
++ "old-release-group",
++ "new-release-group",
++ 2,
++ id="missing-releases-different-release-groups",
++ ),
++ pytest.param(
++ "same-release",
++ "same-release",
++ "old-release-group",
++ "new-release-group",
++ 1,
++ id="same-release",
++ ),
++ pytest.param(
++ "",
++ "",
++ "same-release-group",
++ "same-release-group",
++ 1,
++ id="missing-releases-same-release-group",
++ ),
++ pytest.param(
++ "",
++ "new-release",
++ "",
++ "new-release-group",
++ 1,
++ id="identifiers-missing-on-one-side",
++ ),
++ ],
++ )
++ def test_musicbrainz_id_precedence(
++ self,
++ old_album_id,
++ new_album_id,
++ old_group_id,
++ new_group_id,
++ album_count,
++ ):
++ self.album.update(
++ {
++ "albumartist": "Santana",
++ "album": "Santana",
++ "mb_albumid": old_album_id,
++ "mb_releasegroupid": old_group_id,
++ }
++ )
++ self.album.store()
++
++ import_file = self.import_media[0]
++ import_file.update(
++ {
++ "artist": "Santana",
++ "albumartist": "Santana",
++ "album": "Santana",
++ "mb_albumid": new_album_id,
++ "mb_releasegroupid": new_group_id,
++ }
++ )
++ import_file.save()
++
++ self.importer.run()
++
++ assert len(self.lib.albums()) == album_count
++
++
+ @patch(
+ "beets.metadata_plugins.candidates", Mock(side_effect=album_candidates_mock)
+ )
next reply other threads:[~2026-09-13 4:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-13 4:25 Gerald B Cox [this message]
2026-09-13 19:07 [rpms/beets] f44: rhbz#2532646 Gerald B Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178927353221.1.288385783883692398.rpms-beets-6dfd976cad3f@fedoraproject.org \
--to=gbcox@fedoraproject.org \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox