Commits

phmongeau committed f95cad7

use fuzzy threshold from config file

  • Participants
  • Parent commits 5b81157

Comments (0)

Files changed (2)

beets/config_default.yaml

         partial: medium
         tracklength: strong
         tracknumber: strong
+
+fuzzy:
+    threshold: 0.7
         return False
     val = util.as_string(val)
     queryMatcher = difflib.SequenceMatcher(None, expr, val)
-    return queryMatcher.quick_ratio() > 0.7
+    return queryMatcher.quick_ratio() > beets.config['fuzzy']['threshold'].as_number()
 
 # Path element formatting for templating.
 def format_for_path(value, key=None, pathmod=None):
     def match(self, item):
         value = util.as_string(getattr(item, self.field))
         queryMatcher.set_seq1(item)
-        return queryMatcher.quick_ratio() > 0.7
+        return queryMatcher.quick_ratio() > beets.config['fuzzy']['threshold'].as_number()
 
 class BooleanQuery(MatchQuery):
     """Matches a boolean field. Pattern should either be a boolean or a