diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-10-06 16:59:36 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-10-06 16:59:36 +0200 |
| commit | edca8b7407d7c9b1497ba1722d1b66ffa4b4c234 (patch) | |
| tree | d544987379415ac557751401ea0b0c7de81530b7 /client/conversation.py | |
| parent | 890a5798fcf7f9b9dc06529aa4bc7fe903d7ca1a (diff) | |
| parent | 804da384bff556d3caedf9ad01d57f2460aee151 (diff) | |
| download | jasper-client-edca8b7407d7c9b1497ba1722d1b66ffa4b4c234.tar.gz jasper-client-edca8b7407d7c9b1497ba1722d1b66ffa4b4c234.zip | |
Merge pull request #217 from Holzhaus/style-fixes
Style fixes
Diffstat (limited to 'client/conversation.py')
| -rw-r--r-- | client/conversation.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/client/conversation.py b/client/conversation.py index 9b86295..6b2fab1 100644 --- a/client/conversation.py +++ b/client/conversation.py @@ -3,6 +3,7 @@ import logging from notifier import Notifier from brain import Brain + class Conversation(object): def __init__(self, persona, mic, profile): @@ -14,27 +15,34 @@ class Conversation(object): self.notifier = Notifier(profile) def handleForever(self): - """Delegates user input to the handling function when activated.""" - self._logger.info("Starting to handle conversation with keyword '%s'.", self.persona) + """ + Delegates user input to the handling function when activated. + """ + self._logger.info("Starting to handle conversation with keyword '%s'.", + self.persona) while True: # Print notifications until empty notifications = self.notifier.getAllNotifications() for notif in notifications: self._logger.info("Received notification: '%s'", str(notif)) - self._logger.debug("Started listening for keyword '%s'", self.persona) + self._logger.debug("Started listening for keyword '%s'", + self.persona) threshold, transcribed = self.mic.passiveListen(self.persona) - self._logger.debug("Stopped listening for keyword '%s'", self.persona) + self._logger.debug("Stopped listening for keyword '%s'", + self.persona) if not transcribed or not threshold: self._logger.info("Nothing has been said or transcribed.") continue self._logger.info("Keyword '%s' has been said!", self.persona) - self._logger.debug("Started to listen actively with threshold: %r", threshold) + self._logger.debug("Started to listen actively with threshold: %r", + threshold) input = self.mic.activeListenToAllOptions(threshold) - self._logger.debug("Stopped to listen actively with threshold: %r", threshold) - + self._logger.debug("Stopped to listen actively with threshold: %r", + threshold) + if input: self.brain.query(input) else: |
