« get me outta code hell

show queue length in collapsed progress info - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/backend.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2020-05-03 15:30:36 -0300
committerFlorrie <towerofnix@gmail.com>2020-05-03 15:30:36 -0300
commite7a005f948415afae89a1a2aaa435d1839f4002e (patch)
tree9edb4a9b77c593deea65e09399004081649c4f1b /backend.js
parent9a5dfd47147aaeb844fbfc9ae8137e67f735fff1 (diff)
show queue length in collapsed progress info
Diffstat (limited to 'backend.js')
-rw-r--r--backend.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/backend.js b/backend.js
index ed1bd08..900a822 100644
--- a/backend.js
+++ b/backend.js
@@ -556,6 +556,16 @@ class QueuePlayer extends EventEmitter {
     this.pauseNextTrack = !!value
   }
 
+  get remainingTracks() {
+    const index = this.queueGrouplike.items.indexOf(this.playingTrack)
+    const length = this.queueGrouplike.items.length
+    if (index === -1) {
+      return length
+    } else {
+      return length - index - 1
+    }
+  }
+
   get playSymbol() {
     if (this.player && this.playingTrack) {
       if (this.player.isPaused) {