« get me outta code hell

new GhostPlayer class & support 👻 - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/ui.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-05-14 19:53:31 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-16 22:29:28 -0300
commit9a1d0c26338a7d0851c60b99296669cdc80673f2 (patch)
tree55f8a3c07c0591fde8397a863c170b976791a760 /ui.js
parent8baa393ea05ac894ab78f6ff163d876cee4934d5 (diff)
new GhostPlayer class & support 👻
This also makes the UI not explode when duration strings aren't
available for progress bar display, and shows getTimeStringsFromSec
how to handle that.
Diffstat (limited to 'ui.js')
-rw-r--r--ui.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/ui.js b/ui.js
index 371da80..ed046c0 100644
--- a/ui.js
+++ b/ui.js
@@ -4511,9 +4511,14 @@ class PlaybackInfoElement extends FocusElement {
     this.isLooping = player.isLooping
     this.isPaused = player.isPaused
 
-    this.progressBarLabel.text = '-'.repeat(Math.floor(this.w / lenSecTotal * curSecTotal))
+    if (duration) {
+      this.progressBarLabel.text = '-'.repeat(Math.floor(this.w / lenSecTotal * curSecTotal))
+      this.progressTextLabel.text = timeDone + ' / ' + duration
+    } else {
+      this.progressBarLabel.text = ''
+      this.progressTextLabel.text = timeDone
+    }
 
-    this.progressTextLabel.text = timeDone + ' / ' + duration
     if (player.isLooping) {
       this.progressTextLabel.text += ' [Looping]'
     }