From c489db72256a4a44e4ef7e587b278e2e19bf4a42 Mon Sep 17 00:00:00 2001 From: dyamy-lee Date: Wed, 24 Jul 2024 16:39:58 +0900 Subject: [PATCH] add printing api for personal voices Change-Id: I0f0bc95a6f2303a83b40ed3478b431aaaaaa9b12 --- common/tts_config_mgr.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/common/tts_config_mgr.c b/common/tts_config_mgr.c index 1b2b99b..dc83591 100644 --- a/common/tts_config_mgr.c +++ b/common/tts_config_mgr.c @@ -2210,6 +2210,42 @@ bool tts_config_check_default_voice_is_valid(const char* language, int type) return __tts_config_mgr_check_lang_is_valid(config_info.engine_id, language, type); } +int __tts_config_mgr_print_personal_info(const char* engine_id) +{ + char filepath[512] = {'\0',}; + + memset(filepath, '\0', 512); + snprintf(filepath, 512, "%s/%s-%s", TTS_DOWNLOAD_PERSONAL_INFO, engine_id, "personal.xml"); + + tts_personal_info_s* info = NULL; + int ret = tts_parser_get_personal_info(filepath, &info); + if (0 != ret) { + return -1; + } + + GSList *iter_personal_voice = NULL; + tts_config_personal_s* personal_voice = NULL; + if (g_slist_length(info->personal_voices) > 0) { + /* Get a first item */ + iter_personal_voice = g_slist_nth(info->personal_voices, 0); + + int j = 1; + while (NULL != iter_personal_voice) { + /*Get handle data from list*/ + personal_voice = iter_personal_voice->data; + + SLOG(LOG_DEBUG, TAG_TTSCONFIG, " [%dth] lang(%s) unique_id(%s) display_name(%s) device_name(%s)", j, personal_voice->language, personal_voice->unique_id, personal_voice->display_name, personal_voice->device_name); + + /*Get next item*/ + iter_personal_voice = g_slist_next(iter_personal_voice); + j++; + } + } else { + return -1; + } + + return 0; +} int __tts_config_mgr_print_engine_info() { @@ -2259,6 +2295,13 @@ int __tts_config_mgr_print_engine_info() } else { SLOG(LOG_ERROR, TAG_TTSCONFIG, " Voice is NONE"); } + + SLOG(LOG_DEBUG, TAG_TTSCONFIG, " Personal Voices"); + int ret = __tts_config_mgr_print_personal_info(engine_info->uuid); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_TTSCONFIG, " Personal Voice is NONE"); + } + iter = g_slist_next(iter); i++; } -- 2.7.4