« get me outta code hell

Remove mpv player - 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>2018-12-22 23:23:06 -0400
committerFlorrie <towerofnix@gmail.com>2018-12-22 23:23:06 -0400
commit9162068126fffe4fa0d13d174cc3c14373fa2588 (patch)
tree50c542073a7453a79067ada29e5e894f0bf7c3a6
parentdad157a7e36668b78d865d93c66e5a9fd324773d (diff)
Remove mpv player
-rw-r--r--players.js89
1 files changed, 0 insertions, 89 deletions
diff --git a/players.js b/players.js
index dccdea2..9941ce5 100644
--- a/players.js
+++ b/players.js
@@ -1,9 +1,4 @@
-// stolen from http-music
-
-// const { spawn } = require('child_process')
-// const FIFO = require('fifo-js')
 const EventEmitter = require('events')
-const { commandExists, killProcess } = require('./general-util')
 
 function getTimeStrings({curHour, curMin, curSec, lenHour, lenMin, lenSec}) {
   // Multiplication casts to numbers; addition prioritizes strings.
@@ -141,90 +136,6 @@ module.exports.WebPlayer = class extends Player {
   }
 }
 
-module.exports.MPVPlayer = class extends Player {
-  getMPVOptions(file) {
-    return ['--no-video', file]
-  }
-
-  playFile(file) {
-    // 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.process = spawn('mpv', this.getMPVOptions(file))
-
-    this.process.stderr.on('data', data => {
-      if (this.disablePlaybackStatus) {
-        return
-      }
-
-      const match = data.toString().match(
-        /(..):(..):(..) \/ (..):(..):(..) \(([0-9]+)%\)/
-      )
-
-      if (match) {
-        const [
-          curHour, curMin, curSec, // ##:##:##
-          lenHour, lenMin, lenSec, // ##:##:##
-          percent // ###%
-        ] = match.slice(1)
-
-        this.printStatusLine(getTimeStrings({curHour, curMin, curSec, lenHour, lenMin, lenSec}))
-      }
-    })
-
-    return new Promise(resolve => {
-      this.process.once('close', resolve)
-    })
-  }
-}
-
-module.exports.ControllableMPVPlayer = class extends module.exports.MPVPlayer {
-  getMPVOptions(file) {
-    return ['--input-file=' + this.fifo.path, ...super.getMPVOptions(file)]
-  }
-
-  playFile(file) {
-    this.fifo = new FIFO()
-
-    return super.playFile(file)
-  }
-
-  sendCommand(command) {
-    if (this.fifo) {
-      this.fifo.write(command)
-    }
-  }
-
-  seekAhead(secs) {
-    this.sendCommand(`seek +${parseFloat(secs)}`)
-  }
-
-  seekBack(secs) {
-    this.sendCommand(`seek -${parseFloat(secs)}`)
-  }
-
-  volUp(amount) {
-    this.sendCommand(`add volume +${parseFloat(amount)}`)
-  }
-
-  volDown(amount) {
-    this.sendCommand(`add volume -${parseFloat(amount)}`)
-  }
-
-  togglePause() {
-    this.sendCommand('cycle pause')
-  }
-
-  kill() {
-    if (this.fifo) {
-      this.fifo.close()
-      delete this.fifo
-    }
-
-    return super.kill()
-  }
-}
-
 module.exports.getPlayer = async function() {
   return new module.exports.WebPlayer()
 }