Remove unused product API
[platform/core/api/media-content.git] / src / media_info.c
index 47b6a4d..f9d7ce5 100644 (file)
 */
 
 #include <media_info.h>
-#include <media-thumbnail.h>
-#include <media-util-dcm.h>
 #include <media_info_private.h>
 #include <media_util_private.h>
 #include <system_info.h>
 
 static void __media_info_insert_completed_cb(media_request_result_s *result, void *user_data);
-static void __media_info_thumbnail_completed_cb(int error, const char *path, void *user_data);
-static void __media_info_face_completed_cb(int error, const int face_count, void *user_data);
 static int __media_info_insert_batch(const char **path_array, unsigned int array_length, media_insert_completed_cb completed_cb, void *user_data);
 static int __media_info_check_file_validity(const char *path);
 
-static int __media_info_get_media_path_by_id_from_db(const char *media_id, char **path)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       sqlite3_stmt *stmt = NULL;
-       char *select_query = NULL;
-
-       content_retip_if_fail(STRING_VALID(media_id));
-
-       select_query = sqlite3_mprintf(SELECT_MEDIA_PATH_BY_ID, media_id);
-
-       ret = _content_get_result(select_query, &stmt);
-       SQLITE3_SAFE_FREE(select_query);
-       content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
-       if (sqlite3_step(stmt) == SQLITE_ROW) {
-               *path = g_strdup((const char *)sqlite3_column_text(stmt, 0));
-       } else {
-               content_error("There's no media with this ID : %s", media_id);
-               *path = NULL;
-               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
-       }
-
-       SQLITE3_FINALIZE(stmt);
-
-       return ret;
-}
-
 static void __media_info_insert_completed_cb(media_request_result_s *result, void *user_data)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -79,38 +48,8 @@ static void __media_info_insert_completed_cb(media_request_result_s *result, voi
 
        return;
 }
-
-static void __media_info_thumbnail_completed_cb(int error, const char *path, void *user_data)
-{
-       int error_value = MEDIA_CONTENT_ERROR_NONE;
-
-       media_thumbnail_cb_s *_thumb_cb = (media_thumbnail_cb_s *)user_data;
-       media_info_s *media = NULL;
-
-       if (_thumb_cb != NULL) {
-               media = _thumb_cb->handle;
-
-               if (media != NULL) {
-                       g_free(media->thumbnail_path);
-
-                       if (STRING_VALID(path))
-                               media->thumbnail_path = g_strdup(path);
-                       else
-                               media->thumbnail_path = g_strdup(MEDIA_CONTENT_EMPTY_STRING);
-               }
-
-               content_debug("error [%d], thumbnail_path [%s]", error, path);
-               error_value = _content_error_capi(error);
-               if (_thumb_cb->thumbnail_completed_cb)
-                       _thumb_cb->thumbnail_completed_cb(error_value, path, _thumb_cb->user_data);
-       }
-
-       g_free(_thumb_cb);
-
-       return;
-}
-
-static bool __media_info_isFaceRecognition_feature_supported()
+// LCOV_EXCL_START
+static bool __media_info_isFaceRecognition_feature_supported(void)
 {
        bool isFaceRecognitionSupported = false;
 
@@ -124,24 +63,7 @@ static bool __media_info_isFaceRecognition_feature_supported()
        return isFaceRecognitionSupported;
 }
 
-static void __media_info_face_completed_cb(int error, const int face_count, void *user_data)
-{
-       int error_value = MEDIA_CONTENT_ERROR_NONE;
-
-       media_face_cb_s *_face_cb = (media_face_cb_s *)user_data;
-
-       if (_face_cb != NULL) {
-               content_debug("error [%d], face_count [%d]", error, face_count);
-               error_value = _content_error_capi(error);
-               if (_face_cb->face_completed_cb)
-                       _face_cb->face_completed_cb(error_value, face_count, _face_cb->user_data);
-       }
-
-       g_free(_face_cb);
-
-       return;
-}
-
+// LCOV_EXCL_STOP
 static int __media_info_insert_batch(const char **path_array,
                                        unsigned int array_length,
                                        media_insert_completed_cb completed_cb,
@@ -149,15 +71,15 @@ static int __media_info_insert_batch(const char **path_array,
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        FILE *fp = NULL;
-       char list_path[255] = {0, };
+       char list_path[BATCH_REQUEST_FILE_LEN] = {0, };
        unsigned int idx = 0;
        int nwrites = 0;
 
        for (idx = 0; idx < BATCH_REQUEST_MAX; idx++) {
-               snprintf(list_path, sizeof(list_path), "%s/request-%ld-%d", MEDIA_CONTENT_INSERT_FILES_PATH, media_content_gettid(), idx);
+               snprintf(list_path, BATCH_REQUEST_FILE_LEN, "%s/request-%ld-%d", MEDIA_CONTENT_INSERT_FILES_PATH, media_content_gettid(), idx);
 
-               if (g_file_test(list_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
-                       memset(list_path, 0x00, sizeof(list_path));
+               if (g_file_test(list_path, G_FILE_TEST_EXISTS)) {
+                       memset(list_path, 0x00, BATCH_REQUEST_FILE_LEN);
                        continue;
                } else {
                        content_sec_debug("The request file list path : %s", list_path);
@@ -231,6 +153,7 @@ static int __media_info_insert_batch(const char **path_array,
                content_error("media_files_register failed : %d", ret);
                if (unlink(list_path) < 0)
                        content_stderror("failed to delete");
+               g_free(_cb_data);
                return _content_error_capi(ret);
        }
 
@@ -278,7 +201,6 @@ void _media_info_item_get_detail(sqlite3_stmt* stmt, media_info_h media)
        _media->rating = (int)sqlite3_column_int(stmt, MEDIA_INFO_RATING);
        _media->favourite = (int)sqlite3_column_int(stmt, MEDIA_INFO_FAVOURITE);
        _media->is_drm = (int)sqlite3_column_int(stmt, MEDIA_INFO_IS_DRM);
-       _media->storage_type = (int)sqlite3_column_int(stmt, MEDIA_INFO_STORAGE_TYPE);
        _media->longitude = (double)sqlite3_column_double(stmt, MEDIA_INFO_LONGITUDE);
        _media->latitude = (double)sqlite3_column_double(stmt, MEDIA_INFO_LATITUDE);
        _media->altitude = (double)sqlite3_column_double(stmt, MEDIA_INFO_ALTITUDE);
@@ -343,7 +265,13 @@ void _media_info_item_get_detail(sqlite3_stmt* stmt, media_info_h media)
                _media->audio_meta->duration = sqlite3_column_int(stmt, MEDIA_INFO_DURATION);
                _media->audio_meta->samplerate = sqlite3_column_int(stmt, MEDIA_INFO_SAMPLERATE);
                _media->audio_meta->channel = sqlite3_column_int(stmt, MEDIA_INFO_CHANNEL);
+       } else if (_media->media_type == MEDIA_CONTENT_TYPE_BOOK) {
+               _media->book_meta = g_new0(book_meta_s, 1);
 
+               _media->book_meta->subject = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_GENRE));
+               _media->book_meta->author = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_ARTIST));
+               _media->book_meta->date = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_RECORDED_DATE));
+               _media->book_meta->publisher = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_COPYRIGHT));
        }
 }
 #ifdef _USE_TVPD_MODE
@@ -406,60 +334,49 @@ int _media_info_get_media_info_from_db(const char *path, media_info_h media)
 int media_info_insert_to_db(const char *path, media_info_h *info)
 {
        char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
-       char repl_path[MAX_PATH_LEN] = {0, };
        int ret = MEDIA_CONTENT_ERROR_NONE;
-       ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
        int modified_time = 0;
 
        content_retip_if_fail(STRING_VALID(path));
        content_retip_if_fail(info);
 
-       ret = _media_content_replace_path(path, repl_path);
-       content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
-
-       ret = __media_info_check_file_validity(repl_path);
+       ret = __media_info_check_file_validity(path);
        content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
 
-       ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id, _content_get_uid());
+       ret = media_svc_get_storage_id(_content_get_db_handle(), path, storage_id, _content_get_uid());
        if (ret != MS_MEDIA_ERR_NONE) {
                content_error("media_svc_get_storage_id failed : %d", ret);
                return _content_error_capi(ret);
        }
 
-       ret = ms_user_get_storage_type(_content_get_uid(), repl_path, &storage_type);
-       if (ret != MS_MEDIA_ERR_NONE) {
-               content_sec_error("ms_user_get_storage_type failed : %d", ret);
-               return _content_error_capi(ret);
-       }
-
        /* Get modified time for check exists */
-       ret = media_svc_get_modified_time(_content_get_db_handle(), storage_id, repl_path, &modified_time);
+       ret = media_svc_get_modified_time(_content_get_db_handle(), storage_id, path, &modified_time);
        if (ret == MS_MEDIA_ERR_NONE) {
                /* Refresh if need */
-               if (modified_time != _media_util_get_file_time(repl_path)) {
-                       ret = media_svc_refresh_item(_content_get_db_handle(), false, storage_id, storage_type, repl_path, _content_get_uid());
+               if (modified_time != _media_util_get_file_time(path)) {
+                       ret = media_svc_refresh_item(_content_get_db_handle(), false, storage_id, path, _content_get_uid());
                        if (ret != MS_MEDIA_ERR_NONE) {
                                content_error("media_svc_refresh_item failed : %d", ret);
                                return _content_error_capi(ret);
                        }
                }
        } else if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
-               content_sec_debug("media_svc_check_item_exist_by_path : no record : %s", repl_path);
-               content_retvm_if(!_media_util_check_support_media_type(repl_path), MEDIA_CONTENT_ERROR_NOT_SUPPORTED, "Unsupported media type");
+               content_sec_debug("media_svc_check_item_exist_by_path : no record : %s", path);
+               content_retvm_if(!_media_util_check_support_media_type(path), MEDIA_CONTENT_ERROR_NOT_SUPPORTED, "Unsupported media type");
 
-               ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_id, storage_type, repl_path, _content_get_uid());
+               ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_id, path, _content_get_uid());
                if (ret != MS_MEDIA_ERR_NONE) {
                        if (ret == MS_MEDIA_ERR_DB_CONSTRAINT_FAIL) {
-                               content_sec_error("This item is already inserted. This may be normal operation because other process already did this (%s)", repl_path);
+                               content_sec_error("This item is already inserted. This may be normal operation because other process already did this (%s)", path);
                                ret = MEDIA_CONTENT_ERROR_NONE;
                        } else {
-                               content_sec_error("media_svc_insert_item_immediately failed : %d (%s)", ret, repl_path);
+                               content_sec_error("media_svc_insert_item_immediately failed : %d (%s)", ret, path);
                        }
 
                        return _content_error_capi(ret);
                }
        } else {
-               content_sec_error("media_svc_get_modified_time failed : %d (%s)", ret, repl_path);
+               content_sec_error("media_svc_get_modified_time failed : %d (%s)", ret, path);
                return _content_error_capi(ret);
        }
 
@@ -467,13 +384,13 @@ int media_info_insert_to_db(const char *path, media_info_h *info)
 
 #ifdef _USE_TVPD_MODE
        if (STRING_VALID(storage_id))
-               ret = _media_info_get_media_info_from_db(repl_path, storage_id, (media_info_h)_media);
+               ret = _media_info_get_media_info_from_db(path, storage_id, (media_info_h)_media);
        else
-               ret = _media_info_get_media_info_from_db(repl_path, DB_TABLE_MEDIA, (media_info_h)_media);
+               ret = _media_info_get_media_info_from_db(path, DB_TABLE_MEDIA, (media_info_h)_media);
 
        *info = (media_info_h)_media;
 #else
-       ret = _media_info_get_media_info_from_db(repl_path, (media_info_h)_media);
+       ret = _media_info_get_media_info_from_db(path, (media_info_h)_media);
 
        *info = (media_info_h)_media;
 #endif
@@ -482,35 +399,13 @@ int media_info_insert_to_db(const char *path, media_info_h *info)
 
 int media_info_insert_batch_to_db(const char **path_array, unsigned int array_length, media_insert_completed_cb completed_cb, void *user_data)
 {
-       char **repl_path_array = NULL;
-       int idx = 0;
-       int ret = MS_MEDIA_ERR_NONE;
-       char repl_path[MAX_PATH_LEN] = {0, };
-
        content_retip_if_fail(path_array);
        content_retip_if_fail(array_length > 0);
        content_retip_if_fail(completed_cb);
 
-       repl_path_array = g_malloc0(sizeof(char *) * array_length);
-
-       for (idx = 0; idx < array_length; idx++) {
-               if (STRING_VALID(path_array[idx])) {
-                       memset(repl_path, 0, sizeof(repl_path));
-                       _media_content_replace_path(path_array[idx], repl_path);
-                       repl_path_array[idx] = g_strndup(repl_path, strlen(repl_path));
-               } else {
-                       content_error("path[%d] is invalid string", idx);
-               }
-       }
-
-       ret = __media_info_insert_batch((const char **)repl_path_array, array_length, completed_cb, user_data);
-       for (idx = 0; idx < array_length; idx++)
-               g_free(repl_path_array[idx]);
-
-       g_free(repl_path_array);
-
-       return ret;
+       return __media_info_insert_batch(path_array, array_length, completed_cb, user_data);
 }
+
 #ifdef _USE_TVPD_MODE
 int media_info_get_media_info_by_path_from_db(const char* path, media_info_h* media)
 {
@@ -533,14 +428,39 @@ int media_info_get_media_info_by_path_from_db(const char* path, media_info_h* me
 
        return ret;
 }
-#endif
+
+static int __media_info_get_media_path_by_id_from_db(const char *media_id, char **path)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       sqlite3_stmt *stmt = NULL;
+       char *select_query = NULL;
+
+       content_retip_if_fail(STRING_VALID(media_id));
+
+       select_query = sqlite3_mprintf(SELECT_MEDIA_PATH_BY_ID, media_id);
+
+       ret = _content_get_result(select_query, &stmt);
+       SQLITE3_SAFE_FREE(select_query);
+       content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
+
+       if (sqlite3_step(stmt) == SQLITE_ROW) {
+               *path = g_strdup((const char *)sqlite3_column_text(stmt, 0));
+       } else {
+               content_error("There's no media with this ID : %s", media_id);
+               *path = NULL;
+               ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+       }
+
+       SQLITE3_FINALIZE(stmt);
+
+       return ret;
+}
 
 int media_info_delete_from_db(const char *media_id)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        char *path = NULL;
        char *storage_id = NULL;
-       content_warn("DEPRECATION WARNING: media_info_delete_from_db() is deprecated and will be removed from next release. Use media_content_scan_file() instead.");
 
        content_retip_if_fail(STRING_VALID(media_id));
 
@@ -564,6 +484,7 @@ int media_info_delete_from_db(const char *media_id)
 
        return _content_error_capi(ret);
 }
+#endif
 
 int media_info_destroy(media_info_h media)
 {
@@ -622,6 +543,16 @@ int media_info_destroy(media_info_h media)
                g_free(_media->audio_meta);
        }
 
+       if (_media->book_meta) {
+               g_free(_media->book_meta->media_id);
+               g_free(_media->book_meta->author);
+               g_free(_media->book_meta->date);
+               g_free(_media->book_meta->publisher);
+               g_free(_media->book_meta->subject);
+
+               g_free(_media->book_meta);
+       }
+
        g_free(_media);
 
        return MEDIA_CONTENT_ERROR_NONE;
@@ -658,7 +589,6 @@ int media_info_clone(media_info_h *dst, media_info_h src)
        _dst->rating = _src->rating;
        _dst->favourite = _src->favourite;
        _dst->is_drm = _src->is_drm;
-       _dst->storage_type = _src->storage_type;
        _dst->request_id = _src->request_id;
        _dst->face_request_id = _src->face_request_id;
        _dst->is_360 = _src->is_360;
@@ -720,6 +650,14 @@ int media_info_clone(media_info_h *dst, media_info_h src)
                _dst->audio_meta->duration = _src->audio_meta->duration;
                _dst->audio_meta->bitrate = _src->audio_meta->bitrate;
                _dst->audio_meta->bitpersample = _src->audio_meta->bitpersample;
+       } else if (_src->media_type == MEDIA_CONTENT_TYPE_BOOK && _src->book_meta) {
+               _dst->book_meta = g_new0(book_meta_s, 1);
+
+               _dst->book_meta->media_id = g_strdup(_src->book_meta->media_id);
+               _dst->book_meta->author = g_strdup(_src->book_meta->author);
+               _dst->book_meta->date = g_strdup(_src->book_meta->date);
+               _dst->book_meta->publisher = g_strdup(_src->book_meta->publisher);
+               _dst->book_meta->subject = g_strdup(_src->book_meta->subject);
        }
 
        *dst = (media_info_h)_dst;
@@ -740,9 +678,10 @@ int media_info_foreach_media_from_db(filter_h filter, media_info_cb callback, vo
 
        return _media_db_get_group_item(NULL, filter, callback, user_data, MEDIA_GROUP_NONE);
 }
-
+// LCOV_EXCL_START
 int media_info_get_tag_count_from_db(const char *media_id, filter_h filter, int *tag_count)
 {
+       content_warn("DEPRECATION WARNING: media_info_get_tag_count_from_db() is deprecated and will be removed from next release.");
        content_retip_if_fail(STRING_VALID(media_id));
        content_retip_if_fail(tag_count);
 
@@ -751,12 +690,13 @@ int media_info_get_tag_count_from_db(const char *media_id, filter_h filter, int
 
 int media_info_foreach_tag_from_db(const char *media_id, filter_h filter, media_tag_cb callback, void *user_data)
 {
+       content_warn("DEPRECATION WARNING: media_info_foreach_tag_from_db() is deprecated and will be removed from next release.");
        content_retip_if_fail(STRING_VALID(media_id));
        content_retip_if_fail(callback);
 
        return _media_db_get_tag(media_id, filter, callback, user_data);
 }
-
+// LCOV_EXCL_STOP
 int media_info_get_bookmark_count_from_db(const char *media_id, filter_h filter, int *bookmark_count)
 {
        content_retip_if_fail(STRING_VALID(media_id));
@@ -772,9 +712,10 @@ int media_info_foreach_bookmark_from_db(const char *media_id, filter_h filter, m
 
        return _media_db_get_bookmark(media_id, filter, callback, user_data);
 }
-
+// LCOV_EXCL_START
 int media_info_get_face_count_from_db(const char *media_id, filter_h filter, int *face_count)
 {
+       content_warn("DEPRECATION WARNING: media_info_get_face_count_from_db() is deprecated and will be removed from next release.");
        content_retip_if_fail(STRING_VALID(media_id));
        content_retip_if_fail(face_count);
 
@@ -783,12 +724,13 @@ int media_info_get_face_count_from_db(const char *media_id, filter_h filter, int
 
 int media_info_foreach_face_from_db(const char *media_id, filter_h filter, media_face_cb callback, void *user_data)
 {
+       content_warn("DEPRECATION WARNING: media_info_foreach_face_from_db() is deprecated and will be removed from next release.");
        content_retip_if_fail(STRING_VALID(media_id));
        content_retip_if_fail(callback);
 
        return _media_db_get_face(media_id, filter, callback, user_data);
 }
-
+// LCOV_EXCL_STOP
 int media_info_get_image(media_info_h media, image_meta_h *image)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -819,6 +761,7 @@ int media_info_get_image(media_info_h media, image_meta_h *image)
 
 int media_info_get_video(media_info_h media, video_meta_h *video)
 {
+       content_warn("DEPRECATION WARNING: media_info_get_video() is deprecated and will be removed from next release.");
        int ret = MEDIA_CONTENT_ERROR_NONE;
 
        media_info_s *_media = (media_info_s*)media;
@@ -887,6 +830,29 @@ int media_info_get_audio(media_info_h media, audio_meta_h *audio)
        return ret;
 }
 
+int media_info_get_book(media_info_h media, book_meta_h *book)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+
+       media_info_s *_media = (media_info_s*)media;
+
+       content_retip_if_fail(media);
+       content_retip_if_fail(_media->media_type == MEDIA_CONTENT_TYPE_BOOK);
+       content_retip_if_fail(book);
+
+       book_meta_s *_book = g_new0(book_meta_s, 1);
+
+       _book->media_id = g_strdup(_media->media_id);
+       _book->author = g_strdup(_media->book_meta->author);
+       _book->publisher = g_strdup(_media->book_meta->publisher);
+       _book->date = g_strdup(_media->book_meta->date);
+       _book->subject = g_strdup(_media->book_meta->subject);
+
+       *book = (book_meta_h)_book;
+
+       return ret;
+}
+
 int media_info_get_media_id(media_info_h media, char **media_id)
 {
        media_info_s *_media = (media_info_s*)media;
@@ -982,9 +948,10 @@ int media_info_get_modified_time(media_info_h media, time_t* time)
 
        return MEDIA_CONTENT_ERROR_NONE;
 }
-
+// LCOV_EXCL_START
 int media_info_get_timeline(media_info_h media, time_t* time)
 {
+       content_warn("DEPRECATION WARNING: media_info_get_timeline() is deprecated and will be removed from next release.");
        media_info_s *_media = (media_info_s*)media;
 
        content_retip_if_fail(media);
@@ -994,7 +961,7 @@ int media_info_get_timeline(media_info_h media, time_t* time)
 
        return MEDIA_CONTENT_ERROR_NONE;
 }
-
+// LCOV_EXCL_STOP
 int media_info_get_thumbnail_path(media_info_h media, char **path)
 {
        media_info_s *_media = (media_info_s*)media;
@@ -1018,9 +985,10 @@ int media_info_get_title(media_info_h media, char **title)
 
        return MEDIA_CONTENT_ERROR_NONE;
 }
-
+// LCOV_EXCL_START
 int media_info_get_description(media_info_h media, char **description)
 {
+       content_warn("DEPRECATION WARNING: media_info_get_description() is deprecated and will be removed from next release.");
        media_info_s *_media = (media_info_s*)media;
 
        content_retip_if_fail(media);
@@ -1033,6 +1001,7 @@ int media_info_get_description(media_info_h media, char **description)
 
 int media_info_get_longitude(media_info_h media, double* longitude)
 {
+       content_warn("DEPRECATION WARNING: media_info_get_longitude() is deprecated and will be removed from next release.");
        media_info_s *_media = (media_info_s*)media;
 
        content_retip_if_fail(media);
@@ -1044,6 +1013,7 @@ int media_info_get_longitude(media_info_h media, double* longitude)
 }
 int media_info_get_latitude(media_info_h media, double* latitude)
 {
+       content_warn("DEPRECATION WARNING: media_info_get_latitude() is deprecated and will be removed from next release.");
        media_info_s *_media = (media_info_s*)media;
 
        content_retip_if_fail(media);
@@ -1056,6 +1026,7 @@ int media_info_get_latitude(media_info_h media, double* latitude)
 
 int media_info_get_altitude(media_info_h media, double *altitude)
 {
+       content_warn("DEPRECATION WARNING: media_info_get_altitude() is deprecated and will be removed from next release.");
        media_info_s *_media = (media_info_s*)media;
 
        content_retip_if_fail(media);
@@ -1068,6 +1039,7 @@ int media_info_get_altitude(media_info_h media, double *altitude)
 
 int media_info_get_rating(media_info_h media, int *rating)
 {
+       content_warn("DEPRECATION WARNING: media_info_get_rating() is deprecated and will be removed from next release.");
        media_info_s *_media = (media_info_s*)media;
 
        content_retip_if_fail(media);
@@ -1080,6 +1052,7 @@ int media_info_get_rating(media_info_h media, int *rating)
 
 int media_info_get_favorite(media_info_h media, bool* favorite)
 {
+       content_warn("DEPRECATION WARNING: media_info_get_favorite() is deprecated and will be removed from next release.");
        media_info_s *_media = (media_info_s*)media;
 
        content_retip_if_fail(media);
@@ -1090,21 +1063,9 @@ int media_info_get_favorite(media_info_h media, bool* favorite)
        return MEDIA_CONTENT_ERROR_NONE;
 }
 
-int media_info_get_storage_id(media_info_h media, char **storage_id)
-{
-       content_warn("DEPRECATION WARNING: media_info_get_storage_id() is deprecated and will be removed from next release.");
-       media_info_s *_media = (media_info_s*)media;
-
-       content_retip_if_fail(media);
-       content_retip_if_fail(storage_id);
-
-       *storage_id = g_strdup(_media->storage_uuid);
-
-       return MEDIA_CONTENT_ERROR_NONE;
-}
-
 int media_info_is_drm(media_info_h media, bool *is_drm)
 {
+       content_warn("DEPRECATION WARNING: media_info_is_drm() is deprecated and will be removed from next release.");
        media_info_s *_media = (media_info_s*)media;
 
        content_retip_if_fail(media);
@@ -1117,6 +1078,7 @@ int media_info_is_drm(media_info_h media, bool *is_drm)
 
 int media_info_is_360_content(media_info_h media, bool *is_360)
 {
+       content_warn("DEPRECATION WARNING: media_info_is_360_content() is deprecated and will be removed from next release.");
        media_info_s *_media = (media_info_s*)media;
 
        content_retip_if_fail(media);
@@ -1126,20 +1088,7 @@ int media_info_is_360_content(media_info_h media, bool *is_360)
 
        return MEDIA_CONTENT_ERROR_NONE;
 }
-
-int media_info_get_storage_type(media_info_h media, media_content_storage_e *storage_type)
-{
-       content_warn("DEPRECATION WARNING: media_info_get_storage_type() is deprecated and will be removed from next release. Use storage_get_type_dev() instead.");
-       media_info_s *_media = (media_info_s*)media;
-
-       content_retip_if_fail(media);
-       content_retip_if_fail(storage_type);
-
-       *storage_type = _media->storage_type;
-
-       return MEDIA_CONTENT_ERROR_NONE;
-}
-
+// LCOV_EXCL_STOP
 #ifdef _USE_TVPD_MODE
 int media_info_get_played_count(media_info_h media, int *played_count)
 {
@@ -1238,18 +1187,6 @@ int media_info_get_stitched_state(media_info_h media, int *stitched_info)
        return MEDIA_CONTENT_ERROR_NONE;
 }
 
-int media_info_get_stitched_engine(media_info_h media, int *stitched_info)
-{
-       media_info_s *_media = (media_info_s*)media;
-
-       content_retip_if_fail(media);
-       content_retip_if_fail(stitched_info);
-
-       *stitched_info = _media->stitched_info & 0x0000FFFF;
-
-       return MEDIA_CONTENT_ERROR_NONE;
-}
-
 int media_info_get_modified_month(media_info_h media, char **modified_month)
 {
        media_info_s *_media = (media_info_s*)media;
@@ -1278,10 +1215,10 @@ int media_info_get_media_from_db(const char *media_id, media_info_h *media)
 
        ret = _media_db_get_storage_id_by_media_id(media_id, &storage_id);
        content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-       snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_MEDIA, storage_id, media_id);
+       snprintf(select_query, DEFAULT_QUERY_SIZE, SELECT_MEDIA_FROM_MEDIA, storage_id, media_id);
        g_free(storage_id);
 #else
-       snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_MEDIA, media_id);
+       snprintf(select_query, DEFAULT_QUERY_SIZE, SELECT_MEDIA_FROM_MEDIA, media_id);
 #endif
        ret = _content_get_result(select_query, &stmt);
        content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
@@ -1303,8 +1240,46 @@ int media_info_get_media_from_db(const char *media_id, media_info_h *media)
        return ret;
 }
 
+int media_info_get_media_from_db_by_path(const char *path, media_info_h *media)
+{
+       int ret = MEDIA_CONTENT_ERROR_NONE;
+       media_info_s *_media = NULL;
+
+       content_retip_if_fail(STRING_VALID(path));
+       content_retip_if_fail(media);
+       ret = _media_util_check_file_exist(path);
+       content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "_media_util_check_file_exist failed : %d", ret);
+
+#ifdef _USE_TVPD_MODE
+       char storage_id[MEDIA_CONTENT_UUID_SIZE + 1] = {0, };
+
+       ret = media_svc_get_storage_id(_content_get_db_handle(), path, storage_id, _content_get_uid());
+       if (ret != MS_MEDIA_ERR_NONE) {
+               content_error("media_svc_get_storage_id failed : %d", ret);
+               return _content_error_capi(ret);
+       }
+#endif
+
+       _media = g_new0(media_info_s, 1);
+
+#ifdef _USE_TVPD_MODE
+       ret = _media_info_get_media_info_from_db(path, STRING_VALID(storage_id) ? storage_id : DB_TABLE_MEDIA, (media_info_h)_media);
+#else
+       ret = _media_info_get_media_info_from_db(path, (media_info_h)_media);
+#endif
+       if (ret != MEDIA_CONTENT_ERROR_NONE) {
+               g_free(_media);
+               _media = NULL;
+       }
+
+       *media = (media_info_h)_media;
+
+       return ret;
+}
+// LCOV_EXCL_START
 int media_info_set_favorite(media_info_h media, bool favorite)
 {
+       content_warn("DEPRECATION WARNING: media_info_set_favorite() is deprecated and will be removed from next release.");
        media_info_s *_media = (media_info_s*)media;
 
        content_retip_if_fail(media);
@@ -1319,67 +1294,39 @@ int media_info_set_favorite(media_info_h media, bool favorite)
 
 int media_info_update_to_db(media_info_h media)
 {
+       content_warn("DEPRECATION WARNING: media_info_update_to_db() is deprecated and will be removed from next release.");
        int ret = MEDIA_CONTENT_ERROR_NONE;
        media_info_s *_media = (media_info_s*)media;
-       char *set_sql = NULL;
        char *sql = NULL;
 
        content_retip_if_fail(media);
        content_retip_if_fail(STRING_VALID(_media->media_id));
 
-       /* This sql is due to sqlite3_mprintf's wrong operation when using floating point in the text format */
-       /* This code will be removed when sqlite3_mprintf works clearly */
-       char *test_sql = sqlite3_mprintf("%f, %f, %f", _media->longitude, _media->latitude, _media->altitude);
-       SQLITE3_SAFE_FREE(test_sql);
-
-       /*Update Pinyin If Support Pinyin*/
-       char *file_name_pinyin = NULL;
-       char *description_pinyin = NULL;
-       bool pinyin_support = FALSE;
-
-       /*Update Pinyin If Support Pinyin*/
-       media_svc_check_pinyin_support(&pinyin_support);
-       if (pinyin_support) {
-               if (STRING_VALID(_media->display_name))
-                       media_svc_get_pinyin(_media->display_name, &file_name_pinyin);
-               if (STRING_VALID(_media->description))
-                       media_svc_get_pinyin(_media->description, &description_pinyin);
-       }
-#ifdef _USE_TVPD_MODE
-       set_sql = sqlite3_mprintf("media_display_name=%Q, media_description=%Q, media_longitude=%f, media_latitude=%f, media_file_name_pinyin=%Q, media_description_pinyin=%Q, played_count=%d, last_played_time=%d, last_played_position=%d, media_rating=%d, media_favourite=%d",
-                       _media->display_name, _media->description, _media->longitude, _media->latitude, file_name_pinyin, description_pinyin, _media->played_count, _media->played_time, _media->played_position, _media->rating, _media->favourite);
-#else
-       set_sql = sqlite3_mprintf("media_display_name=%Q, media_description=%Q, media_longitude=%f, media_latitude=%f, media_file_name_pinyin=%Q, media_description_pinyin=%Q, media_rating=%d, media_favourite=%d", _media->display_name, _media->description, _media->longitude, _media->latitude, file_name_pinyin, description_pinyin, _media->rating, _media->favourite);
-#endif
 #ifdef _USE_TVPD_MODE
-       sql = sqlite3_mprintf("UPDATE %Q SET %s WHERE media_id=%Q", _media->storage_uuid, set_sql, _media->media_id);
+       sql = sqlite3_mprintf("UPDATE %Q SET played_count=%d, last_played_time=%d, last_played_position=%d, media_favourite=%d WHERE media_id=%Q", _media->storage_uuid, _media->played_count, _media->played_time, _media->played_position, _media->favourite, _media->media_id);
 #else
-       sql = sqlite3_mprintf("UPDATE %q SET %s WHERE media_id=%Q", DB_TABLE_MEDIA, set_sql, _media->media_id);
+       sql = sqlite3_mprintf("UPDATE %q SET media_favourite=%d WHERE media_id=%Q", DB_TABLE_MEDIA, _media->favourite, _media->media_id);
 #endif
        ret = _content_query_sql(sql);
-       SQLITE3_SAFE_FREE(set_sql);
        SQLITE3_SAFE_FREE(sql);
 
-       SAFE_FREE(file_name_pinyin);
-       SAFE_FREE(description_pinyin);
-
        if (ret == MEDIA_CONTENT_ERROR_NONE) {
                /* Send notification for this update */
-               content_debug("Update is successfull. Send notification for this");
+               content_debug("Update is successful. Send notification for this");
                if (_media->file_path && _media->mime_type)
-                       media_svc_publish_noti(MS_MEDIA_ITEM_UPDATE, _media->file_path, _media->media_type, _media->media_id, _media->mime_type);
+                       media_svc_publish_update_noti(_media->file_path, _media->media_type, _media->media_id, _media->mime_type);
                else
                        content_error("Can't Send Noti : path or mime type is NULL");
        }
 
        return ret;
 }
-
+// LCOV_EXCL_STOP
 int media_info_move_to_db(media_info_h media, const char* dst_path)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
        char repl_path[MAX_PATH_LEN] = {0, };
-       media_info_s *_info = NULL;\r
+       media_info_s *_info = NULL;
 #ifdef _USE_TVPD_MODE
        char storage_id[MEDIA_CONTENT_UUID_SIZE + 1] = {0, };
 #endif
@@ -1387,17 +1334,16 @@ int media_info_move_to_db(media_info_h media, const char* dst_path)
        content_retip_if_fail(media);
        content_retip_if_fail(STRING_VALID(dst_path));
 
-       ret = _media_content_replace_path(dst_path, repl_path);
-       content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
-
        media_info_s *_media = (media_info_s*)media;
 
        /* If dst_path is folder, append file_name */
+       SAFE_STRLCPY(repl_path, dst_path, MAX_PATH_LEN);
+
        if (g_file_test(repl_path, G_FILE_TEST_IS_DIR)) {
                if (repl_path[strlen(repl_path) - 1] != '/')
-                       SAFE_STRLCAT(repl_path, "/", sizeof(repl_path));
+                       SAFE_STRLCAT(repl_path, "/", MAX_PATH_LEN);
 
-               SAFE_STRLCAT(repl_path, _media->display_name, sizeof(repl_path));
+               SAFE_STRLCAT(repl_path, _media->display_name, MAX_PATH_LEN);
        }
 
        /* If the two paths are the same, do nothing */
@@ -1426,7 +1372,6 @@ int media_info_move_to_db(media_info_h media, const char* dst_path)
        _media->display_name = g_strdup(_info->display_name);
        SAFE_FREE(_media->file_path);
        _media->file_path = g_strdup(_info->file_path);
-       _media->storage_type = _info->storage_type;
        SAFE_FREE(_media->storage_uuid);
        _media->storage_uuid = g_strdup(_info->storage_uuid);
        SAFE_FREE(_media->thumbnail_path);
@@ -1437,33 +1382,6 @@ int media_info_move_to_db(media_info_h media, const char* dst_path)
        return ret;
 }
 
-int media_info_create_thumbnail(media_info_h media, media_thumbnail_completed_cb callback, void *user_data)
-{
-       content_warn("DEPRECATION WARNING: media_info_create_thumbnail() is deprecated and will be removed from next release. Use media_info_generate_thumbnail() instead.");
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       static unsigned int req_id = 0;
-       media_info_s *_media = (media_info_s*)media;
-
-       content_retip_if_fail(media);
-       content_retip_if_fail(callback);
-       content_retip_if_fail(STRING_VALID(_media->media_id));
-       content_retip_if_fail(_media->file_path);
-
-       media_thumbnail_cb_s *_thumb_cb = g_new0(media_thumbnail_cb_s, 1);
-
-       req_id++;
-       _media->request_id = req_id;
-
-       _thumb_cb->handle = _media;
-       _thumb_cb->user_data = user_data;
-       _thumb_cb->thumbnail_completed_cb = callback;
-
-       ret = thumbnail_request_from_db_async(_media->request_id, _media->file_path, (ThumbFunc)__media_info_thumbnail_completed_cb, (void *)_thumb_cb, _content_get_uid());
-       ret = _content_error_capi(ret);
-
-       return ret;
-}
-
 int media_info_generate_thumbnail(media_info_h media)
 {
        int ret = MEDIA_CONTENT_ERROR_NONE;
@@ -1491,25 +1409,10 @@ int media_info_generate_thumbnail(media_info_h media)
 
        return ret;
 }
-
-int media_info_cancel_thumbnail(media_info_h media)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       content_warn("DEPRECATION WARNING: media_info_cancel_thumbnail() is deprecated and will be removed from next release.");
-       media_info_s *_media = (media_info_s*)media;
-
-       content_retip_if_fail(media);
-       content_retip_if_fail(STRING_VALID(_media->media_id));
-       content_retip_if_fail(_media->request_id > 0);
-
-       ret = thumbnail_request_cancel_media(_media->request_id);
-       return _content_error_capi(ret);
-}
-
+// LCOV_EXCL_START
 int media_info_start_face_detection(media_info_h media, media_face_detection_completed_cb callback, void *user_data)
 {
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       static unsigned int req_id = 0;
+       content_warn("DEPRECATION WARNING: media_info_start_face_detection() is deprecated and will be removed from next release.");
        media_info_s *_media = (media_info_s*)media;
 
        if (!__media_info_isFaceRecognition_feature_supported()) {
@@ -1527,23 +1430,12 @@ int media_info_start_face_detection(media_info_h media, media_face_detection_com
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
        }
 
-       media_face_cb_s *_face_cb = g_new0(media_face_cb_s, 1);
-
-       req_id++;
-       _media->face_request_id = req_id;
-
-       _face_cb->user_data = user_data;
-       _face_cb->face_completed_cb = callback;
-
-       ret = dcm_request_extract_face_async(_media->face_request_id, _media->file_path, (FaceFunc)__media_info_face_completed_cb, (void *)_face_cb, _content_get_uid());
-       ret = _content_error_capi(ret);
-
-       return ret;
+       return MEDIA_CONTENT_ERROR_NONE;
 }
 
 int media_info_cancel_face_detection(media_info_h media)
 {
-       int ret = MEDIA_CONTENT_ERROR_NONE;
+       content_warn("DEPRECATION WARNING: media_info_cancel_face_detection() is deprecated and will be removed from next release.");
        media_info_s *_media = (media_info_s*)media;
 
        if (!__media_info_isFaceRecognition_feature_supported()) {
@@ -1555,92 +1447,6 @@ int media_info_cancel_face_detection(media_info_h media)
        content_retip_if_fail(STRING_VALID(_media->media_id));
        content_retip_if_fail(_media->face_request_id > 0);
 
-       ret = dcm_request_cancel_face(_media->face_request_id);
-       return _content_error_capi(ret);
-}
-
-int media_info_set_description(media_info_h media, const char *description)
-{
-       content_warn("DEPRECATION WARNING: media_info_set_description() is deprecated and will be removed from next release.");
-       media_info_s *_media = (media_info_s*)media;
-
-       content_retip_if_fail(media);
-
-       g_free(_media->description);
-       _media->description = g_strdup(description);
-
-       return MEDIA_CONTENT_ERROR_NONE;
-}
-
-int media_info_set_longitude(media_info_h media, double longitude)
-{
-       content_warn("DEPRECATION WARNING: media_info_set_longitude() is deprecated and will be removed from next release.");
-       media_info_s *_media = (media_info_s*)media;
-
-       content_retip_if_fail(media);
-
-       _media->longitude = longitude;
-
-       return MEDIA_CONTENT_ERROR_NONE;
-}
-
-int media_info_set_latitude(media_info_h media, double latitude)
-{
-       content_warn("DEPRECATION WARNING: media_info_set_latitude() is deprecated and will be removed from next release.");
-       media_info_s *_media = (media_info_s*)media;
-
-       content_retip_if_fail(media);
-
-       _media->latitude = latitude;
-
-       return MEDIA_CONTENT_ERROR_NONE;
-}
-
-int media_info_set_rating(media_info_h media, int rating)
-{
-       content_warn("DEPRECATION WARNING: media_info_set_rating() is deprecated and will be removed from next release.");
-       media_info_s *_media = (media_info_s*)media;
-
-       content_retip_if_fail(media);
-
-       _media->rating = rating;
-
-       return MEDIA_CONTENT_ERROR_NONE;
-}
-
-#ifdef TIZEN_FEATURE_COMPATIBILITY
-int media_info_set_added_time(media_info_h media, time_t added_time)
-{
-       content_warn("DEPRECATION WARNING: media_info_set_added_time() is removed from 5.5.");
-
-       return MEDIA_CONTENT_ERROR_NONE;
-}
-
-int media_info_delete_batch_from_db(filter_h filter)
-{
-       content_warn("DEPRECATION WARNING: media_info_delete_batch_from_db() is removed from 5.5.");
-
-       return MEDIA_CONTENT_ERROR_NONE;
-}
-
-int media_info_create(const char *path, media_info_h *media)
-{
-       content_warn("DEPRECATION WARNING: media_info_create() is removed from 5.5.");
-
-       return MEDIA_CONTENT_ERROR_NONE;
-}
-
-int media_info_refresh_metadata_to_db(const char *media_id)
-{
-       content_warn("DEPRECATION WARNING: media_info_refresh_metadata_to_db() is removed from 5.5.");
-
        return MEDIA_CONTENT_ERROR_NONE;
 }
-
-int media_info_set_display_name(media_info_h media, const char *display_name)
-{
-       content_warn("DEPRECATION WARNING: media_info_set_display_name() is removed from 5.5.");
-
-       return MEDIA_CONTENT_ERROR_NONE;
-}
-#endif
+// LCOV_EXCL_STOP
\ No newline at end of file