From a2942895cc62c3ddb388071fd093057f23e8a789 Mon Sep 17 00:00:00 2001 From: Tai Lee Date: Tue, 21 May 2013 23:55:12 +1000 Subject: [PATCH] Display album ambiguation on info line (after similarity and source). Colorise disambiguation light grey for subtle distinction from album text. --- beets/ui/commands.py | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index bab48da06..ee4ad6a51 100644 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -205,9 +205,10 @@ def show_change(cur_artist, cur_album, match): print_(message) # Info line. - print_('from {0}, similarity: {1}'.format( + print_('from {0}, similarity: {1} [{2}]'.format( source_string(match.info.data_source), dist_string(match.distance), + ui.colorize('lightgray', album_disambig(match.info)), )) # Tracks. @@ -341,6 +342,24 @@ def _summary_judment(rec): print_('Importing as-is.') return action +def album_disambig(info): + # Label, year and media disambiguation, if available. + disambig = [] + if info.label: + disambig.append(info.label) + if info.year: + disambig.append(unicode(info.year)) + if info.media: + if info.mediums > 1: + disambig.append(u'{0}x{1}'.format( + info.mediums, info.media)) + else: + disambig.append(info.media) + if info.albumdisambig: + disambig.append(info.albumdisambig) + if disambig: + return u', '.join(disambig) + def choose_candidate(candidates, singleton, rec, cur_artist=None, cur_album=None, item=None, itemcount=None): """Given a sorted list of candidates, ask the user for a selection @@ -418,22 +437,10 @@ def choose_candidate(candidates, singleton, rec, cur_artist=None, line = '%i. %s - %s' % (i + 1, match.info.artist, match.info.album) - # Label, year and media disambiguation, if available. - disambig = [] - if match.info.label: - disambig.append(match.info.label) - if match.info.year: - disambig.append(unicode(match.info.year)) - if match.info.media: - if match.info.mediums > 1: - disambig.append(u'{0}x{1}'.format( - match.info.mediums, match.info.media)) - else: - disambig.append(match.info.media) - if match.info.albumdisambig: - disambig.append(match.info.albumdisambig) + disambig = album_disambig(match.info) if disambig: - line += u' [{0}]'.format(u', '.join(disambig)) + line += u' [{0}]'.format(ui.colorize('lightgray', + disambig)) line += ' (%s)' % dist_string(match.distance)