MycroftAI/mycroft-core

Add event handlers to query available STT/TTS languages

NeonDaniel opened this issue · 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: #3059
Potential partial solution for:
#2703
#1898