summaryrefslogtreecommitdiff
path: root/client/conversation.py
diff options
context:
space:
mode:
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: