Skip to content

Commit

Permalink
fix kwargs handling in synth method
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Dec 8, 2023
1 parent 31fe16a commit c1018fa
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ovos_plugin_manager/templates/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,15 @@ def synth(self, sentence, ctxt: TTSContext = None, **kwargs):
sentence_hash = hash_sentence(sentence)

# parse requested language for this TTS request
# NOTE: this is ovos/neon only functionality, not in mycroft-core!
ctxt = ctxt or TTSContext()
kwargs["lang"] = ctxt.lang
kwargs["voice"] = ctxt.voice
if "lang" in kwargs:
ctxt.session.lang = kwargs["lang"]
else:
kwargs["lang"] = ctxt.lang
if "voice" in kwargs:
ctxt.session.tts_preferences["config"]["voice"] = kwargs["voice"]
else:
kwargs["voice"] = ctxt.voice

cache = ctxt.get_cache(self.audio_ext, self.config)

Expand All @@ -512,7 +517,6 @@ def synth(self, sentence, ctxt: TTSContext = None, **kwargs):
audio = cache.define_audio_file(sentence_hash)

# filter kwargs per plugin, different plugins expose different options
# mycroft-core -> no kwargs
# ovos -> lang + voice optional kwargs
# neon-core -> message
kwargs = {k: v for k, v in kwargs.items()
Expand Down

0 comments on commit c1018fa

Please sign in to comment.