summary refs log tree commit diff
path: root/recognizer.py
diff options
context:
space:
mode:
authorClayton G. Hobbs <clay@lakeserv.net>2015-12-27 14:40:53 -0500
committerClayton G. Hobbs <clay@lakeserv.net>2015-12-27 14:40:53 -0500
commit25ebc8fe8b34939507d741636a11816cb4f11db2 (patch)
tree38b21450fd2eef723fd59ea16dafe02dd6220226 /recognizer.py
parent0d67d50252849eca6e659f2daf20616542ec2a05 (diff)
Moved paths to Config class
Paths of important files and directories are part of the program's
configuration, no?

We're making better use of XDG paths now.  Only configuration-y things
go in $XDG_CONFIG_HOME now, with cache-y and data-y things going in the
appropriate places instead of just being crammed in with configuration.
Diffstat (limited to 'recognizer.py')
-rwxr-xr-xrecognizer.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/recognizer.py b/recognizer.py
index ac970a0..3d6f4bf 100755
--- a/recognizer.py
+++ b/recognizer.py
@@ -18,11 +18,13 @@ class Recognizer(GObject.GObject):
         'finished' : (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, (GObject.TYPE_STRING,))
     }
 
-    def __init__(self, language_file, dictionary_file, src=None):
+    def __init__(self, config):
         GObject.GObject.__init__(self)
         self.commands = {}
+
+        src = config.options.microphone
         if src:
-            audio_src = 'alsasrc device="hw:%d,0"' % (src)
+            audio_src = 'alsasrc device="hw:{0},0"'.format(src)
         else:
             audio_src = 'autoaudiosrc'
 
@@ -31,8 +33,8 @@ class Recognizer(GObject.GObject):
             audio_src +
             ' ! audioconvert' +
             ' ! audioresample' +
-            ' ! pocketsphinx lm=' + language_file + ' dict=' +
-            dictionary_file + ' configured=true' +
+            ' ! pocketsphinx lm=' + config.lang_file + ' dict=' +
+            config.dic_file + ' configured=true' +
             ' ! appsink sync=false'
         )
         try: