From 83d5e2ebea4bbc14d561b7b3dd1774bd7d87f2fb Mon Sep 17 00:00:00 2001 From: schneefux Date: Fri, 12 Sep 2014 21:11:45 +0200 Subject: Remove general try except block --- client/conversation.py | 16 +++++++--------- client/mic.py | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'client') diff --git a/client/conversation.py b/client/conversation.py index fe3e058..be9b8e9 100644 --- a/client/conversation.py +++ b/client/conversation.py @@ -46,14 +46,12 @@ class Conversation(object): for notif in notifications: print notif - try: - threshold, transcribed = self.mic.passiveListen(self.persona) - except: + threshold, transcribed = self.mic.passiveListen(self.persona) + if not transcribed or not threshold: continue - if threshold: - input = self.mic.activeListen(threshold) - if input: - self.delegateInput(input) - else: - self.mic.say("Pardon?") + input = self.mic.activeListen(threshold) + if input: + self.delegateInput(input) + else: + self.mic.say("Pardon?") diff --git a/client/mic.py b/client/mic.py index 096610d..c0656ce 100644 --- a/client/mic.py +++ b/client/mic.py @@ -138,7 +138,7 @@ class Mic: # no use continuing if no flag raised if not didDetect: print "No disturbance detected" - return + return (None, None) # cutoff any recording before this disturbance was detected frames = frames[-20:] -- cgit v1.3.1