mirror of
https://github.com/beetbox/beets.git
synced 2025-12-08 01:23:09 +01:00
Fix singleton candidate ordering when using MB id
* Fix an issue that caused the candidates for a singleton not to be returned ordered by distance from autotag.match.tag_item(), when searching multiple MusicBrainz ids (ie. several "--musicbrainzid" arguments). The candidates are now explicitely reordered before being returned and before the recommendation is computed. * Fix test_importer.mocked_get_recording_by_id so that the artist is nested properly (and as a result, taken into account into the distance calculations).
This commit is contained in:
parent
4e5ddac949
commit
39cf4651b8
2 changed files with 10 additions and 10 deletions
|
|
@ -467,16 +467,16 @@ def tag_item(item, search_artist=None, search_title=None,
|
||||||
candidates[track_info.track_id] = \
|
candidates[track_info.track_id] = \
|
||||||
hooks.TrackMatch(dist, track_info)
|
hooks.TrackMatch(dist, track_info)
|
||||||
# If this is a good match, then don't keep searching.
|
# If this is a good match, then don't keep searching.
|
||||||
rec = _recommendation(candidates.values())
|
rec = _recommendation(sorted(candidates.itervalues()))
|
||||||
if rec == Recommendation.strong and \
|
if rec == Recommendation.strong and \
|
||||||
not config['import']['timid']:
|
not config['import']['timid']:
|
||||||
log.debug(u'Track ID match.')
|
log.debug(u'Track ID match.')
|
||||||
return candidates.values(), rec
|
return sorted(candidates.itervalues()), rec
|
||||||
|
|
||||||
# If we're searching by ID, don't proceed.
|
# If we're searching by ID, don't proceed.
|
||||||
if search_ids != []:
|
if search_ids != []:
|
||||||
if candidates:
|
if candidates:
|
||||||
return candidates.values(), rec
|
return sorted(candidates.itervalues()), rec
|
||||||
else:
|
else:
|
||||||
return [], Recommendation.none
|
return [], Recommendation.none
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1844,13 +1844,13 @@ def mocked_get_recording_by_id(id_, includes=[], release_status=[],
|
||||||
'title': releases[id_][0],
|
'title': releases[id_][0],
|
||||||
'id': id_,
|
'id': id_,
|
||||||
'length': 59,
|
'length': 59,
|
||||||
},
|
'artist-credit': [{
|
||||||
'artist-credit': [{
|
'artist': {
|
||||||
'artist': {
|
'name': releases[id_][1],
|
||||||
'name': releases[id_][1],
|
'id': 'some-id',
|
||||||
'id': 'some-id',
|
},
|
||||||
},
|
}],
|
||||||
}],
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue