Commits

Adrian Sampson committed f0c9d55

move track length params out of weights section

These aren't really weights, so I'm moving them out of "distance_weights".

Comments (0)

Files changed (2)

beets/autotag/match.py

 from beets.util.enumeration import enum
 from beets.autotag import hooks
 
-# A configuration view for the distance weights.
-weights = config['match']['distance_weights']
-
 # Recommendation enumeration.
 recommendation = enum('none', 'low', 'medium', 'strong', name='recommendation')
 
     # Length.
     if track_info.length:
         diff = abs(item.length - track_info.length) - \
-               weights['track_length_grace'].as_number()
+               config['match']['track_length_grace'].as_number()
         dist.add_ratio('track_length', diff,
-                       weights['track_length_max'].as_number())
+                       config['match']['track_length_max'].as_number())
 
     # Title.
     dist.add_string('track_title', item.title, track_info.title)
 
     # Downgrade to the max rec if it is lower than the current rec for an
     # applied penalty.
-    keys = set(key for _, key in min_dist)
+    keys = set(key for key, _ in min_dist)
     if isinstance(results[0], hooks.AlbumMatch):
         for track_dist in min_dist.tracks.values():
-            keys.update(key for _, key in track_dist)
+            keys.update(key for key, _ in track_dist)
     for key in keys:
         max_rec = config['match']['max_rec'][key].as_choice({
             'strong': recommendation.strong,

beets/config_default.yaml

         track_title: strong
         track_artist: strong
         track_index: strong
-        track_length_grace: strong
-        track_length_max: strong
         track_length: strong
         track_id: strong
     distance_weights:
         track_title: 3.0
         track_artist: 2.0
         track_index: 1.0
-        track_length_grace: 10
-        track_length_max: 30
         track_length: 2.0
         track_id: 5.0
     preferred:
         media: []
         original_year: no
     ignored: []
+    track_length_grace: 10
+    track_length_max: 30