diff options
author | Florrie <towerofnix@gmail.com> | 2018-04-08 22:09:09 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2018-04-08 22:09:09 -0300 |
commit | 9fa51e49dd113072d32b5467422a443bf744407a (patch) | |
tree | 8195f268adbbcda55c4a0685726ce8552ed55c85 /src | |
parent | 8812c7a1ea343ce85f4c1cc8e379f6ab2c8bdaca (diff) |
--status-line + man for custom status lines
Diffstat (limited to 'src')
-rw-r--r-- | src/loop-play.js | 5 | ||||
-rwxr-xr-x | src/play.js | 20 |
2 files changed, 22 insertions, 3 deletions
diff --git a/src/loop-play.js b/src/loop-play.js index 62e67fd..2fa7da7 100644 --- a/src/loop-play.js +++ b/src/loop-play.js @@ -719,7 +719,8 @@ module.exports = async function startLoopPlay( useConverterOptions = true, disablePlaybackStatus = false, startTrack = null, - trackDisplayFile = null + trackDisplayFile = null, + statusLineTemplate = undefined } ) { // Looping play function. Takes a playlist and an object containing general @@ -764,7 +765,7 @@ module.exports = async function startLoopPlay( const playController = new PlayController({ player, playlist, historyController, downloadController, - trackDisplayFile + trackDisplayFile, statusLineTemplate }) Object.assign(playController, {useConverterOptions}) diff --git a/src/play.js b/src/play.js index dd49afe..e9b5231 100755 --- a/src/play.js +++ b/src/play.js @@ -77,9 +77,12 @@ async function main(args) { // keybinding files. let mayTrustShellCommands = true - // The file to output the playlist path to the current file. + // The file to write the playlist path of the current file to. let trackDisplayFile + // The (custom) status line template string. + let statusLineTemplate + const keybindings = [ [['space'], 'togglePause'], [['left'], 'seek', -5], @@ -381,6 +384,20 @@ async function main(args) { '-hide-playback-status': util => util.alias('-disable-playback-status'), + '-status-line': function(util) { + // --status-line <string> (alias: --playback-status-line, --status, etc) + // Sets the text to be shown in status line. This is a "template" string, + // which means you can use text such as %timeLeft% and %duration% and + // these will be replaced with appropriate values.) + + statusLineTemplate = util.nextArg() + console.log('Using custom status line:', statusLineTemplate) + }, + + '-playback-status': util => util.alias('-status-line'), + '-playback-status-line': util => util.alias('-status-line'), + '-status': util => util.alias('-status-line'), + '-track-display-file': async function(util) { // --track-display-file (alias: --display-track-file) // Sets the file to output the current track's path to every time a new @@ -482,6 +499,7 @@ async function main(args) { willUseConverterOptions === null && shouldUseConverterOptions ), disablePlaybackStatus, + statusLineTemplate, startTrack, trackDisplayFile }) |