Esempio n. 1
0
    def test_engine_google_init(self):

        a_config = audio_handler.AudioHandlerConfigModel()
        a_config.speech_engine = audio_handler.SPEECH_ENGINE_GOOGLE
        a_handler = audio_handler.AudioHandler(p_config=a_config)

        self.assertIsNotNone(a_handler)
Esempio n. 2
0
    def test_engine_pyttsx3_init(self):

        a_config = audio_handler.AudioHandlerConfigModel()
        a_config.speech_engine = audio_handler.SPEECH_ENGINE_PYTTSX3
        a_handler = audio_handler.AudioHandler(p_config=a_config)

        self.assertIsNotNone(a_handler)
Esempio n. 3
0
    def test_engine_external_init(self):

        a_config = audio_handler.AudioHandlerConfigModel()
        a_config.speech_engine = audio_handler.SPEECH_ENGINE_EXTERNAL
        a_handler = audio_handler.AudioHandler(p_config=a_config)

        self.assertIsNotNone(a_handler)
Esempio n. 4
0
    def test_engine_invalid(self):

        a_config = audio_handler.AudioHandlerConfigModel()
        a_config.speech_engine = "NOT-EXISTING"

        with self.assertRaises(configuration.ConfigurationException):
            a_handler = audio_handler.AudioHandler(p_config=a_config)
            self.assertIsNotNone(a_handler)
Esempio n. 5
0
    def test_engine_external_speak(self):

        a_config = audio_handler.AudioHandlerConfigModel()
        a_config.speech_engine = audio_handler.SPEECH_ENGINE_EXTERNAL
        a_config.spool_dir = SPOOL_DIR
        a_handler = audio_handler.AudioHandler(p_config=a_config)

        self.assertIsNotNone(a_handler)

        self.delete_audio_file(p_audio_handler=a_handler)
        a_handler.notify(p_text=TEXT)
Esempio n. 6
0
    def test_engine_pyttsx3_speak(self):

        a_config = audio_handler.AudioHandlerConfigModel()
        a_config.speech_engine = audio_handler.SPEECH_ENGINE_PYTTSX3
        a_config.spool_dir = SPOOL_DIR
        a_handler = audio_handler.AudioHandler(p_config=a_config)

        self.assertIsNotNone(a_handler)

        self.delete_audio_file(p_audio_handler=a_handler)
        a_thread = a_handler.notify(p_text=TEXT)
        a_thread.join()
Esempio n. 7
0
    def test_engine_google_speak(self):

        a_config = audio_handler.AudioHandlerConfigModel()
        a_config.speech_engine = audio_handler.SPEECH_ENGINE_GOOGLE
        a_config.spool_dir = SPOOL_DIR
        a_config.locale = LOCALE
        a_handler = audio_handler.AudioHandler(p_config=a_config)

        self.assertIsNotNone(a_handler)

        self.delete_audio_file(p_audio_handler=a_handler)
        a_handler.notify(p_text="hallo", p_locale=LOCALE)

        a_handler.notify(p_text="hallo", p_locale=LOCALE)
Esempio n. 8
0
    def load_configuration(self, p_configuration):

        app_control_section = app_control.AppControlConfigModel()
        p_configuration.add_section(app_control_section)

        audio_handler_section = audio_handler.AudioHandlerConfigModel()
        p_configuration.add_section(audio_handler_section)

        popup_handler_section = popup_handler.PopupHandlerConfigModel()
        p_configuration.add_section(popup_handler_section)

        persistence_section = persistence.PersistenceConfigModel()
        p_configuration.add_section(persistence_section)

        rule_handler_section = rule_handler.RuleHandlerConfigModel()
        p_configuration.add_section(rule_handler_section)

        self._rule_set_section_handler = rule_handler.RuleSetSectionHandler()
        p_configuration.register_section_handler(
            p_section_handler=self._rule_set_section_handler)

        client_process_handler_section = client_process_handler.ClientProcessHandlerConfigModel(
        )
        p_configuration.add_section(client_process_handler_section)

        client_device_handler_section = client_device_handler.ClientDeviceHandlerConfigModel(
        )
        p_configuration.add_section(client_device_handler_section)

        self._client_device_section_handler = client_device_handler.ClientDeviceSectionHandler(
        )
        p_configuration.register_section_handler(
            p_section_handler=self._client_device_section_handler)

        status_server_section = status_server.StatusServerConfigModel()
        p_configuration.add_section(status_server_section)

        master_connector_section = master_connector.MasterConnectorConfigModel(
        )
        p_configuration.add_section(master_connector_section)

        self.app_config = AppConfigModel()
        p_configuration.add_section(self.app_config)

        return super(App,
                     self).load_configuration(p_configuration=p_configuration)
Esempio n. 9
0
    def test_spool_dir_and_file(self):

        a_config = audio_handler.AudioHandlerConfigModel()
        a_config.speech_engine = audio_handler.SPEECH_ENGINE_GOOGLE
        a_config.spool_dir = SPOOL_DIR
        a_handler = audio_handler.AudioHandler(p_config=a_config)

        self.assertIsNotNone(a_handler)

        audio_file = a_handler.get_audio_filename(p_text=TEXT, p_locale=None)

        self.assertTrue(audio_file.startswith(SPOOL_DIR))

        self.delete_audio_file(p_audio_handler=a_handler)
        a_thread = a_handler.notify(p_text=TEXT)
        a_thread.join()
        #        time.sleep(1)

        self.assertTrue(os.path.exists(audio_file))