diff options
author | Florrie <towerofnix@gmail.com> | 2017-10-30 20:49:12 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2017-10-30 20:49:12 -0300 |
commit | ff46c17bc25ca7b4345641c373ae9b6db91f4fff (patch) | |
tree | 73d252d00b56e333ac9dbe28f32abb6614be8c7a | |
parent | 75b1796205364237c090ddec1d5bc8d8d2ca3bb2 (diff) |
Never show two identical track indexes
-rw-r--r-- | src/loop-play.js | 36 |
1 files 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]' + } } } |