Merge branch 'external-player' of https://github.com/mathiasvr/webtorrent-desktop into mathiasvr-external-player

Fixed conflicts in the Preferences page, and added back passing the video title to VLC
This commit is contained in:
Feross Aboukhadijeh
2016-08-19 22:06:23 -07:00
9 changed files with 126 additions and 88 deletions

View File

@@ -1,6 +1,7 @@
const React = require('react')
const remote = require('electron').remote
const dialog = remote.dialog
const path = require('path')
const {dispatch} = require('../lib/dispatcher')
@@ -24,7 +25,8 @@ function renderGeneralSection (state) {
icon: 'settings'
}, [
renderDownloadPathSelector(state),
renderFileHandlers(state)
renderFileHandlers(state),
renderExternalPlayerSelector(state)
])
}
@@ -92,6 +94,27 @@ function renderFileHandlers (state) {
}
}
function renderExternalPlayerSelector (state) {
return renderFileSelector({
label: 'External Media Player',
description: 'Progam that will be used to play media externally',
property: 'externalPlayerPath',
options: {
title: 'Select media player executable',
properties: [ 'openFile' ]
}
},
state.unsaved.prefs.externalPlayerPath || '<VLC>', // TODO: should we get/store vlc path instead?
function (filePath) {
if (path.extname(filePath) === '.app') {
// Get executable in packaged mac app
var name = path.basename(filePath, '.app')
filePath += '/Contents/MacOS/' + name
}
dispatch('updatePreferences', 'externalPlayerPath', filePath)
})
}
// Renders a prefs section.
// - definition should be {icon, title, description}
// - controls should be an array of vdom elements