Clean some of the prints

This commit is contained in:
Ruben van de Ven 2019-04-12 12:47:26 +02:00
parent 554f6a2cc3
commit 596abab9d2
2 changed files with 6 additions and 7 deletions

View file

@ -58,7 +58,7 @@ class GoogleVoiceClient(object):
self.isRunning.set() self.isRunning.set()
def generator(self): def generator(self):
print('start generator') self.logger.debug('start generator')
while not self.toBeShutdown and self.isRunning.is_set(): while not self.toBeShutdown and self.isRunning.is_set():
try: try:
# set a timeout, as not to wait infinitely for the buffer when # set a timeout, as not to wait infinitely for the buffer when
@ -66,8 +66,8 @@ class GoogleVoiceClient(object):
yield self.buffer.get(timeout=.3) yield self.buffer.get(timeout=.3)
except queue.Empty as e: except queue.Empty as e:
self.logger.debug('empty mic buffer - restart?') self.logger.debug('empty mic buffer - restart?')
print(self.isRunning.isSet()) # print(self.isRunning.isSet())
print('stop generator') self.logger.info('stop generator')
self.restart = False # don't trigger double restart self.restart = False # don't trigger double restart
# raise RequireRestart("Restart required (generator)") # raise RequireRestart("Restart required (generator)")
@ -145,7 +145,7 @@ class GoogleVoiceClient(object):
self.lastNonFinalTranscript = None self.lastNonFinalTranscript = None
if result.is_final: if result.is_final:
print("native final") self.logger.info("native final")
msg = { msg = {
"event": "speech", "event": "speech",
"is_final": result.is_final, "is_final": result.is_final,

View file

@ -134,7 +134,7 @@ class MSVoiceFetcher(VoiceFetcher):
headers=headers, headers=headers,
allow_nonstandard_methods=True allow_nonstandard_methods=True
) )
print(request.method, request.url, request.headers) logger.debug(f"{request.method} {request.url} {request.headers}")
try: try:
response = await http_client.fetch(request) response = await http_client.fetch(request)
except Exception as e: except Exception as e:
@ -148,7 +148,6 @@ class MSVoiceFetcher(VoiceFetcher):
async def requestVoiceFile(self, text): async def requestVoiceFile(self, text):
print(self.config['voice_url'])
headers = { headers = {
'Authorization': 'Bearer ' + await self.getToken(), 'Authorization': 'Bearer ' + await self.getToken(),
'Content-Type': 'application/ssml+xml', 'Content-Type': 'application/ssml+xml',
@ -159,7 +158,7 @@ class MSVoiceFetcher(VoiceFetcher):
name='{self.config['ms_name']}'> name='{self.config['ms_name']}'>
{text} {text}
</voice></speak>""" </voice></speak>"""
print(headers, body) logger.debug(body)
http_client = AsyncHTTPClient() http_client = AsyncHTTPClient()
request = HTTPRequest( request = HTTPRequest(
method="POST", method="POST",