From ff46c17bc25ca7b4345641c373ae9b6db91f4fff Mon Sep 17 00:00:00 2001 From: Florrie Date: Mon, 30 Oct 2017 20:49:12 -0300 Subject: Never show two identical track indexes --- src/loop-play.js | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/src/loop-play.js b/src/loop-play.js index 4902fd7..f9eaab0 100644 --- a/src/loop-play.js +++ b/src/loop-play.js @@ -375,21 +375,33 @@ class PlayController extends EventEmitter { if (track.overallTrackIndex || track.groupTrackIndex) { fullStatusLine += '(' - if (track.overallTrackIndex) { - const [ cur, len ] = track.overallTrackIndex - fullStatusLine += `${cur + 1} / ${len}` - - if (track.groupTrackIndex) { - fullStatusLine += ' [All]; ' + addTrackNumberInnards: { + if (track.overallTrackIndex) { + const [ cur, len ] = track.overallTrackIndex + fullStatusLine += `${cur + 1} / ${len}` + + if (track.groupTrackIndex) { + const [ curGroup, lenGroup ] = track.groupTrackIndex + + // If the overall and group track indexes are equal to each + // other, there's a fair chance we're just playing a single + // group; so, we only display one index (and we don't show + // "[All]"/"[Group]" labels). + if (curGroup === cur && lenGroup === len) { + break addTrackNumberInnards + } else { + fullStatusLine += ' [All]; ' + } + } } - } - if (track.groupTrackIndex) { - const [ cur, len ] = track.groupTrackIndex - fullStatusLine += `${cur + 1} / ${len}` + if (track.groupTrackIndex) { + const [ cur, len ] = track.groupTrackIndex + fullStatusLine += `${cur + 1} / ${len}` - if (track.overallTrackIndex) { - fullStatusLine += ' [Group]' + if (track.overallTrackIndex) { + fullStatusLine += ' [Group]' + } } } -- cgit 1.3.0-6-gf8a5