示例#1
0
文件: tts.py 项目: mouseratti/asrtts
 def _tts_execute_translator(self, phrase):
     cmd = self._tts_format_command(phrase)
     popen = Popen(cmd, shell=True, env=ENVIRONMENT, stdout=PIPE, stderr=PIPE)
     popen.command = cmd
     timeout = TIMEOUT_MS
     while True or timeout > 0:
         if popen.poll() is not None:
             break
         self.sleep_ms(100)
         timeout -= 100
     return self._tts_handle_popen(popen)
示例#2
0
 def run_cmd(self, command):
     logger.debug("Running `%s`" % " ".join(command))
     proc = Popen(command, stdout=PIPE, stdin=PIPE, stderr=PIPE)
     proc.command = command
     stdout, stderr = proc.communicate()
     logger.debug(stderr)
     if proc.returncode == 0:
         return stdout
     else:
         err_msg = "%s => %s" % (" ".join(command), proc.returncode)
         err_msg += "\n%s" % stderr
         if self.context.request:
             err_msg += "\n%s" % self.context.request.url
         raise FFmpegError(err_msg)