summaryrefslogtreecommitdiff
path: root/client/conversation.py
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2014-08-30 17:44:47 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2014-09-25 07:12:55 +0100
commitdd133d3738162e184f206d112ea4a39ba43f0781 (patch)
treee1ac1e02cd601c1908d93bea974e19433297c958 /client/conversation.py
parentea3026c133755bf3e35ad78fa253786bc9ff7c36 (diff)
downloadjasper-client-dd133d3738162e184f206d112ea4a39ba43f0781.tar.gz
jasper-client-dd133d3738162e184f206d112ea4a39ba43f0781.zip
Handle all Google Speech options
Diffstat (limited to 'client/conversation.py')
-rw-r--r--client/conversation.py37
1 files changed, 19 insertions, 18 deletions
diff --git a/client/conversation.py b/client/conversation.py
index be9b8e9..8ec912c 100644
--- a/client/conversation.py
+++ b/client/conversation.py
@@ -14,28 +14,29 @@ class Conversation(object):
self.brain = Brain(mic, profile)
self.notifier = Notifier(profile)
- def delegateInput(self, text):
+ def delegateInput(self, texts):
"""A wrapper for querying brain."""
# check if input is meant to start the music module
- if any(x in text.upper() for x in ["SPOTIFY", "MUSIC"]):
- # check if mpd client is running
- try:
- client = MPDClient()
- client.timeout = None
- client.idletimeout = None
- client.connect("localhost", 6600)
- except:
- self.mic.say(
- "I'm sorry. It seems that Spotify is not enabled. Please read the documentation to learn how to configure Spotify.")
- return
+ for text in texts:
+ if any(x in text.upper() for x in ["SPOTIFY", "MUSIC"]):
+ # check if mpd client is running
+ try:
+ client = MPDClient()
+ client.timeout = None
+ client.idletimeout = None
+ client.connect("localhost", 6600)
+ except:
+ self.mic.say(
+ "I'm sorry. It seems that Spotify is not enabled. Please read the documentation to learn how to configure Spotify.")
+ return
- self.mic.say("Please give me a moment, I'm loading your Spotify playlists.")
- music_mode = MusicMode(self.persona, self.mic)
- music_mode.handleForever()
- return
+ self.mic.say("Please give me a moment, I'm loading your Spotify playlists.")
+ music_mode = MusicMode(self.persona, self.mic)
+ music_mode.handleForever()
+ return
- self.brain.query(text)
+ self.brain.query(texts)
def handleForever(self):
"""Delegates user input to the handling function when activated."""
@@ -50,7 +51,7 @@ class Conversation(object):
if not transcribed or not threshold:
continue
- input = self.mic.activeListen(threshold)
+ input = self.mic.activeListenToAllOptions(threshold)
if input:
self.delegateInput(input)
else: