public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/beets] rawhide: rhbz#2532646
@ 2026-09-13 19:02 Gerald B Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Gerald B Cox @ 2026-09-13 19:02 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/beets
Branch : rawhide
Commit : 4813370102e56c94c52c46a0b24b6801847d605f
Author : Gerald B Cox <gbcox@fedoraproject.org>
Date   : 2026-09-13T12:01:52-07:00
Stats  : +0/-1 in 1 file(s)
URL    : https://src.fedoraproject.org/rpms/beets/c/4813370102e56c94c52c46a0b24b6801847d605f?branch=rawhide

Log:
rhbz#2532646

---
diff --git a/beets.spec b/beets.spec
index e4c6b23..e0b8fe5 100644
--- a/beets.spec
+++ b/beets.spec
@@ -7,7 +7,6 @@ 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
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [rpms/beets] rawhide: rhbz#2532646
@ 2026-09-13  4:20 Gerald B Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Gerald B Cox @ 2026-09-13  4:20 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/beets
Branch : rawhide
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=rawhide

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)
+ )

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-13 19:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-13 19:02 [rpms/beets] rawhide: rhbz#2532646 Gerald B Cox
  -- strict thread matches above, loose matches on Subject: below --
2026-09-13  4:20 Gerald B Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox