From 25ebc8fe8b34939507d741636a11816cb4f11db2 Mon Sep 17 00:00:00 2001 From: "Clayton G. Hobbs" Date: Sun, 27 Dec 2015 14:40:53 -0500 Subject: 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. --- recognizer.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'recognizer.py') 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: -- cgit 1.4.1