From 9c8e726e4f2de07e5fc6cb378553ddaf01045f7e Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Wed, 2 Jun 2010 23:57:16 -0700 Subject: [PATCH] bypass candidate selection if second-best choice is much worse than first choice --- beets/ui.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/beets/ui.py b/beets/ui.py index 5c257f2f6..b5c1c2d0f 100644 --- a/beets/ui.py +++ b/beets/ui.py @@ -56,9 +56,13 @@ def choose_candidate(cur_artist, cur_album, candidates): """ # Is the change good enough? MIN_ASSUME_THRESH = 0.2 #fixme + MIN_ASSUME_DIFFERENCE = 0.3 #fixme top_dist, _, _ = candidates[0] bypass_candidates = False - if top_dist <= MIN_ASSUME_THRESH or len(candidates) <= 1: + if top_dist <= MIN_ASSUME_THRESH or \ + len(candidates) <= 1 or \ + (len(candidates) >= 2 and candidates[1][0] - candidates[0][0] >= + MIN_ASSUME_DIFFERENCE): dist, items, info = candidates[0] bypass_candidates = True