diff --git a/SharedProcessors/TextToSpeech.py b/SharedProcessors/TextToSpeech.py index a068b48..5ab2478 100644 --- a/SharedProcessors/TextToSpeech.py +++ b/SharedProcessors/TextToSpeech.py @@ -9,6 +9,7 @@ import os import platform +import shutil from autopkglib import ( # pylint: disable=import-error,wrong-import-position,unused-import Processor, @@ -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( diff --git a/Test-Recipes/TextToSpeech.test.recipe.yaml b/Test-Recipes/TextToSpeech.test.recipe.yaml index 41b880b..9eee42f 100644 --- a/Test-Recipes/TextToSpeech.test.recipe.yaml +++ b/Test-Recipes/TextToSpeech.test.recipe.yaml @@ -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