move track length params out of weights section

These aren't really weights, so I'm moving them out of "distance_weights".
This commit is contained in:
Adrian Sampson 2013-06-10 15:35:05 -07:00
parent c818663539
commit 33ff001d0a
2 changed files with 6 additions and 11 deletions

View file

@ -28,9 +28,6 @@ from beets.util import plurality
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')
@ -112,9 +109,9 @@ def track_distance(item, track_info, incl_artist=False):
# 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)
@ -294,10 +291,10 @@ def _recommendation(results):
# 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,

View file

@ -85,8 +85,6 @@ match:
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:
@ -107,8 +105,6 @@ match:
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:
@ -116,3 +112,5 @@ match:
media: []
original_year: no
ignored: []
track_length_grace: 10
track_length_max: 30