diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-30 20:14:17 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-10-01 14:15:46 +0200 |
| commit | d378caee59df005e94ba6f891976ceb64c2a48d2 (patch) | |
| tree | a3c292056645e40d1385ae2a1939025554234206 /client/conversation.py | |
| parent | 2bcceb3fe037355dbdfdc46ffbd036c7f719a7bf (diff) | |
| download | jasper-client-d378caee59df005e94ba6f891976ceb64c2a48d2.tar.gz jasper-client-d378caee59df005e94ba6f891976ceb64c2a48d2.zip | |
Remove music mode
Diffstat (limited to 'client/conversation.py')
| -rw-r--r-- | client/conversation.py | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/client/conversation.py b/client/conversation.py index 0746b7f..9b86295 100644 --- a/client/conversation.py +++ b/client/conversation.py @@ -1,10 +1,7 @@ # -*- coding: utf-8-*- import logging from notifier import Notifier -from musicmode import * from brain import Brain -from mpd import MPDClient - class Conversation(object): @@ -16,34 +13,6 @@ class Conversation(object): self.brain = Brain(mic, profile) self.notifier = Notifier(profile) - def delegateInput(self, texts): - """A wrapper for querying brain.""" - - # check if input is meant to start the music module - for text in texts: - if any(x in text.upper() for x in ["SPOTIFY", "MUSIC"]): - self._logger.debug("Preparing to start music module") - # check if mpd client is running - try: - client = MPDClient() - client.timeout = None - client.idletimeout = None - client.connect("localhost", 6600) - except: - self._logger.critical("Can't connect to mpd client, cannot start music mode.", exc_info=True) - 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.") - self._logger.debug("Starting music mode") - music_mode = MusicMode(self.persona, self.mic) - music_mode.handleForever() - self._logger.debug("Exiting music mode") - return - - self.brain.query(texts) - def handleForever(self): """Delegates user input to the handling function when activated.""" self._logger.info("Starting to handle conversation with keyword '%s'.", self.persona) @@ -67,6 +36,6 @@ class Conversation(object): self._logger.debug("Stopped to listen actively with threshold: %r", threshold) if input: - self.delegateInput(input) + self.brain.query(input) else: self.mic.say("Pardon?") |
