Remove storage type 91/304791/2
authorminje.ahn <minje.ahn@samsung.com>
Tue, 23 Jan 2024 23:54:11 +0000 (08:54 +0900)
committerminje.ahn <minje.ahn@samsung.com>
Wed, 24 Jan 2024 01:03:01 +0000 (10:03 +0900)
Change-Id: I92d8abd5d23b459f9deafa7436af2d8970d58693
Signed-off-by: minje.ahn <minje.ahn@samsung.com>
13 files changed:
include/media-svc.h
packaging/libmedia-service.spec
plugin/media-content-plugin.c
src/common/media-svc-db-utils.c
src/common/media-svc-media-folder.c
src/common/media-svc-media.c
src/common/media-svc-storage.c
src/common/media-svc-util.c
src/common/media-svc.c
src/include/common/media-svc-media-folder.h
src/include/common/media-svc-media.h
src/include/common/media-svc-storage.h
src/include/common/media-svc-util.h

index ec3497a..a678833 100755 (executable)
@@ -35,11 +35,11 @@ int media_svc_check_table_exist(sqlite3 *handle, bool *exist);
 int media_svc_create_table(uid_t uid);
 int media_svc_check_item_exist_by_path(sqlite3 *handle, const char *storage_id, const char *path);
 int media_svc_get_modified_time(sqlite3 *handle, const char *storage_id, const char *path, int *modified_time);
-int media_svc_insert_folder(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid);
+int media_svc_insert_folder(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
 int media_svc_insert_item_begin(bool with_noti, int from_pid);
 int media_svc_insert_item_end(uid_t uid);
-int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid);
-int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid);
+int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
+int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
 int media_svc_move_item(sqlite3 *handle,
                                                const char *src_path,
                                                const char *dest_path,
@@ -50,12 +50,12 @@ int media_svc_move_item(sqlite3 *handle,
 
 int media_svc_set_item_validity(const char *path, int validity, uid_t uid);
 int media_svc_delete_item_by_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
-int media_svc_refresh_item(sqlite3 *handle, bool is_direct, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid);
+int media_svc_refresh_item(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, uid_t uid);
 int media_svc_send_dir_update_noti(const char *dir_path, const char *folder_id, media_item_update_type_e update_type, int pid);
 int media_svc_publish_noti(media_item_update_type_e update_type, const char *path, media_type_e media_type, const char *uuid, const char *mime_type);
 
 int media_svc_check_storage(sqlite3 *handle, const char *storage_id, char **storage_path, int *validity);
-int media_svc_insert_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, ms_user_storage_type_e storage_type, uid_t uid);
+int media_svc_insert_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, uid_t uid);
 int media_svc_update_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, uid_t uid);
 int media_svc_set_storage_validity(sqlite3 *handle, const char *storage_id, int validity, uid_t uid);
 int media_svc_get_storage_id(sqlite3 *handle, const char *path, char *storage_id, uid_t uid);
index cb3c1db..475259c 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmedia-service
 Summary:    Media information service library for multimedia applications
-Version:    0.4.32
+Version:    0.5.0
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0 and PD
index e8a43ea..eb8853a 100755 (executable)
@@ -33,12 +33,12 @@ int insert_item_end(uid_t uid)
        return media_svc_insert_item_end(uid);
 }
 
-int insert_item(sqlite3 *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid)
+int insert_item(sqlite3 *handle, const char *storage_id, const char *file_path, uid_t uid)
 {
-       return media_svc_insert_item_bulk(handle, storage_id, storage_type, file_path, uid);
+       return media_svc_insert_item_bulk(handle, storage_id, file_path, uid);
 }
 
-int set_item_validity(const char *storage_id, const char *file_path, int storage_type, int validity, uid_t uid)
+int set_item_validity(const char *storage_id, const char *file_path, int validity, uid_t uid)
 {
        return media_svc_set_item_validity(file_path, validity, uid);
 }
@@ -68,9 +68,9 @@ int check_storage(sqlite3 *handle, const char *storage_id, char **storage_path,
        return media_svc_check_storage(handle, storage_id, storage_path, validity);
 }
 
-int insert_storage(sqlite3 *handle, const char *storage_id, int storage_type, const char *storage_path, uid_t uid)
+int insert_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, uid_t uid)
 {
-       return media_svc_insert_storage(handle, storage_id, storage_path, storage_type, uid);
+       return media_svc_insert_storage(handle, storage_id, storage_path, uid);
 }
 
 int update_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, uid_t uid)
@@ -93,9 +93,9 @@ int get_storage_id(sqlite3 *handle, const char *path, char *storage_id, uid_t ui
        return media_svc_get_storage_id(handle, path, storage_id, uid);
 }
 
-int insert_folder(sqlite3 *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid)
+int insert_folder(sqlite3 *handle, const char *storage_id, const char *file_path, uid_t uid)
 {
-       return media_svc_insert_folder(handle, storage_id, storage_type, file_path, uid);
+       return media_svc_insert_folder(handle, storage_id, file_path, uid);
 }
 
 int set_folder_validity(sqlite3 *handle, const char *storage_id, const char *start_path, int validity, bool is_recursive, uid_t uid)
@@ -115,12 +115,5 @@ int get_media_type(const char *path, int *mediatype)
 
 int refresh_item(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
 {
-       int ret = MS_MEDIA_ERR_NONE;
-       ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
-
-       ret = ms_user_get_storage_type(uid, path, &storage_type);
-       if (ret != MS_MEDIA_ERR_NONE)
-               return ret;
-
-       return media_svc_refresh_item(handle, true, storage_id, storage_type, path, uid);
+       return media_svc_refresh_item(handle, true, storage_id, path, uid);
 }
index cf411be..0eaf550 100755 (executable)
@@ -398,7 +398,6 @@ int _media_svc_init_table_query(void)
        __add_column_info(&column_list[DB_LIST_MEDIA], "media_rating", DB_TYPE_INT, "DEFAULT 0", false, false, true);
        __add_column_info(&column_list[DB_LIST_MEDIA], "media_favourite", DB_TYPE_INT, "DEFAULT 0", false, false, true);
        __add_column_info(&column_list[DB_LIST_MEDIA], "media_is_drm", DB_TYPE_INT, "DEFAULT 0", false, false, true);
-       __add_column_info(&column_list[DB_LIST_MEDIA], "media_storage_type", DB_TYPE_INT, NULL, false, false, true);
        __add_column_info(&column_list[DB_LIST_MEDIA], "media_timeline", DB_TYPE_INT, "DEFAULT 0", false, false, true);
        __add_column_info(&column_list[DB_LIST_MEDIA], "storage_uuid", DB_TYPE_TEXT, NULL, false, false, true);
        __add_column_info(&column_list[DB_LIST_MEDIA], "validity", DB_TYPE_INT, "DEFAULT 1", false, false, false);
@@ -409,7 +408,6 @@ int _media_svc_init_table_query(void)
        __add_column_info(&column_list[DB_LIST_FOLDER], "folder_path", DB_TYPE_TEXT, "NOT NULL", true, false, false);
        __add_column_info(&column_list[DB_LIST_FOLDER], "folder_name", DB_TYPE_TEXT, "NOT NULL", false, false, false);
        __add_column_info(&column_list[DB_LIST_FOLDER], "folder_modified_time", DB_TYPE_INT, "DEFAULT 0", false, false, false);
-       __add_column_info(&column_list[DB_LIST_FOLDER], "folder_storage_type", DB_TYPE_INT, NULL, false, false, false);
        __add_column_info(&column_list[DB_LIST_FOLDER], "storage_uuid", DB_TYPE_TEXT, NULL, true, false, false);
        __add_column_info(&column_list[DB_LIST_FOLDER], "validity", DB_TYPE_INT, "DEFAULT 1", false, false, false);
 
@@ -449,7 +447,6 @@ int _media_svc_init_table_query(void)
        /*storage*/
        __add_column_info(&column_list[DB_LIST_STORAGE], "storage_id", DB_TYPE_TEXT, "PRIMARY KEY", false, false, false);
        __add_column_info(&column_list[DB_LIST_STORAGE], "storage_path", DB_TYPE_TEXT, "NOT NULL", false, false, false);
-       __add_column_info(&column_list[DB_LIST_STORAGE], "storage_type", DB_TYPE_INT, "DEFAULT 0", false, false, false);
        __add_column_info(&column_list[DB_LIST_STORAGE], "validity", DB_TYPE_INT, "DEFAULT 1", false, false, false);
 
        /*face scan list*/
index 069eed8..fe934f2 100755 (executable)
@@ -43,7 +43,7 @@ static int __media_svc_get_folder_id(sqlite3 *handle, const char *path, long lon
        return ret;
 }
 
-static int __media_svc_append_folder(bool is_direct, const char *storage_id, ms_user_storage_type_e storage_type, const char *folder_path, uid_t uid)
+static int __media_svc_append_folder(bool is_direct, const char *storage_id, const char *folder_path, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
        char *folder_name = NULL;
@@ -53,8 +53,8 @@ static int __media_svc_append_folder(bool is_direct, const char *storage_id, ms_
        folder_modified_date = _media_svc_get_file_time(folder_path);
 
        /* Sometime SQLITE3 returns NO_RECORD, so need to consider conflict case.. */
-       char *sql = sqlite3_mprintf("INSERT OR IGNORE INTO %q (folder_path, folder_name, storage_uuid, folder_storage_type, folder_modified_time) VALUES (%Q, %Q, %Q, '%d', '%d');",
-                               DB_TABLE_FOLDER, folder_path, folder_name, storage_id, storage_type, folder_modified_date);
+       char *sql = sqlite3_mprintf("INSERT OR IGNORE INTO %q (folder_path, folder_name, storage_uuid, folder_modified_time) VALUES (%Q, %Q, %Q, '%d');",
+                               DB_TABLE_FOLDER, folder_path, folder_name, storage_id, folder_modified_date);
 
        if (is_direct)
                ret = _media_svc_sql_query_direct(sql, uid);
@@ -83,28 +83,26 @@ int _media_svc_update_folder_modified_time(const char *folder_path, uid_t uid)
        return ret;
 }
 
-static int __media_svc_append_parent_folder(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, uid_t uid)
+static int __media_svc_append_parent_folder(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
        unsigned int next_pos = 0;
        char *next = NULL;
        char *dir_path = NULL;
-       const char *token = "/";
        char *internal_path = NULL;
 
-       if (storage_type == MS_USER_STORAGE_INTERNAL) {
+       if (MEDIA_ROOT_PATH_EXTERNAL && g_str_has_prefix(path, MEDIA_ROOT_PATH_EXTERNAL)) {
+               next_pos = strlen(MEDIA_ROOT_PATH_EXTERNAL) + 1;
+       } else {
                ret = ms_user_get_internal_root_path(uid, &internal_path);
                media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Fail to get root path");
 
                next_pos = strlen(internal_path);
                g_free(internal_path);
-       } else {
-               media_svc_retvm_if(!STRING_VALID(MEDIA_ROOT_PATH_EXTERNAL), MS_MEDIA_ERR_INTERNAL, "Failed to get root path");
-               next_pos = strlen(MEDIA_ROOT_PATH_EXTERNAL) + 1;
        }
 
        do {
-               next = strstr(path + next_pos, token);
+               next = strstr(path + next_pos, "/");
                if (next) {
                        next_pos = (next - path);
                        dir_path = g_strndup(path, next_pos);
@@ -115,7 +113,7 @@ static int __media_svc_append_parent_folder(sqlite3 *handle, bool is_direct, con
 
                ret = _media_svc_check_folder_by_path(handle, dir_path);
                if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
-                       ret = __media_svc_append_folder(is_direct, storage_id, storage_type, dir_path, uid);
+                       ret = __media_svc_append_folder(is_direct, storage_id, dir_path, uid);
                        if (ret != MS_MEDIA_ERR_NONE)
                                media_svc_error("__media_svc_append_folder is failed");
                        else
@@ -128,7 +126,7 @@ static int __media_svc_append_parent_folder(sqlite3 *handle, bool is_direct, con
        return MS_MEDIA_ERR_NONE;
 }
 
-int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, long long int *folder_id, uid_t uid)
+int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, long long int *folder_id, uid_t uid)
 {
        char *dir_path = NULL;
        int ret = MS_MEDIA_ERR_NONE;
@@ -137,7 +135,7 @@ int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, bool is_direct,
 
        ret = __media_svc_get_folder_id(handle, dir_path, folder_id);
        if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
-               ret = __media_svc_append_parent_folder(handle, is_direct, storage_id, dir_path, storage_type, uid);
+               ret = __media_svc_append_parent_folder(handle, is_direct, storage_id, dir_path, uid);
                if (ret != MS_MEDIA_ERR_NONE) {
                        media_svc_error("__media_svc_append_parent_folder failed");
                        goto FINALIZE;
@@ -151,13 +149,13 @@ FINALIZE:
        return ret;
 }
 
-int _media_svc_append_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, uid_t uid)
+int _media_svc_append_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
 
        ret = _media_svc_check_folder_by_path(handle, path);
        if (ret == MS_MEDIA_ERR_DB_NO_RECORD)
-               ret = __media_svc_append_parent_folder(handle, true, storage_id, path, storage_type, uid);
+               ret = __media_svc_append_parent_folder(handle, true, storage_id, path, uid);
        else
                ret = _media_svc_set_folder_validity(true, path, 1, false, uid);
 
index 6cfb466..d290cf1 100755 (executable)
@@ -72,9 +72,9 @@ int _media_svc_insert_item_with_data(bool is_direct, media_svc_content_info_s *c
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       const char *db_fields = "media_id, media_path, media_display_name, media_type, media_mime_type, media_size, media_added_time, media_modified_time, folder_id, media_thumbnail_path, media_title, album_id, media_album, media_artist, media_album_artist, media_genre, media_composer, media_year, media_recorded_date, media_copyright, media_track_num, media_description, media_bitrate, media_bitpersample, media_samplerate, media_channel, media_duration, media_longitude, media_latitude, media_altitude, exposure_time, fnumber, iso, model, media_width, media_height, media_datetaken, media_orientation, media_rating, media_storage_type, media_timeline, storage_uuid, media_360";
+       const char *db_fields = "media_id, media_path, media_display_name, media_type, media_mime_type, media_size, media_added_time, media_modified_time, folder_id, media_thumbnail_path, media_title, album_id, media_album, media_artist, media_album_artist, media_genre, media_composer, media_year, media_recorded_date, media_copyright, media_track_num, media_description, media_bitrate, media_bitpersample, media_samplerate, media_channel, media_duration, media_longitude, media_latitude, media_altitude, exposure_time, fnumber, iso, model, media_width, media_height, media_datetaken, media_orientation, media_rating, media_timeline, storage_uuid, media_360";
 
-       const char *db_fields_basic = "media_id, media_path, media_display_name, media_type, media_mime_type, media_size, media_added_time, media_modified_time, folder_id, media_thumbnail_path, album_id, media_storage_type, media_timeline, storage_uuid, media_360";
+       const char *db_fields_basic = "media_id, media_path, media_display_name, media_type, media_mime_type, media_size, media_added_time, media_modified_time, folder_id, media_thumbnail_path, album_id, media_timeline, storage_uuid, media_360";
 
        /* 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 */
@@ -84,7 +84,7 @@ int _media_svc_insert_item_with_data(bool is_direct, media_svc_content_info_s *c
        char *sql = sqlite3_mprintf("INSERT INTO %q(%q) VALUES (%Q, %Q, %Q, %d, %Q, %lld, %d, %d, %lld, \
                %Q, %Q, %d, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, \
                %d, %d, %d, %d, %d, %.6f, %.6f, %.6f, %Q, %.6f, %d, %Q, %d, %d, %Q, %d, \
-               %d, %d, %d, %Q, %d);",
+               %d, %d, %Q, %d);",
                                DB_TABLE_MEDIA, db_fields,
                                content_info->media_uuid,
                                content_info->path,
@@ -125,7 +125,6 @@ int _media_svc_insert_item_with_data(bool is_direct, media_svc_content_info_s *c
                                content_info->media_meta.datetaken,
                                content_info->media_meta.orientation,           /* 3rd line */
                                content_info->media_meta.rating,
-                               content_info->storage_type,
                                content_info->timeline,
                                content_info->storage_uuid,
                                content_info->media_meta.is_360         /* 4th line */
@@ -136,7 +135,7 @@ int _media_svc_insert_item_with_data(bool is_direct, media_svc_content_info_s *c
                media_svc_debug("Query length is over %d byte.. So, remake query using only basic information..", MEDIA_SVC_QUERY_LEN_MAX - 1);
                SQLITE3_SAFE_FREE(sql);
 
-               sql = sqlite3_mprintf("INSERT INTO %q(%q) VALUES (%Q, %Q, %Q, %d, %Q, %lld, %d, %d, %lld, %Q, %d, %d, %d, %d, %d, %Q, %d);",
+               sql = sqlite3_mprintf("INSERT INTO %q(%q) VALUES (%Q, %Q, %Q, %d, %Q, %lld, %d, %d, %lld, %Q, %d, %d, %d, %d, %Q, %d);",
                                                DB_TABLE_MEDIA, db_fields_basic,
                                                content_info->media_uuid,
                                                content_info->path,
@@ -149,7 +148,6 @@ int _media_svc_insert_item_with_data(bool is_direct, media_svc_content_info_s *c
                                                content_info->folder_id,
                                                content_info->thumbnail_path,
                                                content_info->album_id,
-                                               content_info->storage_type,
                                                content_info->timeline,
                                                content_info->storage_uuid,
                                                content_info->media_meta.is_360
@@ -307,12 +305,12 @@ int _media_svc_update_thumbnail_path(const char *path, const char *thumb_path, u
        return ret;
 }
 
-int _media_svc_update_item_by_path(const char *src_path, const char *dst_storage_id, ms_user_storage_type_e dest_storage, const char *dest_path, const char *file_name, int modified_time, long long int folder_id, uid_t uid)
+int _media_svc_update_item_by_path(const char *src_path, const char *dst_storage_id, const char *dest_path, const char *file_name, int modified_time, long long int folder_id, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
 
-       char *query = sqlite3_mprintf("UPDATE %q SET media_path=%Q, media_display_name=%Q, media_modified_time=%d, folder_id=%lld, media_storage_type=%d, storage_uuid='%q' WHERE media_path=%Q;",
-                               DB_TABLE_MEDIA, dest_path, file_name, modified_time, folder_id, dest_storage, dst_storage_id, src_path);
+       char *query = sqlite3_mprintf("UPDATE %q SET media_path=%Q, media_display_name=%Q, media_modified_time=%d, folder_id=%lld, storage_uuid='%q' WHERE media_path=%Q;",
+                               DB_TABLE_MEDIA, dest_path, file_name, modified_time, folder_id, dst_storage_id, src_path);
 
        ret = _media_svc_sql_query(query, uid);
        SQLITE3_SAFE_FREE(query);
index a0a5a44..d2e81c4 100755 (executable)
@@ -49,11 +49,11 @@ int _media_svc_check_storage(sqlite3 *handle, const char *storage_id, char **sto
        return MS_MEDIA_ERR_NONE;
 }
 
-int _media_svc_append_storage(const char *storage_id, const char *storage_path, ms_user_storage_type_e storage_type, uid_t uid)
+int _media_svc_append_storage(const char *storage_id, const char *storage_path, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
-       char *sql = sqlite3_mprintf("INSERT INTO %q (storage_id, storage_path, storage_type) values (%Q, %Q, %d);",
-                                               DB_TABLE_STORAGE, storage_id, storage_path, storage_type);
+       char *sql = sqlite3_mprintf("INSERT INTO %q (storage_id, storage_path) values (%Q, %Q);",
+                                               DB_TABLE_STORAGE, storage_id, storage_path);
 
        ret = _media_svc_sql_query_direct(sql, uid);
        SQLITE3_SAFE_FREE(sql);
@@ -144,7 +144,7 @@ int _media_svc_update_storage_validity(const char *storage_id, int validity, uid
        char *sql = NULL;
 
        if (storage_id == NULL) {
-               sql = sqlite3_mprintf("UPDATE %q SET validity=%d;UPDATE %q SET validity=%d WHERE folder_storage_type > 0;UPDATE %q SET validity=%d WHERE media_storage_type > 0;",
+               sql = sqlite3_mprintf("UPDATE %q SET validity=%d;UPDATE %q SET validity=%d WHERE storage_uuid IS NOT 'media';UPDATE %q SET validity=%d WHERE storage_uuid IS NOT 'media';",
                        DB_TABLE_STORAGE, validity, DB_TABLE_FOLDER, validity, DB_TABLE_MEDIA, validity);
        } else {
                sql = sqlite3_mprintf("UPDATE %q SET validity=%d WHERE storage_id=%Q;UPDATE %q SET validity=%d WHERE storage_uuid=%Q;UPDATE %q SET validity=%d WHERE storage_uuid=%Q;",
index 0427a85..51f33ee 100644 (file)
@@ -549,13 +549,12 @@ int _media_svc_get_file_time(const char *full_path)
        return statbuf.st_mtime;
 }
 
-int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, bool refresh)
+int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, const char *path, bool refresh)
 {
        int ret = MS_MEDIA_ERR_NONE;
        char mime_type[256] = {0, };
        media_svc_media_type_e media_type;
 
-       media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
        media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
 
        content_info->path = g_strdup(path);
@@ -580,7 +579,6 @@ int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char
        content_info->storage_uuid = g_strdup(storage_id);
        media_svc_retv_del_if(content_info->storage_uuid == NULL, MS_MEDIA_ERR_INTERNAL, content_info);
 
-       content_info->storage_type = storage_type;
        time(&content_info->added_time);
 
        content_info->media_uuid = __media_info_generate_uuid();
@@ -600,7 +598,7 @@ int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char
        content_info->mime_type = g_strdup(mime_type);
        media_svc_retv_del_if(content_info->mime_type == NULL, MS_MEDIA_ERR_INTERNAL, content_info);
 
-       media_svc_sec_debug("storage[%d], path[%s], media_type[%d]", storage_type, path, media_type);
+       media_svc_sec_debug("path[%s], media_type[%d]", path, media_type);
 
        content_info->media_type = media_type;
 
@@ -909,12 +907,13 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc
        int album_id = 0;
        int ret = MS_MEDIA_ERR_NONE;
        int convert_value = 0;
+       bool support_albumart = ms_user_thumb_support(uid, content_info->path);
 
        /*Get Content Tag attribute ===========*/
-       if (content_info->storage_type == MS_USER_STORAGE_EXTERNAL_USB)
-               mmf_error = mm_file_create_tag_attrs_no_albumart(&tag, content_info->path);
-       else
+       if (support_albumart)
                mmf_error = mm_file_create_tag_attrs(&tag, content_info->path);
+       else
+               mmf_error = mm_file_create_tag_attrs_no_albumart(&tag, content_info->path);
 
        if (mmf_error == FILEINFO_ERROR_NONE) {
                content_info->media_meta.title = __media_svc_get_title(tag, content_info->path);
@@ -975,7 +974,7 @@ int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc
                mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_SPHERICAL, &content_info->media_meta.is_360, NULL);
 
                /*Do not extract artwork for the USB Storage content*/
-               if (content_info->storage_type != MS_USER_STORAGE_EXTERNAL_USB) {
+               if (support_albumart) {
                        mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_ARTWORK, &image, &size, NULL);
                        if (mmf_error != FILEINFO_ERROR_NONE)
                                media_svc_error("fail to get tag artwork - err(%x)", mmf_error);
@@ -1416,11 +1415,8 @@ int _media_svc_create_thumbnail(const char *path, char *thumb_path, media_svc_me
        media_svc_retvm_if(!thumb_path, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid thumb_path");
        media_svc_retvm_if(!g_file_test(path, G_FILE_TEST_IS_REGULAR), MS_MEDIA_ERR_INVALID_PARAMETER, "File doesn't exist[%s]", path);
 
-       ms_user_storage_type_e store_type = -1;
-       ret = ms_user_get_storage_type(uid, path, &store_type);
-
-       if ((ret != MS_MEDIA_ERR_NONE) || ((store_type != MS_USER_STORAGE_INTERNAL) && (store_type != MS_USER_STORAGE_EXTERNAL))) {
-               media_svc_sec_error("origin path(%s) is invalid. err : [%d] store_type [%d]", path, ret, store_type);
+       if (!ms_user_thumb_support(uid, path)) {
+               media_svc_sec_error("origin path(%s) is invalid", path);
                return MS_MEDIA_ERR_INVALID_PARAMETER;
        }
 
@@ -1461,19 +1457,6 @@ int _media_svc_get_media_type(const char *path, int *mediatype)
        return ret;
 }
 
-bool _media_svc_is_valid_storage_type(ms_user_storage_type_e storage_type)
-{
-       switch (storage_type) {
-       case MS_USER_STORAGE_INTERNAL:
-       case MS_USER_STORAGE_EXTERNAL:
-       case MS_USER_STORAGE_EXTERNAL_USB:
-               return true;
-       default:
-               media_svc_error("storage type is incorrect[%d]", storage_type);
-               return false;
-       }
-}
-
 bool _media_svc_is_keyword_included(const char *path, const char *keyword)
 {
        bool ret = false;
index a4a08a0..a992f6e 100755 (executable)
@@ -184,7 +184,7 @@ int media_svc_insert_item_end(uid_t uid)
        return ret;
 }
 
-int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid)
+int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
        long long int folder_id = 0;
@@ -192,13 +192,12 @@ int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, ms_user_
        media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
        media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
        media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
-       media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
 
        media_svc_content_info_s content_info;
        memset(&content_info, 0, sizeof(media_svc_content_info_s));
 
        /*Set media info*/
-       ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, path, false);
+       ret = _media_svc_set_media_info(&content_info, storage_id, path, false);
        if (ret != MS_MEDIA_ERR_NONE)
                return ret;
 
@@ -228,7 +227,7 @@ int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, ms_user_
        media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
 
        /*Set or Get folder id*/
-       ret = _media_svc_get_and_append_folder_id_by_path(handle, true, storage_id, path, storage_type, &folder_id, uid);
+       ret = _media_svc_get_and_append_folder_id_by_path(handle, true, storage_id, path, &folder_id, uid);
        media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
 
        content_info.folder_id = folder_id;
@@ -256,7 +255,7 @@ int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, ms_user_
        return MS_MEDIA_ERR_NONE;
 }
 
-int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid)
+int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
        long long int folder_id = 0;
@@ -264,13 +263,12 @@ int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, m
        media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
        media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
        media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
-       media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
 
        media_svc_content_info_s content_info;
        memset(&content_info, 0, sizeof(media_svc_content_info_s));
 
        /*Set media info*/
-       ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, path, false);
+       ret = _media_svc_set_media_info(&content_info, storage_id, path, false);
        if (ret != MS_MEDIA_ERR_NONE)
                return ret;
 
@@ -300,7 +298,7 @@ int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, m
        media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
 
        /*Set or Get folder id*/
-       ret = _media_svc_get_and_append_folder_id_by_path(handle, false, storage_id, path, storage_type, &folder_id, uid);
+       ret = _media_svc_get_and_append_folder_id_by_path(handle, false, storage_id, path, &folder_id, uid);
        media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
 
        content_info.folder_id = folder_id;
@@ -345,8 +343,6 @@ int media_svc_move_item(sqlite3 *handle,
        long long int folder_id = 0;
        char old_thumb_path[MEDIA_SVC_PATHNAME_SIZE] = {0, };
        char dst_stg_id[MEDIA_SVC_UUID_SIZE + 1] = {0, };
-       ms_user_storage_type_e org_stg_type = MS_USER_STORAGE_INTERNAL;
-       ms_user_storage_type_e dst_stg_type = MS_USER_STORAGE_INTERNAL;
 
        media_svc_debug_fenter();
 
@@ -359,14 +355,9 @@ int media_svc_move_item(sqlite3 *handle,
        /* Get storage_id */
        ret = _media_svc_get_storage_uuid(handle, dest_path, dst_stg_id, uid);
        media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
-       /* Get storage_type */
-       ret = ms_user_get_storage_type(uid, src_path, &org_stg_type);
-       media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
-       ret = ms_user_get_storage_type(uid, dest_path, &dst_stg_type);
-       media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
 
        /*check and update folder*/
-       ret = _media_svc_get_and_append_folder_id_by_path(handle, false, dst_stg_id, dest_path, dst_stg_type, &folder_id, uid);
+       ret = _media_svc_get_and_append_folder_id_by_path(handle, false, dst_stg_id, dest_path, &folder_id, uid);
        media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
 
        /*get filename*/
@@ -386,7 +377,7 @@ int media_svc_move_item(sqlite3 *handle,
        _media_svc_remove_file(old_thumb_path);
 
        /*move item*/
-       ret = _media_svc_update_item_by_path(src_path, dst_stg_id, dst_stg_type, dest_path, file_name, modified_time, folder_id, uid);
+       ret = _media_svc_update_item_by_path(src_path, dst_stg_id, dest_path, file_name, modified_time, folder_id, uid);
        g_free(file_name);
        media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
 
@@ -456,7 +447,7 @@ int media_svc_delete_item_by_path(sqlite3 *handle, const char *storage_id, const
        return MS_MEDIA_ERR_NONE;
 }
 
-int media_svc_refresh_item(sqlite3 *handle, bool is_direct, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid)
+int media_svc_refresh_item(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
        char thumb_path[MEDIA_SVC_PATHNAME_SIZE + 1] = {0, };
@@ -466,10 +457,9 @@ int media_svc_refresh_item(sqlite3 *handle, bool is_direct, const char *storage_
        media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
        media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
        media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
-       media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
 
        /*Set media info*/
-       ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, path, true);
+       ret = _media_svc_set_media_info(&content_info, storage_id, path, true);
        media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
 
        /* Initialize thumbnail information to remake thumbnail. */
@@ -597,16 +587,15 @@ int media_svc_update_storage(sqlite3 *handle, const char *storage_id, const char
        return _media_svc_update_storage_path(handle, storage_id, storage_path, uid);
 }
 
-int media_svc_insert_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, ms_user_storage_type_e storage_type, uid_t uid)
+int media_svc_insert_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
 
        media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
        media_svc_retvm_if(storage_id == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
        media_svc_retvm_if(storage_path == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "storage_path is NULL");
-       media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
 
-       ret = _media_svc_append_storage(storage_id, storage_path, storage_type, uid);
+       ret = _media_svc_append_storage(storage_id, storage_path, uid);
        media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "append storage failed : %d", ret);
 
        /* Remove external storage that validity is 0 */
@@ -616,14 +605,13 @@ int media_svc_insert_storage(sqlite3 *handle, const char *storage_id, const char
        return ret;
 }
 
-int media_svc_insert_folder(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid)
+int media_svc_insert_folder(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
 {
        media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
        media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
        media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
-       media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
 
-       return _media_svc_append_by_folder_path(handle, storage_id, path, storage_type, uid);
+       return _media_svc_append_by_folder_path(handle, storage_id, path, uid);
 }
 
 int media_svc_set_folder_validity(const char *start_path, int validity, bool is_recursive, uid_t uid)
index 04d8f69..aee822f 100755 (executable)
@@ -25,8 +25,8 @@
 #include <media-util.h>
 
 int _media_svc_update_folder_modified_time(const char *folder_path, uid_t uid);
-int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, long long int *folder_id, uid_t uid);
-int _media_svc_append_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, uid_t uid);
+int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, long long int *folder_id, uid_t uid);
+int _media_svc_append_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
 int _media_svc_set_folder_validity(bool is_direct, const char *start_path, int validity, bool is_recursive, uid_t uid);
 int _media_svc_check_folder_by_path(sqlite3 *handle, const char *path);
 
index ac821dc..5c79751 100755 (executable)
@@ -32,7 +32,7 @@ int _media_svc_update_item_with_data(bool is_direct, media_svc_content_info_s *c
 int _media_svc_get_thumbnail_path_by_path(sqlite3 *handle, const char *path, char *thumbnail_path);
 int _media_svc_delete_item_by_path(const char *path, uid_t uid);
 int _media_svc_update_item_validity(const char *path, int validity, bool stack_query, uid_t uid);
-int _media_svc_update_item_by_path(const char *src_path, const char *dst_storage_id, ms_user_storage_type_e dest_storage, const char *dest_path, const char *file_name, int modified_time, long long int folder_id, uid_t uid);
+int _media_svc_update_item_by_path(const char *src_path, const char *dst_storage_id, const char *dest_path, const char *file_name, int modified_time, long long int folder_id, uid_t uid);
 int _media_svc_list_query_do(media_svc_query_type_e query_type, uid_t uid);
 int _media_svc_update_thumbnail_path(const char *path, const char *thumb_path, uid_t uid);
 int _media_svc_get_noti_info(sqlite3 *handle, const char *path, media_svc_noti_item **item);
index a661338..dd8cf7e 100755 (executable)
@@ -23,7 +23,7 @@
 #include <sqlite3.h>
 
 int _media_svc_check_storage(sqlite3 *handle, const char *storage_id, char **storage_path, int *validity);
-int _media_svc_append_storage(const char *storage_id, const char *storage_path, ms_user_storage_type_e storage_type, uid_t uid);
+int _media_svc_append_storage(const char *storage_id, const char *storage_path, uid_t uid);
 int _media_svc_update_storage_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
 int _media_svc_delete_invalid_storage(sqlite3 *handle, uid_t uid);
 int _media_svc_update_storage_validity(const char *storage_id, int validity, uid_t uid);
index 27655f0..91d659e 100755 (executable)
@@ -85,7 +85,6 @@ typedef struct {
        long long int folder_id;                                        /**< Unique ID of folder */
        int             album_id;                                       /**< Unique ID of album */
        char            *thumbnail_path;                                /**< Thumbnail image file path */
-       int             storage_type;                                   /**< Storage of media file : internal/external */
        char            *storage_uuid;                                  /**< Unique ID of storage */
        media_svc_content_meta_s        media_meta;     /**< meta data structure for audio files */
 } media_svc_content_info_s;
@@ -111,14 +110,13 @@ void _media_svc_remove_file(const char *path);
 int _media_svc_get_thumbnail_path(char *thumb_path, const char *pathname, const char *img_format, uid_t uid);
 int _media_svc_get_file_time(const char *full_path);
 char * _media_svc_get_title_by_path(const char *path);
-int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, bool refresh);
+int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, const char *path, bool refresh);
 int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info);
 int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc_content_info_s *content_info, uid_t uid);
 int _media_svc_extract_book_metadata(media_svc_content_info_s *content_info);
 void _media_svc_destroy_content_info(media_svc_content_info_s *content_info);
 int _media_svc_create_thumbnail(const char *path, char *thumb_path, media_svc_media_type_e media_type, uid_t uid);
 int _media_svc_get_media_type(const char *path, int *mediatype);
-bool _media_svc_is_valid_storage_type(ms_user_storage_type_e storage_type);
 bool _media_svc_is_keyword_included(const char *path, const char *keyword);
 void _media_svc_update_wordbook(const char *path, uid_t uid);
 void _media_svc_clean_wordbook(uid_t uid);