Switch TTS from mimic to flite

This commit is contained in:
2021-04-22 20:10:40 -07:00
parent ffec012ca0
commit dabe5b0fe2
5 changed files with 22 additions and 21 deletions

View File

@@ -21,18 +21,21 @@ package shell
import (
"os"
"os/exec"
"trident"
)
func RunPlugin(program string, data map[string]interface{}) {
var shell string
var ok bool
// Attempt to get shell from config, asserting as string
shell, ok = data["shell"].(string)
shell, ok := data["shell"].(string)
// If unsuccessful
if !ok {
// Set shell to default (/bin/sh)
shell = "/bin/sh"
}
sayOutput, ok := data["sayOutput"].(bool)
if !ok {
sayOutput = false
}
// Create command using configured shell or default (/bin/sh)
cmd := exec.Command(shell, "-c", program)
// Set command environment to system environment
@@ -40,5 +43,8 @@ func RunPlugin(program string, data map[string]interface{}) {
// Set command's standard error to system standard error
cmd.Stderr = os.Stderr
// Run command, ignoring error
_ = cmd.Run()
output, _ := cmd.Output()
if sayOutput {
trident.Say(string(output))
}
}