mirror of
https://github.com/beetbox/beets.git
synced 2026-01-30 20:13:37 +01:00
distance -> similarity (#114)
This commit is contained in:
parent
1896f397a2
commit
633e878ee8
2 changed files with 14 additions and 5 deletions
6
NEWS
6
NEWS
|
|
@ -1,6 +1,10 @@
|
|||
1.0b8
|
||||
-----
|
||||
* Added a new plugin event, "imported_album", which is called every
|
||||
* The "distance" number, which quantifies how different an album's
|
||||
current and proposed metadata are, is now displayed as "similarity"
|
||||
instead. This should be less noisy and confusing; you'll now see
|
||||
99.5% instead of 0.00489323.
|
||||
* Added a new plugin event, "album_imported", which is called every
|
||||
time an album is added to the library. (Thanks, Lugoues!)
|
||||
* A new plugin method, register_listener, is an imperative alternative
|
||||
to the @listen decorator (Thanks again, Lugoues!)
|
||||
|
|
|
|||
|
|
@ -61,10 +61,10 @@ class ImportAbort(Exception):
|
|||
# Autotagger utilities and support.
|
||||
|
||||
def dist_string(dist, color):
|
||||
"""Formats a distance (a float) as a string. The string is
|
||||
colorized if color is True.
|
||||
"""Formats a distance (a float) as a similarity percentage string.
|
||||
The string is colorized if color is True.
|
||||
"""
|
||||
out = str(dist)
|
||||
out = '%.1f%%' % ((1 - dist) * 100)
|
||||
if color:
|
||||
if dist <= autotag.STRONG_REC_THRESH:
|
||||
out = ui.colorize('green', out)
|
||||
|
|
@ -85,6 +85,7 @@ def show_change(cur_artist, cur_album, items, info, dist, color=True):
|
|||
else:
|
||||
print_(' %s' % album)
|
||||
|
||||
# Identify the album in question.
|
||||
if cur_artist != info['artist'] or \
|
||||
(cur_album != info['album'] and info['album'] != VARIOUS_ARTISTS):
|
||||
artist_l, artist_r = cur_artist or '', info['artist']
|
||||
|
|
@ -103,7 +104,11 @@ def show_change(cur_artist, cur_album, items, info, dist, color=True):
|
|||
show_album(artist_r, album_r)
|
||||
else:
|
||||
print_("Tagging: %s - %s" % (info['artist'], info['album']))
|
||||
print_('(Distance: %s)' % dist_string(dist, color))
|
||||
|
||||
# Distance/similarity.
|
||||
print_('(Similarity: %s)' % dist_string(dist, color))
|
||||
|
||||
# Tracks.
|
||||
for i, (item, track_data) in enumerate(zip(items, info['tracks'])):
|
||||
cur_track = str(item.track)
|
||||
new_track = str(i+1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue