Sfoglia il codice sorgente

modified recognizer instance creation to use self.options['microphone']

Jezra 10 anni fa
parent
commit
e50facf674
1 ha cambiato i file con 7 aggiunte e 2 eliminazioni
  1. 7
    2
      Blather.py

+ 7
- 2
Blather.py Vedi File

@@ -38,12 +38,13 @@ class Blather:
38 38
 		self.continuous_listen = False
39 39
 
40 40
 		self.commands = {}
41
+
42
+		#read the commands
41 43
 		self.read_commands()
42
-		self.recognizer = Recognizer(lang_file, dic_file, opts.microphone )
43
-		self.recognizer.connect('finished',self.recognizer_finished)
44 44
 
45 45
 		#load the options file
46 46
 		self.load_options()
47
+
47 48
 		#merge the opts
48 49
 		for k,v in opts.__dict__.items():
49 50
 			if (not k in self.options) or opts.override:
@@ -76,6 +77,10 @@ class Blather:
76 77
 		if self.options['history']:
77 78
 			self.history = []
78 79
 
80
+		#create the recognizer
81
+		self.recognizer = Recognizer(lang_file, dic_file, self.options['microphone'] )
82
+		self.recognizer.connect('finished',self.recognizer_finished)
83
+
79 84
 	def read_commands(self):
80 85
 		#read the.commands file
81 86
 		file_lines = open(command_file)

Loading…
Annulla
Salva