mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 16:42:42 +01:00
Consider unseen tracks in data source matching
This commit is contained in:
parent
1f62a928ec
commit
90ca0a799a
3 changed files with 3 additions and 13 deletions
|
|
@ -409,9 +409,7 @@ def track_distance(
|
||||||
dist.add_expr("medium", item.disc != track_info.medium)
|
dist.add_expr("medium", item.disc != track_info.medium)
|
||||||
|
|
||||||
# Plugins.
|
# Plugins.
|
||||||
if (original := item.get("data_source")) and (
|
if (actual := track_info.data_source) != item.get("data_source"):
|
||||||
actual := track_info.data_source
|
|
||||||
) != original:
|
|
||||||
dist.add("data_source", metadata_plugins.get_penalty(actual))
|
dist.add("data_source", metadata_plugins.get_penalty(actual))
|
||||||
|
|
||||||
return dist
|
return dist
|
||||||
|
|
@ -529,9 +527,6 @@ def distance(
|
||||||
dist.add("unmatched_tracks", 1.0)
|
dist.add("unmatched_tracks", 1.0)
|
||||||
|
|
||||||
# Plugins.
|
# Plugins.
|
||||||
if (
|
if (data_source := album_info.data_source) != likelies["data_source"]:
|
||||||
likelies["data_source"]
|
|
||||||
and (data_source := album_info.data_source) != likelies["data_source"]
|
|
||||||
):
|
|
||||||
dist.add("data_source", metadata_plugins.get_penalty(data_source))
|
dist.add("data_source", metadata_plugins.get_penalty(data_source))
|
||||||
return dist
|
return dist
|
||||||
|
|
|
||||||
|
|
@ -61,11 +61,6 @@ databases. They share the following configuration options:
|
||||||
candidate comes from a different data source than what appears to be the
|
candidate comes from a different data source than what appears to be the
|
||||||
original source of your music collection.
|
original source of your music collection.
|
||||||
|
|
||||||
.. important::
|
|
||||||
|
|
||||||
This setting only applies to reimports, not to first-time imports, since
|
|
||||||
``data_source`` is unknown for new files.
|
|
||||||
|
|
||||||
**Example configurations:**
|
**Example configurations:**
|
||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,7 @@ class TestDataSourceDistance:
|
||||||
_p("Original", "Other", 0.5, 1.0, MISMATCH, id="mismatch"),
|
_p("Original", "Other", 0.5, 1.0, MISMATCH, id="mismatch"),
|
||||||
_p("Original", "unknown", 0.5, 1.0, MISMATCH, id="mismatch-unknown"), # noqa: E501
|
_p("Original", "unknown", 0.5, 1.0, MISMATCH, id="mismatch-unknown"), # noqa: E501
|
||||||
_p("Original", None, 0.5, 1.0, MISMATCH, id="mismatch-no-info"),
|
_p("Original", None, 0.5, 1.0, MISMATCH, id="mismatch-no-info"),
|
||||||
_p(None, "Other", 0.5, 1.0, MATCH, id="match-no-original"),
|
_p(None, "Other", 0.5, 1.0, MISMATCH, id="mismatch-no-original"),
|
||||||
_p("unknown", "unknown", 0.5, 1.0, MATCH, id="match-unknown"),
|
_p("unknown", "unknown", 0.5, 1.0, MATCH, id="match-unknown"),
|
||||||
_p("Original", "Other", 1.0, 1.0, 0.25, id="mismatch-max-penalty"),
|
_p("Original", "Other", 1.0, 1.0, 0.25, id="mismatch-max-penalty"),
|
||||||
_p("Original", "Other", 0.5, 5.0, 0.3125, id="mismatch-high-weight"), # noqa: E501
|
_p("Original", "Other", 0.5, 5.0, 0.3125, id="mismatch-high-weight"), # noqa: E501
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue