Merge branch 'code-style/external-player' into code-style/merge

This commit is contained in:
Borewit
2018-05-23 20:23:33 +02:00

View File

@@ -25,7 +25,7 @@ function spawn (playerPath, url, title) {
if (playerPath != null) return spawnExternal(playerPath, [url])
// Try to find and use VLC if external player is not specified
vlcCommand(function (err, vlcPath) {
vlcCommand((err, vlcPath) => {
if (err) return windows.main.dispatch('externalPlayerNotFound')
const args = [
'--play-and-exit',
@@ -49,7 +49,7 @@ function spawnExternal (playerPath, args) {
if (process.platform === 'darwin' && path.extname(playerPath) === '.app') {
// Mac: Use executable in packaged .app bundle
playerPath += '/Contents/MacOS/' + path.basename(playerPath, '.app')
playerPath += `/Contents/MacOS/${path.basename(playerPath, '.app')}`
}
proc = cp.spawn(playerPath, args, {stdio: 'ignore'})
@@ -58,7 +58,7 @@ function spawnExternal (playerPath, args) {
const closeModalTimeout = setTimeout(() =>
windows.main.dispatch('exitModal'), 1000)
proc.on('close', function (code) {
proc.on('close', code => {
clearTimeout(closeModalTimeout)
if (!proc) return // Killed
log('External player exited with code ', code)
@@ -70,7 +70,7 @@ function spawnExternal (playerPath, args) {
proc = null
})
proc.on('error', function (e) {
proc.on('error', e => {
log('External player error', e)
})
}