midi: detect missing binary (eg when deleted by antivirus) and print a message
This commit is contained in:
parent
c5c3c992f2
commit
ee675a7dbd
3 changed files with 26 additions and 3 deletions
|
|
@ -25,11 +25,11 @@ before_deploy:
|
|||
- npm run package -- --all
|
||||
- npm run package-node
|
||||
- cd $TRAVIS_BUILD_DIR/dist/open-stage-control-linux-x64/resources/app/server/
|
||||
- wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-linux && chmod +x osc-midi-linux
|
||||
- wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-linux && chmod +x osc-midi-linux && echo "true" > osc-midi.json
|
||||
- cd $TRAVIS_BUILD_DIR/dist/open-stage-control-win32-x64/resources/app/server/
|
||||
- wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-windows.exe && chmod +x osc-midi-windows.exe
|
||||
- wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-windows.exe && chmod +x osc-midi-windows.exe && echo "true" > osc-midi.json
|
||||
- cd $TRAVIS_BUILD_DIR/dist/open-stage-control-darwin-x64/open-stage-control.app/Contents/Resources/app/server
|
||||
- wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-osx && chmod +x osc-midi-osx
|
||||
- wget https://github.com/jean-emmanuel/open-stage-control-midi/releases/latest/download/osc-midi-osx && chmod +x osc-midi-osx && echo "true" > osc-midi.json
|
||||
- cd $TRAVIS_BUILD_DIR
|
||||
- npm run deb64
|
||||
- cd dist
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@
|
|||
- bug fixes
|
||||
- matrix: regression from 1.9.8 (broken nested @{} syntax in props property)
|
||||
|
||||
- misc
|
||||
- midi: detect missing binary (eg when deleted by antivirus) and print a message
|
||||
|
||||
## 1.9.9
|
||||
|
||||
- bug fixes
|
||||
|
|
|
|||
|
|
@ -18,11 +18,19 @@ var midiBinaries = {
|
|||
win32: 'osc-midi-windows.exe'
|
||||
}
|
||||
|
||||
var expectMidiBinaries = false,
|
||||
expectMidiBinariesError = false;
|
||||
try {
|
||||
expectMidiBinaries = eval('require("./osc-midi.json")');
|
||||
} catch(e) {}
|
||||
|
||||
var pythonPathOverride
|
||||
if (process.arch === 'x64' && midiBinaries[process.platform]) {
|
||||
var p = path.resolve(__dirname, midiBinaries[process.platform])
|
||||
if (fs.existsSync(p)) {
|
||||
pythonPathOverride = p
|
||||
} else if (expectMidiBinaries) {
|
||||
expectMidiBinariesError = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -30,6 +38,8 @@ class MidiConverter {
|
|||
|
||||
constructor() {
|
||||
|
||||
if (expectMidiBinariesError) MidiConverter.midiBinariesError()
|
||||
|
||||
this.py = new PythonShell('python/midi.py', Object.assign({
|
||||
args: [
|
||||
'--params',
|
||||
|
|
@ -112,6 +122,8 @@ class MidiConverter {
|
|||
|
||||
static list() {
|
||||
|
||||
if (expectMidiBinariesError) MidiConverter.midiBinariesError()
|
||||
|
||||
PythonShell.run('python/midi.py', Object.assign({pythonPath: MidiConverter.getPythonPath(), args: ['--params', 'list-only']}, pythonOptions), function(e, results) {
|
||||
if (e) {
|
||||
if (e.code === 'ENOENT') {
|
||||
|
|
@ -138,6 +150,14 @@ class MidiConverter {
|
|||
|
||||
}
|
||||
|
||||
static midiBinariesError() {
|
||||
|
||||
console.error(`(ERROR, MIDI) Could not find midi binary file ${p}\nIt may have been deleted by your antivirus.`)
|
||||
console.log(`(INFO, MIDI) Falling back to python implementation (see https://openstagecontrol.ammd.net/docs/midi/midi-configuration/).`)
|
||||
expectMidiBinariesError = false
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = MidiConverter
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue