diff options
Diffstat (limited to 'src/http-music.js')
-rwxr-xr-x | src/http-music.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/http-music.js b/src/http-music.js index 1392c34..ed79878 100755 --- a/src/http-music.js +++ b/src/http-music.js @@ -246,6 +246,7 @@ setupDefaultPlaylist('./playlist.json') process.stdin.on('data', data => { if (Buffer.from('s').equals(data)) { + // clearConsoleLine() // console.log( // "Skipping the track that's currently playing. " + // "(Press I for track info!)" @@ -255,6 +256,7 @@ setupDefaultPlaylist('./playlist.json') } if (Buffer.from([0x7f]).equals(data)) { // Delete + clearConsoleLine() console.log( "Skipping the track that's up next. " + "(Press I for track info!)" @@ -264,6 +266,14 @@ setupDefaultPlaylist('./playlist.json') } if ( + Buffer.from('i').equals(data) || + Buffer.from('t').equals(data) + ) { + clearConsoleLine() + play.logTrackInfo() + } + + if ( Buffer.from('q').equals(data) || Buffer.from([0x03]).equals(data) || // ^C Buffer.from([0x04]).equals(data) // ^D @@ -272,13 +282,6 @@ setupDefaultPlaylist('./playlist.json') process.stdout.write('\n') process.exit(0) } - - if ( - Buffer.from('i').equals(data) || - Buffer.from('t').equals(data) - ) { - play.logTrackInfo() - } }) return play.promise @@ -287,3 +290,7 @@ setupDefaultPlaylist('./playlist.json') } }) .catch(err => console.error(err)) + +function clearConsoleLine() { + process.stdout.write('\x1b[1K\r') +} |