diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-09-12 11:44:20 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-09-12 11:44:20 +1000 |
| commit | d8b9e65e68214b4aa2bb24ddae3602d5788bc469 (patch) | |
| tree | 10d2f56c9a4ad47de40e6c90a03cf87b009c357f /src/tangara/tts/provider.cpp | |
| parent | c51709f99ff5456a5863ca39ff893f823a3642d4 (diff) | |
| download | tangara-fw-d8b9e65e68214b4aa2bb24ddae3602d5788bc469.tar.gz | |
Clean up some tts logging and descriptions
Diffstat (limited to 'src/tangara/tts/provider.cpp')
| -rw-r--r-- | src/tangara/tts/provider.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/tangara/tts/provider.cpp b/src/tangara/tts/provider.cpp index 2b1dd4e6..d19500e0 100644 --- a/src/tangara/tts/provider.cpp +++ b/src/tangara/tts/provider.cpp @@ -49,9 +49,18 @@ auto Provider::feed(const Event& e) -> void { // ESP_LOGI(kTag, "new selection: '%s', interactive? %i", // ev.new_selection->description.value_or("").c_str(), // ev.new_selection->is_interactive); - std::string new_desc = ev.new_selection->description.value_or(""); + auto text = ev.new_selection->description; + if (!text) { + ESP_LOGW(kTag, "missing description for element"); + return; + } + auto file = textToFile(*text); + if (!file) { + return; + } + if (player_) { - player_->playFile(textToFile(new_desc).value_or("")); + player_->playFile(*text, *file); } } } |
