Switch TTS from mimic to flite
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user