From 3680ae0668706414d736935338d6bca9c643cbd8 Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Thu, 13 Jul 2017 18:12:03 +0900 Subject: [PATCH] [MMFWN-734]Add internal API for system service Change-Id: I7d1610a6fa47946beeeec1ab34eae3c51a3b13cc Signed-off-by: Minje Ahn --- include/media_content_internal.h | 4 +++ include/media_info_private.h | 1 + include_product/media_content_internal.h | 4 +++ include_product/media_info_private.h | 1 + packaging/capi-content-media-content.spec | 2 +- src/media_content.c | 43 +++++++++++++++++++++---------- src/media_folder.c | 2 +- src/media_info.c | 34 ++++++++++++------------ src/media_playlist.c | 12 ++++----- src/media_tag.c | 8 +++--- src/media_util_private.c | 2 +- 11 files changed, 70 insertions(+), 43 deletions(-) diff --git a/include/media_content_internal.h b/include/media_content_internal.h index 1275311..e25db20 100755 --- a/include/media_content_internal.h +++ b/include/media_content_internal.h @@ -55,6 +55,10 @@ int media_filter_set_order_v2(filter_h filter, const char *order); int media_filter_get_order_v2(filter_h filter, char **order); +/* Only for system session process */ +int media_content_connect_with_uid(uid_t uid); + + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/include/media_info_private.h b/include/media_info_private.h index 81bf41a..5956a7f 100755 --- a/include/media_info_private.h +++ b/include/media_info_private.h @@ -677,6 +677,7 @@ int _content_query_prepare(sqlite3_stmt **stmt, char *select_query, char *condit int _content_error_capi(int type, int cotent_error); int _content_query_sql(char *query_str); MediaSvcHandle* _content_get_db_handle(void); +uid_t _content_get_uid(void); attribute_h _content_get_attirbute_handle(void); attribute_h _content_get_alias_attirbute_handle(void); int _media_info_get_media_info_from_db(const char *path, const char *storage_id, media_info_h media); diff --git a/include_product/media_content_internal.h b/include_product/media_content_internal.h index 1275311..e25db20 100755 --- a/include_product/media_content_internal.h +++ b/include_product/media_content_internal.h @@ -55,6 +55,10 @@ int media_filter_set_order_v2(filter_h filter, const char *order); int media_filter_get_order_v2(filter_h filter, char **order); +/* Only for system session process */ +int media_content_connect_with_uid(uid_t uid); + + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/include_product/media_info_private.h b/include_product/media_info_private.h index b89764a..16e0a03 100755 --- a/include_product/media_info_private.h +++ b/include_product/media_info_private.h @@ -894,6 +894,7 @@ int _content_query_prepare(sqlite3_stmt **stmt, char *select_query, char *condit int _content_error_capi(int type, int cotent_error); int _content_query_sql(char *query_str); MediaSvcHandle* _content_get_db_handle(void); +uid_t _content_get_uid(void); attribute_h _content_get_attirbute_handle(void); attribute_h _content_get_alias_attirbute_handle(void); int _media_info_get_media_info_from_db(const char *path, const char *storage_id, media_info_h media); diff --git a/packaging/capi-content-media-content.spec b/packaging/capi-content-media-content.spec index be5b02d..54b448b 100755 --- a/packaging/capi-content-media-content.spec +++ b/packaging/capi-content-media-content.spec @@ -1,6 +1,6 @@ Name: capi-content-media-content Summary: A Media content library in Tizen Native API -Version: 0.3.19 +Version: 0.3.20 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/media_content.c b/src/media_content.c index 87e6cec..2ee0548 100755 --- a/src/media_content.c +++ b/src/media_content.c @@ -25,6 +25,7 @@ static MediaSvcHandle *db_handle = NULL; static int ref_count = 0; static GMutex db_mutex; static __thread media_noti_cb_s *g_noti_info = NULL; +static uid_t content_g_uid = 0; #if 0 static int __media_content_create_attr_handle(void); @@ -1042,6 +1043,14 @@ MediaSvcHandle* _content_get_db_handle(void) return db_handle; } +uid_t _content_get_uid(void) +{ + if (content_g_uid == 0) + return tzplatform_getuid(TZ_USER_NAME); + else + return content_g_uid; +} + int _content_query_prepare(sqlite3_stmt **stmt, char *select_query, char *condition_query, char *option_query) { int len = 0; @@ -1193,7 +1202,7 @@ int _content_query_sql(char *query_str) int ret = MEDIA_CONTENT_ERROR_NONE; /*DB will be updated by Media Server.*/ - ret = media_svc_request_update_db(query_str, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_request_update_db(query_str, _content_get_uid()); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); } @@ -1209,7 +1218,7 @@ int media_content_connect(void) if (db_handle == NULL) { ret = __media_content_create_attribute_handles(); if (ret == MEDIA_CONTENT_ERROR_NONE) { - ret = media_svc_connect(&db_handle, tzplatform_getuid(TZ_USER_NAME), false); + ret = media_svc_connect(&db_handle, _content_get_uid(), false); ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret); if (ret == MEDIA_CONTENT_ERROR_NONE) ref_count++; @@ -1238,6 +1247,14 @@ int media_content_connect(void) return ret; } +int media_content_connect_with_uid(uid_t uid) +{ + media_content_sec_debug("media_content_connect_with_uid [%d]", uid); + content_g_uid = uid; + + return media_content_connect(); +} + int media_content_disconnect(void) { int ret = MEDIA_CONTENT_ERROR_NONE; @@ -1308,7 +1325,7 @@ int media_content_scan_file(const char *path) media_content_retvm_if(ignore_file == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path"); memset(storage_id, 0x00, sizeof(storage_id)); - ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { media_content_error("media_svc_get_storage_id failed : %d", ret); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); @@ -1325,7 +1342,7 @@ int media_content_scan_file(const char *path) media_svc_storage_type_e storage_type; - ret = media_svc_get_storage_type(repl_path, &storage_type, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_get_storage_type(repl_path, &storage_type, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { media_content_sec_error("media_svc_get_storage_type failed : %d (%s)", ret, repl_path); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); @@ -1333,7 +1350,7 @@ int media_content_scan_file(const char *path) ret = media_svc_check_item_exist_by_path(_content_get_db_handle(), storage_id, repl_path); if (ret == MS_MEDIA_ERR_NONE) { /* Refresh */ - ret = media_svc_refresh_item(_content_get_db_handle(), storage_id, storage_type, repl_path, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_refresh_item(_content_get_db_handle(), storage_id, storage_type, repl_path, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { media_content_error("media_svc_refresh_item failed : %d", ret); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); @@ -1341,7 +1358,7 @@ int media_content_scan_file(const char *path) } else if (ret == MS_MEDIA_ERR_DB_NO_RECORD) { /* Insert */ - ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_id, storage_type, repl_path, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_id, storage_type, repl_path, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { if (ret == MS_MEDIA_ERR_DB_CONSTRAINT_FAIL) { media_content_sec_error("This item is already inserted. This may be normal operation because other process already did this (%s)", repl_path); @@ -1362,7 +1379,7 @@ int media_content_scan_file(const char *path) } else { /* This means this path has to be deleted */ media_content_debug("This path doesn't exists in file system... So now start to delete it from DB"); - ret = media_svc_delete_item_by_path(_content_get_db_handle(), storage_id, repl_path, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_delete_item_by_path(_content_get_db_handle(), storage_id, repl_path, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { if (ret == MS_MEDIA_ERR_DB_NO_RECORD) { media_content_error("Does not exist in media DB also... So, this is an invalid parameter"); @@ -1482,7 +1499,7 @@ int media_content_scan_folder(const char *path, bool is_recursive, media_scan_co } else { /* This means this folder has to be deleted */ /* Or, it is real invalid path.. check storage type */ - ret = media_svc_get_storage_type(repl_path, &storage_type, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_get_storage_type(repl_path, &storage_type, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { media_content_sec_error("media_svc_get_storage_type failed : %d (%s)", ret, repl_path); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); @@ -1491,7 +1508,7 @@ int media_content_scan_folder(const char *path, bool is_recursive, media_scan_co media_content_debug("This path doesn't exists in file system... So will be deleted it from DB"); } - ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { media_content_error("media_svc_get_storage_id failed : %d", ret); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); @@ -1504,7 +1521,7 @@ int media_content_scan_folder(const char *path, bool is_recursive, media_scan_co cb_data->callback = callback; cb_data->user_data = user_data; - ret = media_directory_scanning_async(repl_path, storage_id, is_recursive, _media_content_scan_cb, cb_data, tzplatform_getuid(TZ_USER_NAME)); + ret = media_directory_scanning_async(repl_path, storage_id, is_recursive, _media_content_scan_cb, cb_data, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { media_content_error("media_directory_scanning_async failed : %d", ret); SAFE_FREE(cb_data); @@ -1536,10 +1553,10 @@ int media_content_scan_folder_v2(const char *path, bool is_recursive, media_scan cb_data->callback = callback; cb_data->user_data = user_data; - ret = media_svc_get_storage_id(_content_get_db_handle(), path, storage_id, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_get_storage_id(_content_get_db_handle(), path, storage_id, _content_get_uid()); /*FIX ME. need to check ret value?*/ - ret = media_directory_scanning_async(path, storage_id, is_recursive, _media_content_scan_cb_v2, cb_data, tzplatform_getuid(TZ_USER_NAME)); + ret = media_directory_scanning_async(path, storage_id, is_recursive, _media_content_scan_cb_v2, cb_data, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) media_content_error("media_directory_scanning_async failed : %d", ret); @@ -1558,7 +1575,7 @@ int media_content_cancel_scan_folder(const char *path) ret = _media_content_replace_path(path, repl_path); media_content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed"); - ret = media_directory_scanning_cancel(repl_path, tzplatform_getuid(TZ_USER_NAME)); + ret = media_directory_scanning_cancel(repl_path, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) media_content_error("media_directory_scanning_async failed : %d", ret); diff --git a/src/media_folder.c b/src/media_folder.c index 8ef419a..f528217 100755 --- a/src/media_folder.c +++ b/src/media_folder.c @@ -468,7 +468,7 @@ int media_folder_update_to_db(media_folder_h folder) return ret; } - ret = media_svc_rename_folder(_content_get_db_handle(), _folder->storage_uuid, g_src_path, repl_path, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_rename_folder(_content_get_db_handle(), _folder->storage_uuid, g_src_path, repl_path, _content_get_uid()); SAFE_FREE(g_src_path); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); diff --git a/src/media_info.c b/src/media_info.c index b933baa..5126419 100755 --- a/src/media_info.c +++ b/src/media_info.c @@ -221,9 +221,9 @@ static int __media_info_insert_batch(media_batch_insert_e insert_type, const cha _cb_data->insert_list_path = g_strdup(list_path); if (insert_type == MEDIA_BATCH_INSERT_NORMAL) - ret = media_files_register(list_path, __media_info_insert_completed_cb, _cb_data, tzplatform_getuid(TZ_USER_NAME)); + ret = media_files_register(list_path, __media_info_insert_completed_cb, _cb_data, _content_get_uid()); else if (insert_type == MEDIA_BATCH_INSERT_BURSTSHOT) - ret = media_burstshot_register(list_path, __media_info_insert_completed_cb, _cb_data, tzplatform_getuid(TZ_USER_NAME)); + ret = media_burstshot_register(list_path, __media_info_insert_completed_cb, _cb_data, _content_get_uid()); else ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER; @@ -479,7 +479,7 @@ int media_info_insert_to_db(const char *path, media_info_h *info) media_content_retvm_if(ignore_dir == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path"); memset(storage_id, 0x00, sizeof(storage_id)); - ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { media_content_error("media_svc_get_storage_id failed : %d", ret); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); @@ -491,13 +491,13 @@ int media_info_insert_to_db(const char *path, media_info_h *info) media_svc_storage_type_e storage_type = 0; - ret = media_svc_get_storage_type(repl_path, &storage_type, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_get_storage_type(repl_path, &storage_type, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { media_content_sec_error("media_svc_get_storage_type failed : %d", ret); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); } - ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_id, storage_type, repl_path, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_id, storage_type, repl_path, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { if (ret == MS_MEDIA_ERR_DB_CONSTRAINT_FAIL) { @@ -745,7 +745,7 @@ int media_info_delete_from_db(const char *media_id) return ret; } - ret = media_svc_delete_item_by_path(_content_get_db_handle(), storage_id, path, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_delete_item_by_path(_content_get_db_handle(), storage_id, path, _content_get_uid()); SAFE_FREE(path); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); @@ -3004,7 +3004,7 @@ int media_info_refresh_metadata_to_db(const char *media_id) } memset(storage_id, 0x00, sizeof(storage_id)); - ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { media_content_error("media_svc_get_storage_id failed : %d", ret); SAFE_FREE(file_path); @@ -3012,7 +3012,7 @@ int media_info_refresh_metadata_to_db(const char *media_id) return _content_error_capi(MEDIA_CONTENT_TYPE, ret); } - ret = media_svc_refresh_item(_content_get_db_handle(), storage_id, storage_type, repl_path, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_refresh_item(_content_get_db_handle(), storage_id, storage_type, repl_path, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret); @@ -3057,26 +3057,26 @@ int media_info_move_to_db(media_info_h media, const char* dst_path) media_content_retvm_if(ignore_dir == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path"); - ret = media_svc_get_storage_type(org_repl_path, &src_storage_type, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_get_storage_type(org_repl_path, &src_storage_type, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { media_content_sec_error("media_svc_get_storage_type failed : %d", ret); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); } - ret = media_svc_get_storage_type(repl_path, &dst_storage_type, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_get_storage_type(repl_path, &dst_storage_type, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { media_content_sec_error("media_svc_get_storage_type failed : %d", ret); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); } memset(storage_id, 0x00, sizeof(storage_id)); - ret = media_svc_get_storage_id(_content_get_db_handle(), org_repl_path, storage_id, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_get_storage_id(_content_get_db_handle(), org_repl_path, storage_id, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { media_content_error("media_svc_get_storage_id failed : %d", ret); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); } - ret = media_svc_move_item(_content_get_db_handle(), storage_id, src_storage_type, org_repl_path, dst_storage_type, repl_path, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_move_item(_content_get_db_handle(), storage_id, src_storage_type, org_repl_path, dst_storage_type, repl_path, _content_get_uid()); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); } @@ -3101,7 +3101,7 @@ int media_info_create_thumbnail(media_info_h media, media_thumbnail_completed_cb _thumb_cb->user_data = user_data; _thumb_cb->thumbnail_completed_cb = callback; - ret = thumbnail_request_from_db_async(_media->request_id, repl_path, (ThumbFunc)__media_info_thumbnail_completed_cb, (void *)_thumb_cb, tzplatform_getuid(TZ_USER_NAME)); + ret = thumbnail_request_from_db_async(_media->request_id, repl_path, (ThumbFunc)__media_info_thumbnail_completed_cb, (void *)_thumb_cb, _content_get_uid()); ret = _content_error_capi(MEDIA_THUMBNAIL_TYPE, ret); } else { media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER); @@ -3157,7 +3157,7 @@ int media_info_start_face_detection(media_info_h media, media_face_detection_com _face_cb->user_data = user_data; _face_cb->face_completed_cb = callback; - ret = dcm_request_extract_face_async(_media->face_request_id, repl_path, (FaceFunc)__media_info_face_completed_cb, (void *)_face_cb, tzplatform_getuid(TZ_USER_NAME)); + ret = dcm_request_extract_face_async(_media->face_request_id, repl_path, (FaceFunc)__media_info_face_completed_cb, (void *)_face_cb, _content_get_uid()); ret = _content_error_capi(MEDIA_THUMBNAIL_TYPE, ret); } else { media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER); @@ -3528,7 +3528,7 @@ int media_info_insert_to_db_with_data(media_info_h media) ret = __media_info_map_data_usr_to_svc(_media, &svc_content_info, _media->storage_type); media_content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "__media_info_map_data_usr_to_svc fail"); - ret = media_svc_insert_item_immediately_with_data(_content_get_db_handle(), svc_content_info, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_insert_item_immediately_with_data(_content_get_db_handle(), svc_content_info, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { media_content_sec_error("media_svc_insert_item_immediately_with_data failed : %d (%s)", ret, _media->file_path); media_svc_destroy_content_info(svc_content_info); @@ -3595,13 +3595,13 @@ int media_info_create(const char *path, media_info_h *media) SAFE_FREE(folder_path); media_content_retvm_if(ignore_dir == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path"); - ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { media_content_error("media_svc_get_storage_id failed : %d", ret); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); } - ret = media_svc_get_storage_type(repl_path, &storage_type, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_get_storage_type(repl_path, &storage_type, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { media_content_sec_error("media_svc_get_storage_type failed : %d", ret); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); diff --git a/src/media_playlist.c b/src/media_playlist.c index 1e78fff..937d6d2 100755 --- a/src/media_playlist.c +++ b/src/media_playlist.c @@ -121,7 +121,7 @@ static int __media_playlist_insert_item_to_playlist(int playlist_id, const char query_str = sqlite3_mprintf("INSERT INTO %q (playlist_id, media_uuid, play_order) values (%d, '%q', %d);", DB_TABLE_PLAYLIST_MAP, playlist_id, media_id, play_order); - ret = media_svc_append_query(query_str, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_append_query(query_str, _content_get_uid()); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); } @@ -132,7 +132,7 @@ static int __media_playlist_remove_item_from_playlist(int playlist_id, int playl char *query_str = NULL; query_str = sqlite3_mprintf(REMOVE_PLAYLIST_ITEM_FROM_PLAYLIST_MAP, playlist_id, playlist_member_id); - ret = media_svc_append_query(query_str, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_append_query(query_str, _content_get_uid()); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); } @@ -143,7 +143,7 @@ static int __media_playlist_update_playlist_name(int playlist_id, const char *pl char *query_str = NULL; query_str = sqlite3_mprintf(UPDATE_PLAYLIST_NAME_FROM_PLAYLIST, playlist_name, playlist_id); - ret = media_svc_append_query(query_str, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_append_query(query_str, _content_get_uid()); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); } @@ -154,7 +154,7 @@ static int __media_playlist_update_thumbnail_path(int playlist_id, const char *p char *query_str = NULL; query_str = sqlite3_mprintf(UPDATE_PLAYLIST_THUMBNAIL_FROM_PLAYLIST, path, playlist_id); - ret = media_svc_append_query(query_str, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_append_query(query_str, _content_get_uid()); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); } @@ -165,7 +165,7 @@ static int __media_playlist_update_play_order(int playlist_id, int playlist_memb char *query_str = NULL; query_str = sqlite3_mprintf(UPDATE_PLAYLIST_ORDER_FROM_PLAYLIST_MAP, play_order, playlist_id, playlist_member_id); - ret = media_svc_append_query(query_str, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_append_query(query_str, _content_get_uid()); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); } @@ -821,7 +821,7 @@ int media_playlist_update_to_db(media_playlist_h playlist) } } } - ret = media_svc_send_query(tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_send_query(_content_get_uid()); __media_playlist_item_release(_playlist); diff --git a/src/media_tag.c b/src/media_tag.c index e5915e3..3a1dc94 100755 --- a/src/media_tag.c +++ b/src/media_tag.c @@ -59,7 +59,7 @@ static int __media_tag_insert_item_to_tag(int tag_id, const char *media_id) char *query_str = NULL; query_str = sqlite3_mprintf("INSERT INTO %q (tag_id, media_uuid) values (%d, '%q');", DB_TABLE_TAG_MAP, tag_id, media_id); - ret = media_svc_append_query(query_str, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_append_query(query_str, _content_get_uid()); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); } @@ -70,7 +70,7 @@ static int __media_tag_remove_item_from_tag(int tag_id, const char *media_id) char *query_str = NULL; query_str = sqlite3_mprintf(REMOVE_TAG_ITEM_FROM_TAG_MAP, tag_id, media_id); - ret = media_svc_append_query(query_str, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_append_query(query_str, _content_get_uid()); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); } @@ -81,7 +81,7 @@ static int __media_tag_update_tag_name(int tag_id, const char *tag_name) char *query_str = NULL; query_str = sqlite3_mprintf(UPDATE_TAG_NAME_FROM_TAG, tag_name, tag_id); - ret = media_svc_append_query(query_str, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_append_query(query_str, _content_get_uid()); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); } @@ -482,7 +482,7 @@ int media_tag_update_to_db(media_tag_h tag) } } - ret = media_svc_send_query(tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_send_query(_content_get_uid()); __media_tag_item_release(_tag); diff --git a/src/media_util_private.c b/src/media_util_private.c index e77a99f..f52f1e7 100755 --- a/src/media_util_private.c +++ b/src/media_util_private.c @@ -79,7 +79,7 @@ int _media_util_check_ignore_dir(const char *dir_path, bool *ignore) } /*2. Check Scan Ignore Directory*/ - ret = media_svc_get_storage_type(dir_path, &storage_type, tzplatform_getuid(TZ_USER_NAME)); + ret = media_svc_get_storage_type(dir_path, &storage_type, _content_get_uid()); if (ret != MS_MEDIA_ERR_NONE) { media_content_error("media_svc_get_storage_type failed : %d", ret); return _content_error_capi(MEDIA_CONTENT_TYPE, ret); -- 2.7.4