Neurone.py 718 B

12345678910111213141516171819202122
  1. import importlib
  2. from core import ConfigurationManager
  3. class Neurone:
  4. def __init__(self, tts=None):
  5. # get the name of the plugin
  6. # print self.__class__.__name__
  7. # load the tts from settings
  8. self.tts = tts
  9. if tts is None:
  10. self.tts = ConfigurationManager.get_default_text_to_speech()
  11. # get tts args
  12. self.tts_args = ConfigurationManager.get_tts_args(self.tts)
  13. def say(self, message):
  14. # here we use the tts to make jarvis talk
  15. # the module is imported on fly, depending on the selected tts from settings
  16. tts_backend = importlib.import_module("tts." + self.tts)
  17. tts_backend.say(words=message, **self.tts_args)