From abd0eacddb3f5ad44ad3e859e32826b4cd2fc8e4 Mon Sep 17 00:00:00 2001 From: Jezra Date: Sat, 20 Apr 2013 09:44:20 -0700 Subject: Whoa bub! you don't have to yell. Case insensitive commands --- Blather.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Blather.py b/Blather.py index af36edb..8985cd6 100755 --- a/Blather.py +++ b/Blather.py @@ -51,16 +51,17 @@ class Blather: #this is a parsible line (key,value) = line.split(":",1) print key, value - self.commands[key.strip()] = value.strip() + self.commands[key.strip().lower()] = value.strip() strings.write( key.strip()+"\n") #close the strings file strings.close() def recognizer_finished(self, recognizer, text): + t = text.lower() #is there a matching command? - if self.commands.has_key( text ): - cmd = self.commands[text] + if self.commands.has_key( t ): + cmd = self.commands[t] print cmd subprocess.call(cmd, shell=True) else: @@ -71,7 +72,7 @@ class Blather: #stop listening self.recognizer.pause() #let the UI know that there is a finish - self.ui.finished(text) + self.ui.finished(t) def run(self): if self.ui: -- cgit 1.4.1