diff --git a/beets/autotag/distance.py b/beets/autotag/distance.py index b2c02ebd14..cc0873c8f3 100644 --- a/beets/autotag/distance.py +++ b/beets/autotag/distance.py @@ -146,6 +146,7 @@ def generic_penalty_keys(self) -> list[str]: return [ k.replace("album_", "").replace("track_", "").replace("_", " ") for k in self._penalties + if self[k] ] # Access the components and their aggregates. diff --git a/docs/changelog.rst b/docs/changelog.rst index 94b09a5103..8df74d84ac 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -38,9 +38,12 @@ New features See :doc:`plugins/tidal` for more information. -.. - Bug fixes - ~~~~~~~~~ +Bug fixes +~~~~~~~~~ + +- :ref:`import-cmd`: Tags with a zero distance penalty are no longer shown as + differences in the match display. Previously, custom ``distance_weights`` + could cause fields with no actual mismatch to appear in the ``≠`` line. .. For plugin developers diff --git a/test/autotag/test_distance.py b/test/autotag/test_distance.py index b37f4b6377..b5226d41d3 100644 --- a/test/autotag/test_distance.py +++ b/test/autotag/test_distance.py @@ -124,6 +124,12 @@ def test_penalties_sort(self, dist): dist.add("medium", 0.75) assert dist.items() == [("album", 0.25), ("medium", 0.25)] + def test_generic_penalty_keys_excludes_zero_penalties(self, dist): + dist.add("album", 0.5) + dist.add("label", 0.0) + dist.add("medium", 0.25) + assert dist.generic_penalty_keys == ["album", "medium"] + def test_update(self, dist): dist1 = dist dist1.add("album", 0.5)