« get me outta code hell

http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/loop-play.js36
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]'
+              }
             }
           }