« get me outta code hell

Always reumse when playing a new track - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2019-05-29 11:49:29 -0300
committerFlorrie <towerofnix@gmail.com>2019-05-29 11:49:49 -0300
commit420d17be1f42de06448026df78688a959e5fe8b3 (patch)
tree128cd6f61b0bb19d041f2c3f890bd8c47806c4d9
parent565c984e563be3bc37c9ab5674ee088f2ea718c0 (diff)
Always reumse when playing a new track
This behavior got changed recently, where the player being paused would
carry through across tracks. It no longer does that.
-rw-r--r--players.js5
-rw-r--r--ui.js2
2 files changed, 3 insertions, 4 deletions
diff --git a/players.js b/players.js
index a1a3a13..2f7a574 100644
--- a/players.js
+++ b/players.js
@@ -11,6 +11,7 @@ class Player extends EventEmitter {
 
     this.disablePlaybackStatus = false
     this.isLooping = false
+    this.isPaused = false
     this.volume = 100
   }
 
@@ -62,9 +63,6 @@ module.exports.MPVPlayer = class extends Player {
     if (this.isLooping) {
       opts.unshift('--loop')
     }
-    if (this.isPaused) {
-      opts.unshift('--pause')
-    }
     opts.unshift('--volume', this.volume)
     return opts
   }
@@ -73,6 +71,7 @@ module.exports.MPVPlayer = class extends Player {
     // The more powerful MPV player. MPV is virtually impossible for a human
     // being to install; if you're having trouble with it, try the SoX player.
 
+    this.isPaused = false
     this.process = spawn('mpv', this.getMPVOptions(file))
 
     let lastPercent = 0
diff --git a/ui.js b/ui.js
index e1eb528..976ef83 100644
--- a/ui.js
+++ b/ui.js
@@ -232,7 +232,7 @@ class AppElement extends FocusElement {
         return [
           {label: this.playingTrack ? `("${this.playingTrack.name}")` : '(No track playing.)'},
           {divider: true},
-          {element: this.playingControl},
+          this.playingTrack && {element: this.playingControl},
           {element: this.loopingControl},
           (next || previous) && {divider: true},
           previous && {label: `Previous (${previous.name})`, action: () => this.playPreviousTrack(this.playingTrack)},