mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
fuzzy: use smartcase for the pattern
ignore case unless the pattern contains a capital letter
This commit is contained in:
parent
c9c57cbb29
commit
2a42c75cba
1 changed files with 4 additions and 1 deletions
|
|
@ -35,8 +35,11 @@ class FuzzyQuery(PluginQuery):
|
||||||
if pattern is None:
|
if pattern is None:
|
||||||
return False
|
return False
|
||||||
val = util.as_string(val)
|
val = util.as_string(val)
|
||||||
|
# smartcase
|
||||||
|
if(pattern.islower()):
|
||||||
|
val = val.lower()
|
||||||
queryMatcher = difflib.SequenceMatcher(None, pattern, val)
|
queryMatcher = difflib.SequenceMatcher(None, pattern, val)
|
||||||
return queryMatcher.quick_ratio() > self.threshold
|
return queryMatcher.quick_ratio() >= self.threshold
|
||||||
|
|
||||||
|
|
||||||
class FuzzyPlugin(BeetsPlugin):
|
class FuzzyPlugin(BeetsPlugin):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue