From d8b9e65e68214b4aa2bb24ddae3602d5788bc469 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 12 Sep 2024 11:44:20 +1000 Subject: Clean up some tts logging and descriptions --- src/tangara/tts/provider.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/tangara/tts/provider.cpp') 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); } } } -- cgit v1.2.3