free(lang);
lang = NULL;
}
- } else if (IN_IGNORED == event.mask) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] IN_IGNORED event");
+ } else if (IN_DELETE_SELF == event.mask) {
+ SLOG(LOG_ERROR, tts_tag(), "[ERROR] IN_DELETE_SELF event");
+
tts_parser_unload_config(g_config_info);
+ tts_parser_reset();
tts_parser_load_config(&g_config_info);
} else {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] Undefined event (0x%x)", event.mask);
}
g_config_fd_noti = fd;
- wd = inotify_add_watch(fd, TTS_CONFIG, IN_CLOSE_WRITE);
+ wd = inotify_add_watch(fd, TTS_CONFIG, IN_CLOSE_WRITE|IN_DELETE_SELF);
g_config_wd_noti = wd;
g_config_fd_handler_noti = ecore_main_fd_handler_add(fd, ECORE_FD_READ,
int ret = xmlSaveFile(destination, doc);
if (0 > ret) {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret);
+ } else {
+ SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to save %s", destination);
}
/* Set mode */
int ret = xmlSaveFile(TTS_CONFIG, g_config_doc);
if (0 > ret) {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret);
+ } else {
+ SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG);
}
return 0;
while (cur != NULL) {
if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_CONFIG_LANGUAGE)) {
xmlNodeSetContent(cur, (const xmlChar *)language);
- }
+ }
if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_CONFIG_VOICE_TYPE)) {
switch (type) {
int ret = xmlSaveFile(TTS_CONFIG, g_config_doc);
if (0 > ret) {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret);
+ } else {
+ SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG);
}
return 0;
int ret = xmlSaveFile(TTS_CONFIG, g_config_doc);
if (0 > ret) {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret);
+ } else {
+ SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG);
}
return 0;
int ret = xmlSaveFile(TTS_CONFIG, g_config_doc);
if (0 > ret) {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret);
+ } else {
+ SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG);
}
return 0;
snprintf(temp, 10, "%d", value);
xmlNodeSetContent(cur, (const xmlChar *)temp);
break;
- }
+ }
cur = cur->next;
}
int ret = xmlSaveFile(TTS_CONFIG, g_config_doc);
if (0 > ret) {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret);
+ } else {
+ SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG);
}
return 0;
return 0;
}
+
+int tts_parser_reset()
+{
+ SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Reset g_config_doc as %s", TTS_DEFAULT_CONFIG);
+
+ if (NULL != g_config_doc) {
+ xmlFreeDoc(g_config_doc);
+ g_config_doc = NULL;
+ }
+
+ g_config_doc = xmlParseFile(TTS_DEFAULT_CONFIG);
+ if (NULL == g_config_doc) {
+ SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse %s", TTS_DEFAULT_CONFIG);
+ return -1;
+ }
+
+ int ret = xmlSaveFile(TTS_CONFIG, g_config_doc);
+ if (0 > ret) {
+ SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to save %s", TTS_CONFIG);
+ }
+
+ return 0;
+}