summaryrefslogtreecommitdiff
path: root/client/modules
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2014-10-01 14:47:29 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2014-10-01 14:47:29 +0200
commitfe42407497f4f3dcc1388f2e9da53dd64ccf6382 (patch)
tree2ef22c989839830a49ccf19ad1e6813b8055d532 /client/modules
parenta9b51e5a39f3375947204215c50ac70c86a176c7 (diff)
downloadjasper-client-fe42407497f4f3dcc1388f2e9da53dd64ccf6382.tar.gz
jasper-client-fe42407497f4f3dcc1388f2e9da53dd64ccf6382.zip
Apply fix from PR jasperproject/jasper-client#173 to MusicMode
Diffstat (limited to 'client/modules')
-rw-r--r--client/modules/MPDControl.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/client/modules/MPDControl.py b/client/modules/MPDControl.py
index 778fe5c..7d79174 100644
--- a/client/modules/MPDControl.py
+++ b/client/modules/MPDControl.py
@@ -62,6 +62,7 @@ def isValid(text):
class MusicMode(object):
def __init__(self, PERSONA, mic, mpdwrapper):
+ self._logger = logging.getLogger(__name__)
self.persona = PERSONA
# self.mic - we're actually going to ignore the mic they passed in
self.music = mpdwrapper
@@ -175,26 +176,25 @@ class MusicMode(object):
while True:
- try:
- threshold, transcribed = self.mic.passiveListen(self.persona)
- except:
- continue
+ threshold, transcribed = self.mic.passiveListen(self.persona)
- if threshold:
+ if not transcribed or not threshold:
+ self._logger.info("Nothing has been said or transcribed.")
+ continue
- self.music.pause()
+ self.music.pause()
- input = self.mic.activeListen(MUSIC=True)
+ input = self.mic.activeListen(MUSIC=True)
- if "close" in input.lower():
- self.mic.say("Closing Spotify")
- return
+ if "close" in input.lower():
+ self.mic.say("Closing Spotify")
+ return
- if input:
- self.delegateInput(input)
- else:
- self.mic.say("Pardon?")
- self.music.play()
+ if input:
+ self.delegateInput(input)
+ else:
+ self.mic.say("Pardon?")
+ self.music.play()
def reconnect(func, *default_args, **default_kwargs):
"""