diff --git a/hugvey/central_command.py b/hugvey/central_command.py index 2f27175..5859630 100644 --- a/hugvey/central_command.py +++ b/hugvey/central_command.py @@ -536,7 +536,8 @@ class HugveyState(object): # detect missing heartbeat: if self.isConfigured and time.time() - self.isConfigured > 15: self.logger.error("Hugvey did not send heartbeat.") - self.gone() +# self.gone() + self.shutdown() continue self.logger.debug("Received: {}".format(event)) @@ -762,4 +763,4 @@ class HugveyState(object): self.logger.critical(f"stream has left the building from {self.ip}") self.eventLogger.critical(f"error: stream has left the building from {self.ip}") # if we end up here, the streamer finished, probably meaning hte hugvey shutdown - self.gone() +# self.gone() diff --git a/hugvey/speech/google.py b/hugvey/speech/google.py index f5a006e..007537d 100644 --- a/hugvey/speech/google.py +++ b/hugvey/speech/google.py @@ -18,6 +18,7 @@ import queue import uuid from hugvey.communication import LOG_BS import audioop +import gc mainLogger = logging.getLogger("hugvey") logger = mainLogger.getChild("google") @@ -181,6 +182,10 @@ class GoogleVoiceClient(object): self.hugvey.queueEvent(msg) self.logger.warn("Stop google run()") # finish means wrapping of hugvey#3v thread +# time.sleep(1) +# for i in gc.get_referrers(self): +# print(i) + def receive(self, chunk): if not self.task.isAlive(): diff --git a/hugvey/story.py b/hugvey/story.py index 0c269ab..5cf53d4 100644 --- a/hugvey/story.py +++ b/hugvey/story.py @@ -1418,10 +1418,15 @@ class Story(object): fn = await message.getAudioFilePath() # get duration of audio file, so the client can detect a hang of 'play' - with wave.open(fn,'r') as fp: - frames = fp.getnframes() - rate = fp.getframerate() - duration = frames/float(rate) + try: + with wave.open(fn,'r') as fp: + frames = fp.getnframes() + rate = fp.getframerate() + duration = frames/float(rate) + except Exception as e: + self.hugvey.eventLogger.critical(f"error: crash when reading wave file: {fn}") + self.logger.critical(f"error: crash when reading wave file: {fn}") + duration = 10 # some default duration to have something to fall back to # self.hugvey.google.pause() # pause STT to avoid text events while decision is made self.hugvey.sendCommand({