diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-11 14:27:40 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-26 13:34:45 +0200 |
| commit | 0edd5741d36c0f84ce5bbba3288793081909f5a9 (patch) | |
| tree | 8aa4eab0ce8103a07f944b8a71fdd8b881758a47 /client/speaker.py | |
| parent | f099b6eda8a48236fc801fb1e7a0714f7c665eaa (diff) | |
| download | jasper-client-0edd5741d36c0f84ce5bbba3288793081909f5a9.tar.gz jasper-client-0edd5741d36c0f84ce5bbba3288793081909f5a9.zip | |
Getting tts engine from profile
Diffstat (limited to 'client/speaker.py')
| -rw-r--r-- | client/speaker.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/client/speaker.py b/client/speaker.py index c69ff95..64bbc7b 100644 --- a/client/speaker.py +++ b/client/speaker.py @@ -208,8 +208,22 @@ def newSpeaker(): ValueError if no speaker implementation is supported on this platform """ - tts_engine = 'espeak-tts' + tts_engine = None + # Try to get tts_engine from config + if os.path.exists('profile.yml'): + with open('profile.yml', 'r') as f: + profile = yaml.safe_load(f) + if 'tts_engine' in profile: + tts_engine = profile['tts_engine'] + + # Default values if config file does not exist or option not set + if not tts_engine: + if platform.system() == 'darwin': + tts_engine = 'osx-tts' + else: + tts_engine = 'espeak-tts' + selected_engines = filter(lambda engine: hasattr(engine, "SLUG") and engine.SLUG == tts_engine, TTS_ENGINES) if len(selected_engines) == 0: raise ValueError("No TTS engine found for slug '%s'" % tts_engine) |
