From 633e878ee84d80c263540df45e463175c4b76efc Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sat, 9 Apr 2011 14:07:14 -0700 Subject: [PATCH] distance -> similarity (#114) --- NEWS | 6 +++++- beets/ui/commands.py | 13 +++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 45f2ee37f..9adafb9b9 100644 --- a/NEWS +++ b/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!) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 3d5038611..e61e9cccb 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -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)