Recorder can log without recording voice

This commit is contained in:
Hugvey Central Command 2019-06-16 16:16:15 +02:00
parent 16fbee7555
commit c3cae1ea25

View file

@ -50,12 +50,10 @@ class Recorder:
def writeData(self): def writeData(self):
if self.record_voice:
if len(self.data) < 1: if len(self.data) < 1:
self.logger.info("Skip empty wave creation") self.logger.info("Skip empty wave creation")
return else:
if self.record_voice:
self.fragmentNr += 1 self.fragmentNr += 1
fn = os.path.join(self.out_folder, f"{self.fragmentNr}.wav") fn = os.path.join(self.out_folder, f"{self.fragmentNr}.wav")
@ -79,9 +77,6 @@ class Recorder:
self.currentTranscription = "" self.currentTranscription = ""
def receive(self, chunk): def receive(self, chunk):
if not self.record_voice:
return
if not self.running: if not self.running:
return return
@ -100,6 +95,12 @@ class Recorder:
else: else:
self.subsequentMutedFrames = 0 self.subsequentMutedFrames = 0
if not self.record_voice:
# we only check this here, as the writeData above is used to write
# transcriptions to the log.
return
d = array('h', chunk) d = array('h', chunk)
self.data.extend(d) self.data.extend(d)
# self.wf.writeframes(chunk) # self.wf.writeframes(chunk)