mirror of
https://github.com/beetbox/beets.git
synced 2026-01-30 20:13:37 +01:00
Colorize benign track index changes (to/from per disc numbering) in yellow.
This commit is contained in:
parent
a2942895cc
commit
7672fafc7e
1 changed files with 9 additions and 5 deletions
|
|
@ -161,7 +161,7 @@ def show_change(cur_artist, cur_album, match):
|
|||
|
||||
def format_index(track_info):
|
||||
"""Return a string representing the track index of the given
|
||||
TrackInfo object.
|
||||
TrackInfo or Item object.
|
||||
"""
|
||||
if isinstance(track_info, autotag.hooks.TrackInfo):
|
||||
index = track_info.index
|
||||
|
|
@ -234,14 +234,18 @@ def show_change(cur_artist, cur_album, match):
|
|||
# Track number change.
|
||||
cur_track, new_track = format_index(item), format_index(track_info)
|
||||
if cur_track != new_track:
|
||||
if item.track in (track_info.index, track_info.medium_index):
|
||||
color = 'yellow'
|
||||
else:
|
||||
color = 'red'
|
||||
if (cur_track + new_track).count('-') == 1:
|
||||
lhs_track, rhs_track = ui.colorize('red', cur_track), \
|
||||
ui.colorize('red', new_track)
|
||||
lhs_track, rhs_track = ui.colorize(color, cur_track), \
|
||||
ui.colorize(color, new_track)
|
||||
else:
|
||||
lhs_track, rhs_track = ui.color_diff_suffix(cur_track,
|
||||
new_track)
|
||||
templ = ui.colorize('red', u' (#') + u'{0}' + \
|
||||
ui.colorize('red', u')')
|
||||
templ = ui.colorize(color, u' (#') + u'{0}' + \
|
||||
ui.colorize(color, u')')
|
||||
lhs += templ.format(lhs_track)
|
||||
rhs += templ.format(rhs_track)
|
||||
lhs_width += len(cur_track) + 4
|
||||
|
|
|
|||
Loading…
Reference in a new issue