« 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>2023-05-14 19:53:31 -0300
commit7f2461a60fba35013551fdb27ba0bb8d0720021d (patch)
treebcaaf43e2d54ffeff7a400c3a1b32480e118c8eb /ui.js
parent56ad0bab6cbcc079887d5a5086cb116844bc351e (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 4a92ebe..6cabb32 100644
--- a/ui.js
+++ b/ui.js
@@ -4439,9 +4439,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]'
     }