From f3545860da0118c91c0c802b8b905f5554589a75 Mon Sep 17 00:00:00 2001 From: Tai Lee Date: Mon, 3 Jun 2013 00:35:32 +1000 Subject: [PATCH] Add `ignored` setting. Don't show matches with specified penalties applied, e.g. missing tracks or unmatched tracks. If you know you never want these, they can clutter up the interface especially now that we have multiple data sources. --- beets/autotag/match.py | 9 ++++++++- beets/config_default.yaml | 1 + docs/changelog.rst | 2 ++ docs/reference/config.rst | 11 +++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/beets/autotag/match.py b/beets/autotag/match.py index a44784c07..c2a2372ca 100644 --- a/beets/autotag/match.py +++ b/beets/autotag/match.py @@ -575,8 +575,15 @@ def _add_candidate(items, results, info): # Get the change distance. dist = distance(items, info, mapping) - log.debug('Success. Distance: %f' % dist) + # Skip matches with ignored penalties. + penalties = [key for _, key in dist.sorted] + for penalty in config['match']['ignored'].as_str_seq(): + if penalty in penalties: + log.debug('Ignored. Penalty: %s' % penalty) + return + + log.debug('Success. Distance: %f' % dist) results[info.album_id] = hooks.AlbumMatch(dist, info, mapping, extra_items, extra_tracks) diff --git a/beets/config_default.yaml b/beets/config_default.yaml index 7b9867813..44cb51051 100644 --- a/beets/config_default.yaml +++ b/beets/config_default.yaml @@ -115,3 +115,4 @@ match: countries: [] media: [] original_year: no + ignored: [] diff --git a/docs/changelog.rst b/docs/changelog.rst index 527982190..4076248d0 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -68,6 +68,8 @@ Changelog number is still "correct", just in a different format. * Sort missing and unmatched tracks by index and title and group them together for better readability. + * Don't show potential matches that have specific penalties applied, as + configured by the :ref:`ignored` setting. * Improve calculation of similarity score and recommendation: diff --git a/docs/reference/config.rst b/docs/reference/config.rst index c9f36c5e1..d320cd655 100644 --- a/docs/reference/config.rst +++ b/docs/reference/config.rst @@ -458,6 +458,17 @@ Here's an example:: By default, none of these options are enabled. +.. _ignored: + +ignored +~~~~~~~ + +You can completely avoid matches that have certain penalties applied by adding +the penalty name to the ``ignored`` setting:: + + match: + ignored: missing_tracks unmatched_tracks + .. _path-format-config: Path Format Configuration