Browse Source

Whoa bub! you don't have to yell.

Case insensitive commands
Jezra 11 years ago
parent
commit
abd0eacddb
1 changed files with 5 additions and 4 deletions
  1. 5
    4
      Blather.py

+ 5
- 4
Blather.py View File

51
 						#this is a parsible line
51
 						#this is a parsible line
52
 						(key,value) = line.split(":",1)
52
 						(key,value) = line.split(":",1)
53
 						print key, value
53
 						print key, value
54
-						self.commands[key.strip()] = value.strip()
54
+						self.commands[key.strip().lower()] = value.strip()
55
 						strings.write( key.strip()+"\n")
55
 						strings.write( key.strip()+"\n")
56
 		#close the strings file
56
 		#close the strings file
57
 		strings.close()
57
 		strings.close()
58
 	
58
 	
59
 	
59
 	
60
 	def recognizer_finished(self, recognizer, text):
60
 	def recognizer_finished(self, recognizer, text):
61
+		t = text.lower()
61
 		#is there a matching command?
62
 		#is there a matching command?
62
-		if self.commands.has_key( text ):
63
-			cmd = self.commands[text]
63
+		if self.commands.has_key( t ):
64
+			cmd = self.commands[t]
64
 			print cmd
65
 			print cmd
65
 			subprocess.call(cmd, shell=True)
66
 			subprocess.call(cmd, shell=True)
66
 		else:
67
 		else:
71
 				#stop listening
72
 				#stop listening
72
 				self.recognizer.pause()
73
 				self.recognizer.pause()
73
 			#let the UI know that there is a finish
74
 			#let the UI know that there is a finish
74
-			self.ui.finished(text)
75
+			self.ui.finished(t)
75
 	
76
 	
76
 	def run(self):
77
 	def run(self):
77
 		if self.ui:
78
 		if self.ui:

Loading…
Cancel
Save