def start_server(self):
if self.android is None:
if self.enabled and self.lang.voice is not None:
# voices = ["-s 190 -a 100 -p 75 -ven+m1 ", "-s 170 -a 100 -p 80 -ven+m2 ","-s 175 -a 100 -p 80 -ven+m3 ","-s 190 -a 100 -p 60 -ven+f1 ","-s 170 -a 100 -p 75 -ven+f2 ","-s 170 -a 100 -p 80 -ven+m2 "]
cmd = ['espeak']
cmd.extend(self.lang.voice)
try:
# IS_WIN32 = 'win32' in str(sys.platform).lower() #maybe sys.platform is more secure
is_win = platform.system() == "Windows"
if is_win:
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags = subprocess.CREATE_NEW_CONSOLE | subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = subprocess.SW_HIDE
kwargs = {}
kwargs['startupinfo'] = startupinfo
# self.process = subprocess.Popen(cmd, shell=True, bufsize=0, close_fds=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs)
self.process = subprocess.Popen(cmd, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, startupinfo=startupinfo)
else:
self.process = subprocess.Popen(cmd, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
# self.process = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
self.started = True
except:
self.enabled = False
self.started = False
print(
"eduActiv8: You may like to install espeak to get some extra functionality, however this is not required to successfully use the game.")
# stdout and stderr only used to hide the messages from terminal
else:
self.process = None
评论列表
文章目录