From: Cedric Godin Date: Mon, 26 Feb 2018 18:44:24 +0000 (-0500) Subject: Restored transcription service X-Git-Url: http://kyz.pub/gitweb/?a=commitdiff_plain;h=b036a914373014c010863121aa7cd34fa880387a;p=yn%2Fyn-odasweb.git Restored transcription service --- diff --git a/audio-recorder.js b/audio-recorder.js index 9d46c0d..e036825 100644 --- a/audio-recorder.js +++ b/audio-recorder.js @@ -1,4 +1,4 @@ -//const streamToText = require('./stream-to-text.js'); +const streamToText = require('./stream-to-text.js'); const path = require('path'); const wav = require('wav') const EventEmitter = require('events'); @@ -29,7 +29,7 @@ exports.AudioRecorder = class AudioRecorder extends EventEmitter { this.buffer = undefined; this.writer = undefined; this.path = undefined; -/* + this.transcripter = new streamToText.Transcripter(); this.transcripter.on('data', data => { @@ -39,7 +39,7 @@ exports.AudioRecorder = class AudioRecorder extends EventEmitter { this.transcripter.on('error', err => { console.error(err); - });*/ + }); } receive(data) { @@ -88,7 +88,7 @@ exports.AudioRecorder = class AudioRecorder extends EventEmitter { } - //this.transcripter.putData(data); + this.transcripter.putData(data); } } @@ -124,7 +124,7 @@ exports.AudioRecorder = class AudioRecorder extends EventEmitter { this.active = true; this.hold = false; this.buffer = undefined; - //this.transcripter.start(); + this.transcripter.start(); } catch(err) { @@ -141,7 +141,7 @@ exports.AudioRecorder = class AudioRecorder extends EventEmitter { this.active = false; console.log(`Recorder ${this.index} ended`); - //this.transcripter.stop(); + this.transcripter.stop(); console.log(`Registering header on recorder ${this.index}`); this.writer.end(); diff --git a/package.json b/package.json index 13e454e..4bad9ea 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "A desktop GUI for the ODAS library", "main": "main.js", "scripts": { - "start": "electron ." + "start": "electron .", + "postinstall": "./node_modules/.bin/electron-rebuild" }, "author": "Cedric Godin", "license": "MIT", diff --git a/record.js b/record.js index 95fcb92..26d10c5 100644 --- a/record.js +++ b/record.js @@ -1,5 +1,6 @@ const electron = require('electron'); const fork = require('child_process').fork; +const spawn = require('child_process').spawn; const path = require('path') const url = require('url') @@ -10,7 +11,7 @@ const ipcMain = electron.ipcMain; * Start the recording process */ -const recordingProcess = fork('./recordings.js'); +const recordingProcess = spawn(process.execPath, ['./recordings.js'], {stdio: [0, 1, 2, 'ipc']}); exports.quit = function quit() { recordingProcess.kill(); } diff --git a/resources/js/recordings_model.js b/resources/js/recordings_model.js index 043a8cd..bec840a 100644 --- a/resources/js/recordings_model.js +++ b/resources/js/recordings_model.js @@ -4,7 +4,7 @@ const os = require('os'); const fs = require('fs'); const info = require('wav-file-info'); const dialog = require('electron').remote.dialog; -//const speechToText = require('./../resources/js/speech-to-text.js'); +const speechToText = require('./../resources/js/speech-to-text.js'); // Fuzzy recording class class FuzzyRecording { @@ -43,11 +43,11 @@ class Recording { if(err) console.log(err); }) } -/* + else { this.createTranscript(); } -*/ + } readInfo(retry) { @@ -80,7 +80,7 @@ class Recording { } }) } -/* + createTranscript() { const txtPath = this.path.slice(0, -4)+'.txt'; @@ -107,7 +107,7 @@ class Recording { } }); } -*/ + play() { this.isPlaying = true