def step(self): id, text = self.reader.read_no_block() print(id, text) if id: self._failed = 0 if text != self._current: stripped_text = text.strip() print("Read text: \"{}\"".format(stripped_text)) play.play(stripped_text) self._current = text elif self._current: self._failed += 1 if self._failed > 2: self._current = None print("Stopping") play.stop() time.sleep(1)
def stop_audio_engine(self): if not self._started: return stop() self._started = False
def stop(self): play.stop()