From b4e575f4ec8b65464f9a8f109ddf3907cf30b853 Mon Sep 17 00:00:00 2001 From: Florrie Date: Thu, 24 Jan 2019 17:09:25 -0400 Subject: (l) to loop currently playing track --- ui.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'ui.js') diff --git a/ui.js b/ui.js index 00aa403..4a8f0a4 100644 --- a/ui.js +++ b/ui.js @@ -364,7 +364,7 @@ class AppElement extends FocusElement { this.player.on('printStatusLine', data => { if (this.playingTrack) { - this.playbackInfoElement.updateProgress(data) + this.playbackInfoElement.updateProgress(data, this.player) } }) @@ -407,6 +407,8 @@ class AppElement extends FocusElement { this.seekBack(10) } else if (telc.isSpace(keyBuf)) { this.togglePause() + } else if (telc.isCaselessLetter(keyBuf, 'l')) { + this.toggleLoop() } else if (telc.isEscape(keyBuf)) { this.clearPlayingTrack() } else if (telc.isShiftUp(keyBuf) || telc.isCaselessLetter(keyBuf, 'p')) { @@ -497,6 +499,10 @@ class AppElement extends FocusElement { this.player.togglePause() } + toggleLoop() { + this.player.toggleLoop() + } + stopPlaying() { // We emit this so playTrack doesn't immediately start a new track. // We aren't *actually* about to play a new track. @@ -1652,9 +1658,12 @@ class PlaybackInfoElement extends DisplayElement { } } - updateProgress({timeDone, timeLeft, duration, lenSecTotal, curSecTotal}) { + updateProgress({timeDone, timeLeft, duration, lenSecTotal, curSecTotal}, player) { this.progressBarLabel.text = '-'.repeat(Math.floor(this.w / lenSecTotal * curSecTotal)) this.progressTextLabel.text = timeDone + ' / ' + duration + if (player.isLooping) { + this.progressTextLabel.text += ' [Looping]' + } this.fixLayout() } -- cgit 1.3.0-6-gf8a5