Merge branch 'master' of gitlab.com:hugvey/hugvey
This commit is contained in:
commit
0bd9e80429
5 changed files with 74 additions and 54 deletions
|
@ -774,7 +774,9 @@ class HugveyState(object):
|
|||
if self.command.config['voice']['record_dir']:
|
||||
self.logger.warn("Record Audio of conversation")
|
||||
self.recorder = Recorder( self.id,
|
||||
self.command.config['voice']['src_rate'], self.command.config['voice']['record_dir'])
|
||||
self.command.config['voice']['src_rate'], self.command.config['voice']['record_dir'],
|
||||
self.command.config['voice']['record_voice'] if 'record_voice' in self.command.config['voice'] else False)
|
||||
|
||||
self.streamer.addConsumer(self.recorder)
|
||||
|
||||
self.logger.debug("Start Speech")
|
||||
|
|
|
@ -16,7 +16,7 @@ class Recorder:
|
|||
Record the streamed audio
|
||||
"""
|
||||
|
||||
def __init__(self, hv_id, src_rate, out_folder):
|
||||
def __init__(self, hv_id, src_rate, out_folder, record_voice = True):
|
||||
self.logger = mainLogger.getChild(f"{hv_id}").getChild('recorder')
|
||||
|
||||
if not os.path.exists(out_folder):
|
||||
|
@ -26,6 +26,7 @@ class Recorder:
|
|||
self.src_rate = src_rate
|
||||
self.main_folder = out_folder # unfortunately not every device plays 16kHz audio streams
|
||||
self.running = False
|
||||
self.record_voice = record_voice
|
||||
self.data = array('h')
|
||||
self.currentLog = []
|
||||
|
||||
|
@ -53,6 +54,8 @@ class Recorder:
|
|||
self.logger.info("Skip empty wave creation")
|
||||
return
|
||||
|
||||
|
||||
if self.record_voice:
|
||||
self.fragmentNr += 1
|
||||
|
||||
fn = os.path.join(self.out_folder, f"{self.fragmentNr}.wav")
|
||||
|
@ -69,12 +72,16 @@ class Recorder:
|
|||
|
||||
with open(os.path.join(self.out_folder, "transcriptions.txt"), "a") as fp:
|
||||
fp.write(f"{self.fragmentNr}\t{self.currentTranscription}\n")
|
||||
|
||||
self.log('-',self.currentTranscription)
|
||||
|
||||
self.data = array('h')
|
||||
self.currentTranscription = ""
|
||||
|
||||
def receive(self, chunk):
|
||||
if not self.record_voice:
|
||||
return
|
||||
|
||||
if not self.running:
|
||||
return
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ voice:
|
|||
port: 4444
|
||||
chunk: 2972
|
||||
google_credentials: "../test_googlespeech/My First Project-0c7833e0d5fa.json"
|
||||
record_dir: "./recordings"
|
||||
record_voice: false
|
||||
hugveys: 26
|
||||
languages:
|
||||
- code: en-GB
|
||||
|
|
12
www/js/crel.min.js
vendored
12
www/js/crel.min.js
vendored
|
@ -5,19 +5,27 @@ crel.attrMap['on'] = function(element, value) {
|
|||
element.addEventListener(eventName, value[eventName]);
|
||||
}
|
||||
};
|
||||
crel.attrMap['options'] = function(element, values) {
|
||||
crel.attrMap['options'] = function(element, values, a, b) {
|
||||
if(element.tagName != "SELECT") {
|
||||
return;
|
||||
}
|
||||
console.log(values, element.value);
|
||||
|
||||
if(Array.isArray(values)) {
|
||||
for (let option of values) {
|
||||
if(element.value == option) {
|
||||
element.appendChild(crel('option', {'selected': 'selected'}, option));
|
||||
} else {
|
||||
element.appendChild(crel('option', option));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let option in values) {
|
||||
if(element.value == option) {
|
||||
element.appendChild(crel('option', {'selected': 'selected','value': option}, values[option]));
|
||||
}else{
|
||||
element.appendChild(crel('option', {'value': option}, values[option]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
|
@ -28,6 +28,7 @@ class Timeline{
|
|||
this.dataGroups = new vis.DataSet(groups);
|
||||
let options = {
|
||||
maxHeight: '100%',
|
||||
height: '100%',
|
||||
margin : {
|
||||
item: {
|
||||
horizontal: 0,
|
||||
|
|
Loading…
Reference in a new issue