From 4bce821cbeeea6378791d70e9a64d47c7ae68446 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 5 Dec 2019 10:56:58 -0500 Subject: [PATCH] Added base system for different speech providers. --- libstormgames.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libstormgames.py b/libstormgames.py index 9ea154d..118e0c6 100755 --- a/libstormgames.py +++ b/libstormgames.py @@ -13,13 +13,18 @@ import pyperclip import random import re import requests -import speechd +# Global variable for speech provider +try: + import speechd + spd = speechd.Client() + speechProvider = "speechd" +except: + pass import subprocess import time localConfig = configparser.ConfigParser() globalConfig = configparser.ConfigParser() -spd = speechd.Client() def write_config(writeGlobal = False): if writeGlobal == False: @@ -37,8 +42,9 @@ def read_config(section, value, readGlobal = False): return globalConfig.read(section, value) def speak(text, interupt = True): - if interupt == True: spd.cancel() - spd.say(text) + if speechProvider == "speechd": + if interupt == True: spd.cancel() + spd.say(text) def exit_game(): spd.close()