diff --git a/examples/Python/snowboydecoder.py b/examples/Python/snowboydecoder.py index 5da9aff0..108081b0 100644 --- a/examples/Python/snowboydecoder.py +++ b/examples/Python/snowboydecoder.py @@ -144,7 +144,8 @@ def start(self, detected_callback=play_audio_file, sleep_time=0.03, audio_recorder_callback=None, silent_count_threshold=15, - recording_timeout=100): + recording_timeout=100, + verbose=True): """ Start the voice detector. For every `sleep_time` second it checks the audio buffer for triggering keywords. If detected, then call @@ -208,10 +209,11 @@ def start(self, detected_callback=play_audio_file, self.recordedData.append(data) silentCount = 0 recordingCount = 0 - message = "Keyword " + str(status) + " detected at time: " - message += time.strftime("%Y-%m-%d %H:%M:%S", - time.localtime(time.time())) - logger.info(message) + if verbose: + message = "Keyword " + str(status) + " detected at time: " + message += time.strftime("%Y-%m-%d %H:%M:%S", + time.localtime(time.time())) + logger.info(message) callback = detected_callback[status-1] if callback is not None: callback() diff --git a/examples/Python3/snowboydecoder.py b/examples/Python3/snowboydecoder.py index 34ee26fb..f5ae08a5 100644 --- a/examples/Python3/snowboydecoder.py +++ b/examples/Python3/snowboydecoder.py @@ -130,7 +130,8 @@ def start(self, detected_callback=play_audio_file, sleep_time=0.03, audio_recorder_callback=None, silent_count_threshold=15, - recording_timeout=100): + recording_timeout=100, + verbose=True): """ Start the voice detector. For every `sleep_time` second it checks the audio buffer for triggering keywords. If detected, then call @@ -212,10 +213,11 @@ def audio_callback(in_data, frame_count, time_info, status): self.recordedData.append(data) silentCount = 0 recordingCount = 0 - message = "Keyword " + str(status) + " detected at time: " - message += time.strftime("%Y-%m-%d %H:%M:%S", - time.localtime(time.time())) - logger.info(message) + if verbose: + message = "Keyword " + str(status) + " detected at time: " + message += time.strftime("%Y-%m-%d %H:%M:%S", + time.localtime(time.time())) + logger.info(message) callback = detected_callback[status-1] if callback is not None: callback()