add printing api for personal voices 69/315169/1
authordyamy-lee <dyamy.lee@samsung.com>
Wed, 24 Jul 2024 07:39:58 +0000 (16:39 +0900)
committerdyamy-lee <dyamy.lee@samsung.com>
Fri, 26 Jul 2024 04:15:55 +0000 (13:15 +0900)
Change-Id: I0f0bc95a6f2303a83b40ed3478b431aaaaaa9b12

common/tts_config_mgr.c

index 1b2b99b..dc83591 100644 (file)
@@ -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++;
        }