From 90070856214ed5798dcbbf8caaf3af7365b65a71 Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Tue, 2 Feb 2016 14:43:47 +0900 Subject: [PATCH] Add parameter for update metadata Change-Id: I71c318c3a7eb2762db51de12a57b20c1fef550ff Signed-off-by: Minje Ahn --- include/media-svc.h | 2 +- plugin/media-content-plugin.c | 9 +++++++-- src/common/media-svc.c | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/media-svc.h b/include/media-svc.h index bf31747..14f1f73 100755 --- a/include/media-svc.h +++ b/include/media-svc.h @@ -69,7 +69,7 @@ int media_svc_get_pinyin(const char *src_str, char **pinyin_str); int media_svc_check_pinyin_support(bool *support); int media_svc_update_item_begin(int data_cnt); int media_svc_update_item_end(uid_t uid); -int media_svc_update_item_meta(MediaSvcHandle *handle, const char *file_path, int storage_type, uid_t uid); +int media_svc_update_item_meta(MediaSvcHandle *handle, const char *file_path, const char *storage_id, int storage_type, uid_t uid); int media_svc_insert_item_immediately_with_data(MediaSvcHandle *handle, media_svc_content_info_s *content_info, uid_t uid); void media_svc_destroy_content_info(media_svc_content_info_s *content_info); diff --git a/plugin/media-content-plugin.c b/plugin/media-content-plugin.c index 4d31135..33446e8 100755 --- a/plugin/media-content-plugin.c +++ b/plugin/media-content-plugin.c @@ -841,7 +841,7 @@ int update_item_end(void *handle, uid_t uid, char **err_msg) return MEDIA_SVC_PLUGIN_ERROR_NONE; } -int update_item_meta(void *handle, const char *file_path, int storage_type, uid_t uid, char **err_msg) +int update_item_meta(void *handle, const char *file_path, const char *storage_id, int storage_type, uid_t uid, char **err_msg) { int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; @@ -855,7 +855,12 @@ int update_item_meta(void *handle, const char *file_path, int storage_type, uid_ return MEDIA_SVC_PLUGIN_ERROR; } - ret = media_svc_update_item_meta(handle, file_path, storage_type, uid); + if (storage_id == NULL) { + __set_error_message(ERR_HANDLE, err_msg); + return MEDIA_SVC_PLUGIN_ERROR; + } + + ret = media_svc_update_item_meta(handle, file_path, storage_id, storage_type, uid); if (ret < 0) { __set_error_message(ret, err_msg); return MEDIA_SVC_PLUGIN_ERROR; diff --git a/src/common/media-svc.c b/src/common/media-svc.c index e6a1ee6..0b29fac 100755 --- a/src/common/media-svc.c +++ b/src/common/media-svc.c @@ -1306,7 +1306,7 @@ int media_svc_update_item_end(uid_t uid) return ret; } -int media_svc_update_item_meta(MediaSvcHandle *handle, const char *file_path, int storage_type, uid_t uid) +int media_svc_update_item_meta(MediaSvcHandle *handle, const char *file_path, const char *storage_id, int storage_type, uid_t uid) { int ret = MS_MEDIA_ERR_NONE; sqlite3 *db_handle = (sqlite3 *)handle; @@ -1321,7 +1321,7 @@ int media_svc_update_item_meta(MediaSvcHandle *handle, const char *file_path, in memset(&content_info, 0, sizeof(media_svc_content_info_s)); /*Set media info*/ - ret = _media_svc_set_media_info(&content_info, DEFAULT_MEDIA_SVC_STORAGE_ID, storage_type, file_path, &media_type, FALSE); + ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, file_path, &media_type, FALSE); if (ret != MS_MEDIA_ERR_NONE) { return ret; } -- 2.7.4