Skip to content

Commit

Permalink
tweak text to speech
Browse files Browse the repository at this point in the history
  • Loading branch information
jgstew committed Jul 3, 2024
1 parent 1abee5e commit 30e2021
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion SharedProcessors/TextToSpeech.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import os
import platform
import shutil

from autopkglib import ( # pylint: disable=import-error,wrong-import-position,unused-import
Processor,
Expand All @@ -34,7 +35,8 @@ def speak(self, input_string):

# from: https://stackoverflow.com/a/59118441/861745
syst = platform.system()
if syst == "Linux" and platform.linux_distribution()[0] == "Ubuntu":
# change check to look for command existance, rather than Ubuntu specific:
if syst == "Linux" and shutil.which("spd-say") is not None:
os.system("spd-say %s" % tx)
elif syst == "Windows":
os.system(
Expand Down
2 changes: 1 addition & 1 deletion Test-Recipes/TextToSpeech.test.recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ MinimumVersion: "2.3"
Process:
- Processor: com.github.jgstew.SharedProcessors/TextToSpeech
Arguments:
input_string: "Hello World from AutoPkg!"
input_string: "Hello World from AutoPkg!!!"
# so far tested on macos only, but should support windows and ubuntu as well with no deps or any os with pyttsx3

# - Processor: URLTextSearcher
Expand Down

0 comments on commit 30e2021

Please sign in to comment.