- return _media_svc_publish_dir_noti(update_type, dir_path, folder_id, pid);
-}
-
-static void __media_svc_noti_all_storage(sqlite3 *handle, uid_t uid)
-{
- int ret = MS_MEDIA_ERR_NONE;
- char *root_path = NULL;
- GPtrArray *path_list = NULL;
- guint i = 0;
-
- ret = ms_user_get_internal_root_path(uid, &root_path);
- media_svc_retm_if(ret != MS_MEDIA_ERR_NONE, "Fail to get root path");
-
- ret = _media_svc_publish_dir_noti(MS_MEDIA_ITEM_UPDATE, root_path, NULL, 0);
- if (ret != MS_MEDIA_ERR_NONE)
- media_svc_error("Fail to send noti");
-
- g_free(root_path);
-
- path_list = g_ptr_array_new_with_free_func(g_free);
- _media_svc_get_storage_path(handle, &path_list);
-
- for (i = 0; i < path_list->len; i++) {
- root_path = g_ptr_array_index(path_list, i);
-
- ret = _media_svc_publish_dir_noti(MS_MEDIA_ITEM_UPDATE, root_path, NULL, 0);
- if (ret != MS_MEDIA_ERR_NONE)
- media_svc_error("Fail to send noti");
- }
-
- g_ptr_array_free(path_list, TRUE);
-}
-
-static void __media_svc_foreach_update_media(gpointer data, gpointer user_data)
-{
- media_svc_content_info_s content_info = {0, };
-
- if (_media_svc_extract_music_metadata_for_update(&content_info, (const char *)data) != MS_MEDIA_ERR_NONE) {
- media_svc_error("Fail to extract metadata");
- _media_svc_destroy_content_info(&content_info);
- return;
- }
-
- if (_media_svc_update_meta_with_data(&content_info) != MS_MEDIA_ERR_NONE)
- media_svc_error("Fail to append item[%s]", content_info.path);
-
- _media_svc_destroy_content_info(&content_info);
-}
-
-int media_svc_update_item_meta(sqlite3 *handle, uid_t uid)
-{
- int ret = MS_MEDIA_ERR_NONE;
- char *sql = NULL;
- GList *path_list = NULL;
-
- sql = sqlite3_mprintf("SELECT media_path FROM %q WHERE media_type=3 AND validity=1", DB_TABLE_MEDIA);
- ret = _media_svc_get_media(handle, sql, &path_list);
- media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Fail to get media list");
-
- if (path_list) {
- g_list_foreach(path_list, __media_svc_foreach_update_media, NULL);
- g_list_free_full(path_list, g_free);
-
- ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_SCANNER, uid);
- media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "_media_svc_list_query_do failed");
- }
-
- /* Noti for this */
- __media_svc_noti_all_storage(handle, uid);
-
- return ret;