Added base system for different speech providers.
This commit is contained in:
parent
6c367f78d1
commit
4bce821cbe
@ -13,13 +13,18 @@ import pyperclip
|
|||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import requests
|
import requests
|
||||||
import speechd
|
# Global variable for speech provider
|
||||||
|
try:
|
||||||
|
import speechd
|
||||||
|
spd = speechd.Client()
|
||||||
|
speechProvider = "speechd"
|
||||||
|
except:
|
||||||
|
pass
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
|
||||||
localConfig = configparser.ConfigParser()
|
localConfig = configparser.ConfigParser()
|
||||||
globalConfig = configparser.ConfigParser()
|
globalConfig = configparser.ConfigParser()
|
||||||
spd = speechd.Client()
|
|
||||||
|
|
||||||
def write_config(writeGlobal = False):
|
def write_config(writeGlobal = False):
|
||||||
if writeGlobal == False:
|
if writeGlobal == False:
|
||||||
@ -37,8 +42,9 @@ def read_config(section, value, readGlobal = False):
|
|||||||
return globalConfig.read(section, value)
|
return globalConfig.read(section, value)
|
||||||
|
|
||||||
def speak(text, interupt = True):
|
def speak(text, interupt = True):
|
||||||
if interupt == True: spd.cancel()
|
if speechProvider == "speechd":
|
||||||
spd.say(text)
|
if interupt == True: spd.cancel()
|
||||||
|
spd.say(text)
|
||||||
|
|
||||||
def exit_game():
|
def exit_game():
|
||||||
spd.close()
|
spd.close()
|
||||||
|
Loading…
Reference in New Issue
Block a user