summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2014-10-20 17:27:53 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2014-10-20 17:27:53 +0200
commite472c35c2640497b68d6a660fb8c110fe29bd226 (patch)
treeaf0d8b968b43a2a773be80239d0d6b0f81c9166a
parent7d89df8547f5341efb8129d45d1f21fe18bb994a (diff)
downloadjasper-client-e472c35c2640497b68d6a660fb8c110fe29bd226.tar.gz
jasper-client-e472c35c2640497b68d6a660fb8c110fe29bd226.zip
Adapt STT engine API from PR jasperproject/jasper-client#219 in tts.py
-rw-r--r--client/tts.py10
-rwxr-xr-xjasper.py2
2 files changed, 11 insertions, 1 deletions
diff --git a/client/tts.py b/client/tts.py
index 43c8ccb..71f4ea8 100644
--- a/client/tts.py
+++ b/client/tts.py
@@ -37,6 +37,16 @@ class AbstractTTSEngine(object):
__metaclass__ = ABCMeta
@classmethod
+ def get_config(cls):
+ return {}
+
+ @classmethod
+ def get_instance(cls):
+ config = cls.get_config()
+ instance = cls(**config)
+ return instance
+
+ @classmethod
@abstractmethod
def is_available(cls):
return diagnose.check_executable('aplay')
diff --git a/jasper.py b/jasper.py
index 24396cf..13c3ca9 100755
--- a/jasper.py
+++ b/jasper.py
@@ -100,7 +100,7 @@ class Jasper(object):
tts_engine_class = tts.get_engine_by_slug(tts_engine_slug)
# Initialize Mic
- self.mic = Mic(tts_engine_class(),
+ self.mic = Mic(tts_engine_class.get_instance(),
stt.PocketSphinxSTT(**stt.PocketSphinxSTT.get_config()),
stt.newSTTEngine(stt_engine_type, api_key=api_key))