From d2460716084e918cad41964683420ca5c07d85ae Mon Sep 17 00:00:00 2001 From: Florrie Date: Mon, 30 Oct 2017 16:28:30 -0300 Subject: Clear old status line when printing a new one --- src/loop-play.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/loop-play.js b/src/loop-play.js index 01e1574..dbc0ba8 100644 --- a/src/loop-play.js +++ b/src/loop-play.js @@ -363,6 +363,10 @@ class PlayController extends EventEmitter { this.player.on('printStatusLine', playerString => { let fullStatusLine = '' + // 1K - clears the screen from the start of the cursor onwards. This is + // here to avoid artefacts from a previously printed status line. + fullStatusLine += '\x1b[1K' + const track = this.currentTrack if (track) { -- cgit 1.3.0-6-gf8a5 From 75b1796205364237c090ddec1d5bc8d8d2ca3bb2 Mon Sep 17 00:00:00 2001 From: Florrie Date: Mon, 30 Oct 2017 16:43:34 -0300 Subject: Add missing percent symbol to mpv status line --- src/loop-play.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/loop-play.js b/src/loop-play.js index dbc0ba8..4902fd7 100644 --- a/src/loop-play.js +++ b/src/loop-play.js @@ -96,7 +96,9 @@ class MPVPlayer extends Player { const curSecTotal = (3600 * curHour) + (60 * curMin) + (1 * curSec) const lenSecTotal = (3600 * lenHour) + (60 * lenMin) + (1 * lenSec) const percentVal = (100 / lenSecTotal) * curSecTotal - const percentStr = (Math.trunc(percentVal * 100) / 100).toFixed(2) + const percentStr = ( + (Math.trunc(percentVal * 100) / 100).toFixed(2) + '%' + ) this.printStatusLine(createStatusLine({percentStr, curStr, lenStr})) } -- cgit 1.3.0-6-gf8a5 From ff46c17bc25ca7b4345641c373ae9b6db91f4fff Mon Sep 17 00:00:00 2001 From: Florrie Date: Mon, 30 Oct 2017 20:49:12 -0300 Subject: Never show two identical track indexes --- src/loop-play.js | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/loop-play.js b/src/loop-play.js index 4902fd7..f9eaab0 100644 --- a/src/loop-play.js +++ b/src/loop-play.js @@ -375,21 +375,33 @@ class PlayController extends EventEmitter { if (track.overallTrackIndex || track.groupTrackIndex) { fullStatusLine += '(' - if (track.overallTrackIndex) { - const [ cur, len ] = track.overallTrackIndex - fullStatusLine += `${cur + 1} / ${len}` - - if (track.groupTrackIndex) { - fullStatusLine += ' [All]; ' + addTrackNumberInnards: { + if (track.overallTrackIndex) { + const [ cur, len ] = track.overallTrackIndex + fullStatusLine += `${cur + 1} / ${len}` + + if (track.groupTrackIndex) { + const [ curGroup, lenGroup ] = track.groupTrackIndex + + // If the overall and group track indexes are equal to each + // other, there's a fair chance we're just playing a single + // group; so, we only display one index (and we don't show + // "[All]"/"[Group]" labels). + if (curGroup === cur && lenGroup === len) { + break addTrackNumberInnards + } else { + fullStatusLine += ' [All]; ' + } + } } - } - if (track.groupTrackIndex) { - const [ cur, len ] = track.groupTrackIndex - fullStatusLine += `${cur + 1} / ${len}` + if (track.groupTrackIndex) { + const [ cur, len ] = track.groupTrackIndex + fullStatusLine += `${cur + 1} / ${len}` - if (track.overallTrackIndex) { - fullStatusLine += ' [Group]' + if (track.overallTrackIndex) { + fullStatusLine += ' [Group]' + } } } -- cgit 1.3.0-6-gf8a5 From ff2d6d8fcef09afb6320f39d71002dbe8beb79b2 Mon Sep 17 00:00:00 2001 From: Florrie Date: Mon, 30 Oct 2017 21:17:09 -0300 Subject: Actually clear status line properly --- src/loop-play.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/loop-play.js b/src/loop-play.js index f9eaab0..09b3cad 100644 --- a/src/loop-play.js +++ b/src/loop-play.js @@ -365,9 +365,9 @@ class PlayController extends EventEmitter { this.player.on('printStatusLine', playerString => { let fullStatusLine = '' - // 1K - clears the screen from the start of the cursor onwards. This is - // here to avoid artefacts from a previously printed status line. - fullStatusLine += '\x1b[1K' + // ESC[K - clears the line going from the cursor position onwards. + // This is here to avoid artefacts from a previously printed status line. + fullStatusLine += '\x1b[K' const track = this.currentTrack -- cgit 1.3.0-6-gf8a5 From 861de86b01737f68a2eb958c768e7aa8eade9f3e Mon Sep 17 00:00:00 2001 From: Florrie Date: Sun, 5 Nov 2017 12:52:21 -0400 Subject: Re-export getItemPath (fixes download-playlist) --- src/playlist-utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/playlist-utils.js b/src/playlist-utils.js index c2f6aae..3983c7a 100644 --- a/src/playlist-utils.js +++ b/src/playlist-utils.js @@ -533,7 +533,7 @@ module.exports = { filterPlaylistByPathString, filterGrouplikeByPath, removeGroupByPathString, removeGroupByPath, getPlaylistTreeString, - getItemPathString, + getItemPath, getItemPathString, parsePathString, isSameTrack, getTrackIndexInParent, -- cgit 1.3.0-6-gf8a5