[Fix] Allow selecting of voice packs.

This commit is contained in:
Ritchie Cunningham 2025-06-07 17:16:45 +01:00
parent 44c8e829db
commit 3c48e91174

View File

@ -35,14 +35,16 @@ sub notify {
# This will offload the entire backgrounding task to the systemd service
# manager.
# We need to escape any single quotes in the text..
# Sorry @dacav, tried to use your open() suggestion, but as we can't
# daemonise using the fork solution, we have to manually prevent shell injection.
$text_to_speak =~ s/'/'\\''/g;
my $command = "echo '$text_to_speak' | festival --tts --language english --pipe";
$text_to_speak =~ s/\\/\\\\/g; # Must escape backslashes first
$text_to_speak =~ s/"/\\"/g; # Then escape double-quotes
system("systemd-run", "--user", "--quiet", "--no-ask-password", "/bin/sh", "-c", $command)
my $scheme_command = "$festival_voice(SayText \"$text_to_speak\")";
$scheme_command =~ s/'/'\\''/g;
my $command = "echo '$scheme_command' | festival";
system("systemd-run", "--user", "--quiet", "--no-ask-password", "/bin/sh", "-c", $command);
}
}