From 2a42c75cba5836a03506c604f1ca3a98d33197ab Mon Sep 17 00:00:00 2001 From: Philippe Mongeau Date: Sun, 10 Mar 2013 19:07:29 -0400 Subject: [PATCH] fuzzy: use smartcase for the pattern ignore case unless the pattern contains a capital letter --- beetsplug/fuzzy.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/beetsplug/fuzzy.py b/beetsplug/fuzzy.py index 363122e8d..9e6eb24c7 100644 --- a/beetsplug/fuzzy.py +++ b/beetsplug/fuzzy.py @@ -35,8 +35,11 @@ class FuzzyQuery(PluginQuery): if pattern is None: return False val = util.as_string(val) + # smartcase + if(pattern.islower()): + val = val.lower() queryMatcher = difflib.SequenceMatcher(None, pattern, val) - return queryMatcher.quick_ratio() > self.threshold + return queryMatcher.quick_ratio() >= self.threshold class FuzzyPlugin(BeetsPlugin):