mycroft-core icon indicating copy to clipboard operation
mycroft-core copied to clipboard

Add event handlers to query available STT/TTS languages

Open NeonDaniel opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. This feature would add functionality for skills or other modules to query what languages are available for STT or TTS.

Describe the solution you'd like Messagebus event handlers would be the simplest method for this so the STT and TTS modules can query loaded plugins directly. i.e.:

bus.on('mycroft.get_tts_langs`, handle_get_tts_langs)

def handle_get_tts_langs(self, message):
    langs = [] if not hasattr(tts, "available_languages") else tts.available_languages
    bus.emit(message.reply({"available_languages": langs}

Describe alternatives you've considered An alternative method would be to load the plugin (determined from config) and check the value directly, but this creates another instance unnecessarily and requires more code to be duplicated anywhere the check is needed. It also is more error-prone than querying running services (config changes/overrides, etc.)

Additional context This request is related to a skill for changing languages that I'm working on refactoring (https://github.com/NeonGeckoCom/skill-translation)

Relates to: https://github.com/MycroftAI/mycroft-core/pull/3059 Potential partial solution for: https://github.com/MycroftAI/mycroft-core/issues/2703 https://github.com/MycroftAI/mycroft-core/issues/1898

NeonDaniel avatar May 21 '22 00:05 NeonDaniel