diff options
author | Florrie <towerofnix@gmail.com> | 2020-02-15 22:13:53 -0400 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2020-02-15 22:15:15 -0400 |
commit | 48ed5168d477fe11fe4f21ae104e3750935b0943 (patch) | |
tree | c0d9260246933d180a2fa5405da8e66e9c484705 /backend.js | |
parent | fd09d0196f8db2102f9364a56f3075bf2cd93c88 (diff) |
cli args (bass boost ur music)
$ mtui --player sox --player-options bass +25 \;
Diffstat (limited to 'backend.js')
-rw-r--r-- | backend.js | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/backend.js b/backend.js index 379a16b..0cceeea 100644 --- a/backend.js +++ b/backend.js @@ -57,6 +57,7 @@ async function download(item, record) { class QueuePlayer extends EventEmitter { constructor({ + getPlayer, getRecordFor }) { super() @@ -68,11 +69,12 @@ class QueuePlayer extends EventEmitter { this.playedTrackToEnd = false this.timeData = null + this.getPlayer = getPlayer this.getRecordFor = getRecordFor } async setup() { - this.player = await getPlayer() + this.player = await this.getPlayer() if (!this.player) { return { @@ -560,9 +562,19 @@ class QueuePlayer extends EventEmitter { } class Backend extends EventEmitter { - constructor() { + constructor({ + playerName = null, + playerOptions = [] + } = {}) { super() + this.playerName = playerName; + this.playerOptions = playerOptions; + + if (playerOptions && !playerName) { + throw new Error(`Must specify playerName to specify playerOptions`); + } + this.queuePlayers = [] this.recordStore = new RecordStore() @@ -586,6 +598,7 @@ class Backend extends EventEmitter { async addQueuePlayer() { const queuePlayer = new QueuePlayer({ + getPlayer: () => getPlayer(this.playerName, this.playerOptions), getRecordFor: item => this.getRecordFor(item) }) |