From b5f960b1ad3d2be01a64c40ca7395c790d5ad4ae Mon Sep 17 00:00:00 2001 From: "minje.ahn" Date: Wed, 24 Jan 2024 08:54:32 +0900 Subject: [PATCH] Remove storage type Change-Id: Ifffebd52c57d5420931991b9a04fb3e7e82c5676 Signed-off-by: minje.ahn --- include/media_info_private.h | 9 +++------ include_product/media_content_type.h | 1 - include_product/media_info_private.h | 13 +++++-------- src/media_content.c | 17 ++++------------- src/media_db.c | 4 +--- src/media_folder.c | 11 +---------- src/media_info.c | 14 ++------------ src/media_storage.c | 1 - src/media_util_private.c | 11 +++++------ 9 files changed, 21 insertions(+), 60 deletions(-) diff --git a/include/media_info_private.h b/include/media_info_private.h index 7c5e071..5a7e36f 100644 --- a/include/media_info_private.h +++ b/include/media_info_private.h @@ -87,7 +87,6 @@ typedef enum { MEDIA_INFO_RATING, MEDIA_INFO_FAVOURITE, MEDIA_INFO_IS_DRM, - MEDIA_INFO_STORAGE_TYPE, MEDIA_INFO_LONGITUDE, MEDIA_INFO_LATITUDE, MEDIA_INFO_ALTITUDE, @@ -164,7 +163,6 @@ typedef struct { char *folder_id; char *path; char *name; - ms_user_storage_type_e storage_type; char *storage_uuid; } media_folder_s; @@ -271,7 +269,6 @@ typedef struct { time_t favourite; char *title; int is_drm; - int storage_type; char *storage_uuid; unsigned int request_id; unsigned int face_request_id; @@ -373,7 +370,7 @@ typedef struct _media_content_cb_data { /* Get Group List */ #define SELECT_ALBUM_LIST "SELECT DISTINCT album_id, name, artist, album_art FROM "ALBUM_MEDIA_JOIN #define SELECT_MEDIA_GROUP_LIST "SELECT DISTINCT %s FROM "DB_TABLE_MEDIA" WHERE validity IN (1, 2) " -#define SELECT_FOLDER_LIST "SELECT DISTINCT folder_id, folder_path, folder_name, folder_storage_type, storage_uuid FROM "FOLDER_MEDIA_JOIN +#define SELECT_FOLDER_LIST "SELECT DISTINCT folder_id, folder_path, folder_name, storage_uuid FROM "FOLDER_MEDIA_JOIN #define SELECT_TAG_LIST "SELECT DISTINCT tag_id, tag_name FROM "DB_VIEW_TAG" WHERE 1 " #define SELECT_PLAYLIST_LIST "SELECT DISTINCT playlist_id, playlist_name, p_thumbnail_path FROM "DB_VIEW_PLAYLIST" WHERE 1 " @@ -398,7 +395,7 @@ typedef struct _media_content_cb_data { /* Get Group Info by Group ID*/ #define SELECT_ALBUM_FROM_ALBUM "SELECT name, artist, album_art FROM "DB_TABLE_ALBUM" WHERE album_id=%d" -#define SELECT_FOLDER_FROM_FOLDER "SELECT folder_path, folder_name, folder_storage_type, storage_uuid FROM "DB_TABLE_FOLDER" WHERE folder_id='%s'" +#define SELECT_FOLDER_FROM_FOLDER "SELECT folder_path, folder_name, storage_uuid FROM "DB_TABLE_FOLDER" WHERE folder_id='%s'" #define SELECT_PLAYLIST_FROM_PLAYLIST "SELECT playlist_name, thumbnail_path FROM "DB_TABLE_PLAYLIST" WHERE playlist_id=%d" #define SELECT_TAG_FROM_TAG "SELECT tag_name FROM "DB_TABLE_TAG" WHERE tag_id=%d" #define SELECT_TAG_BY_NAME "SELECT tag_id FROM "DB_TABLE_TAG" WHERE tag_name='%q'" @@ -412,7 +409,7 @@ typedef struct _media_content_cb_data { /* Get Media list of Group */ #define MEDIA_INFO_ITEM "media_id, media_path, media_display_name, media_type, media_mime_type, media_size, media_added_time, media_modified_time, media_thumbnail_path, media_description, \ - media_rating, media_favourite, media_is_drm, media_storage_type, media_longitude, media_latitude, media_altitude, exposure_time, fnumber, iso, \ + media_rating, media_favourite, media_is_drm, media_longitude, media_latitude, media_altitude, exposure_time, fnumber, iso, \ model, media_width, media_height, media_datetaken, media_orientation, media_title, media_album, media_artist, media_album_artist, media_genre, \ media_composer, media_year, media_recorded_date, media_copyright, media_track_num, media_bitrate, media_bitpersample, media_duration, media_samplerate, media_channel, \ media_timeline, storage_uuid, media_360" diff --git a/include_product/media_content_type.h b/include_product/media_content_type.h index bc1bad3..49f9fa6 100755 --- a/include_product/media_content_type.h +++ b/include_product/media_content_type.h @@ -235,7 +235,6 @@ typedef enum { typedef struct { char *storage_id; char *storage_path; - int storage_type; } media_storage_s; /** diff --git a/include_product/media_info_private.h b/include_product/media_info_private.h index 31f8b3a..939cc9c 100644 --- a/include_product/media_info_private.h +++ b/include_product/media_info_private.h @@ -90,7 +90,6 @@ typedef enum { MEDIA_INFO_RATING, MEDIA_INFO_FAVOURITE, MEDIA_INFO_IS_DRM, - MEDIA_INFO_STORAGE_TYPE, MEDIA_INFO_LONGITUDE, MEDIA_INFO_LATITUDE, MEDIA_INFO_ALTITUDE, @@ -175,7 +174,6 @@ typedef struct { char *folder_id; char *path; char *name; - ms_user_storage_type_e storage_type; char *storage_uuid; } media_folder_s; @@ -282,7 +280,6 @@ typedef struct { time_t favourite; char *title; int is_drm; - int storage_type; int played_count; time_t played_time; int played_position; @@ -527,7 +524,7 @@ typedef struct _media_content_scan_cb_data_v2 { #define SELECT_ALBUM_LIST "SELECT DISTINCT album_id, name, artist, album_art FROM "ALBUM_MEDIA_JOIN #define SELECT_MEDIA_GROUP_LIST "SELECT DISTINCT %s FROM '%s' WHERE validity=1 " -#define SELECT_FOLDER_LIST "SELECT DISTINCT folder_id, folder_path, folder_name, folder_storage_type, storage_uuid FROM "FOLDER_MEDIA_JOIN +#define SELECT_FOLDER_LIST "SELECT DISTINCT folder_id, folder_path, folder_name, storage_uuid FROM "FOLDER_MEDIA_JOIN #define SELECT_FOLDER_LIST_BY_STORAGE_ID SELECT_FOLDER_LIST"AND storage_uuid='%s' " #define SELECT_TAG_LIST "SELECT DISTINCT tag_id, tag_name FROM "DB_VIEW_TAG" WHERE 1 " #define SELECT_PLAYLIST_LIST "SELECT DISTINCT playlist_id, playlist_name, p_thumbnail_path FROM "DB_VIEW_PLAYLIST" WHERE 1 " @@ -555,7 +552,7 @@ typedef struct _media_content_scan_cb_data_v2 { /* Get Group Info by Group ID*/ #define SELECT_ALBUM_FROM_ALBUM "SELECT name, artist, album_art FROM "DB_TABLE_ALBUM" WHERE album_id=%d" -#define SELECT_FOLDER_FROM_FOLDER "SELECT folder_path, folder_name, folder_storage_type, storage_uuid FROM "DB_TABLE_FOLDER" WHERE folder_id='%s'" +#define SELECT_FOLDER_FROM_FOLDER "SELECT folder_path, folder_name, storage_uuid FROM "DB_TABLE_FOLDER" WHERE folder_id='%s'" #define SELECT_PLAYLIST_FROM_PLAYLIST "SELECT playlist_name, thumbnail_path FROM "DB_TABLE_PLAYLIST" WHERE playlist_id=%d" #define SELECT_TAG_FROM_TAG "SELECT tag_name FROM "DB_TABLE_TAG" WHERE tag_id=%d" #define SELECT_TAG_BY_NAME "SELECT tag_id FROM "DB_TABLE_TAG" WHERE tag_name='%q'" @@ -569,7 +566,7 @@ typedef struct _media_content_scan_cb_data_v2 { /* Get Media list of Group */ #define MEDIA_INFO_ITEM "media_id, media_path, media_display_name, media_type, media_mime_type, media_size, media_added_time, media_modified_time, media_thumbnail_path, media_description, \ - media_rating, media_favourite, media_is_drm, media_storage_type, media_longitude, media_latitude, media_altitude, exposure_time, fnumber, iso, \ + media_rating, media_favourite, media_is_drm, media_longitude, media_latitude, media_altitude, exposure_time, fnumber, iso, \ model, media_width, media_height, media_datetaken, media_orientation, media_title, media_album, media_artist, media_album_artist, media_genre, \ media_composer, media_year, media_recorded_date, media_copyright, media_track_num, media_bitrate, media_bitpersample, media_duration, media_samplerate, media_channel, \ media_timeline, storage_uuid, media_360, played_count, last_played_time, last_played_position, stitched_info, extract_flag, modified_date" @@ -615,8 +612,8 @@ typedef struct _media_content_scan_cb_data_v2 { /* Storage*/ #define SELECT_STORAGE_COUNT "SELECT COUNT(*) FROM "DB_TABLE_STORAGE" WHERE validity=1" -#define SELECT_STORAGE_LIST "SELECT storage_id, storage_path, storage_type FROM "DB_TABLE_STORAGE" WHERE validity=1" -#define SELECT_STORAGE_INFO_FROM_STORAGE "SELECT storage_path, storage_type FROM "DB_TABLE_STORAGE" WHERE validity=1 AND storage_id='%s'" +#define SELECT_STORAGE_LIST "SELECT storage_id, storage_path FROM "DB_TABLE_STORAGE" WHERE validity=1" +#define SELECT_STORAGE_INFO_FROM_STORAGE "SELECT storage_path FROM "DB_TABLE_STORAGE" WHERE validity=1 AND storage_id='%s'" /* Face */ #define DELETE_FACE_FROM_FACE "DELETE FROM "DB_TABLE_FACE" WHERE media_face_id=%d" diff --git a/src/media_content.c b/src/media_content.c index 2490748..2bb5458 100644 --- a/src/media_content.c +++ b/src/media_content.c @@ -223,17 +223,10 @@ int media_content_scan_file(const char *path) /* check feature */ content_retvm_if(!_media_util_check_support_media_type(path), MEDIA_CONTENT_ERROR_NOT_SUPPORTED, "Unsupported media type"); - ms_user_storage_type_e storage_type; - - ret = ms_user_get_storage_type(_content_get_uid(), path, &storage_type); - if (ret != MS_MEDIA_ERR_NONE) { - content_sec_error("ms_user_get_storage_type failed : %d (%s)", ret, path); - return _content_error_capi(ret); - } ret = media_svc_check_item_exist_by_path(_content_get_db_handle(), storage_id, path); if (ret == MS_MEDIA_ERR_NONE) { /* Refresh */ - ret = media_svc_refresh_item(_content_get_db_handle(), false, storage_id, storage_type, path, _content_get_uid()); + 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); @@ -241,7 +234,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, 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)", path); @@ -345,7 +338,6 @@ int media_content_scan_folder(const char *path, bool is_recursive, media_scan_co { int ret = MEDIA_CONTENT_ERROR_NONE; char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, }; - ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL; content_retip_if_fail(STRING_VALID(path)); content_retip_if_fail(callback); @@ -359,9 +351,8 @@ 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 = ms_user_get_storage_type(_content_get_uid(), path, &storage_type); - if (ret != MS_MEDIA_ERR_NONE) { - content_sec_error("ms_user_get_storage_type failed : %d (%s)", ret, path); + if (!ms_user_is_valid_path(_content_get_uid(), path)) { + content_sec_error("ms_user_is_valid_path failed : %d (%s)", ret, path); return _content_error_capi(ret); } diff --git a/src/media_db.c b/src/media_db.c index a1baf37..3f0279a 100755 --- a/src/media_db.c +++ b/src/media_db.c @@ -639,8 +639,7 @@ int _media_db_get_folder(filter_h filter, media_folder_cb callback, void *user_d #endif _folder->path = g_strdup((const char *)sqlite3_column_text(stmt, 1)); _folder->name = g_strdup((const char *)sqlite3_column_text(stmt, 2)); - _folder->storage_type = sqlite3_column_int(stmt, 3); - _folder->storage_uuid = g_strdup((const char *)sqlite3_column_text(stmt, 4)); + _folder->storage_uuid = g_strdup((const char *)sqlite3_column_text(stmt, 3)); if (callback((media_folder_h)_folder, user_data) == false) { media_folder_destroy((media_folder_h) _folder); @@ -1676,7 +1675,6 @@ int _media_db_get_storage(filter_h filter, media_storage_cb callback, void *user _storage->storage_id = g_strdup((const char *)sqlite3_column_text(stmt, 0)); _storage->storage_path = g_strdup((const char *)sqlite3_column_text(stmt, 1)); - _storage->storage_type = sqlite3_column_int(stmt, 2); if (callback((media_storage_h)_storage, user_data) == false) { media_storage_destroy((media_storage_h) _storage); diff --git a/src/media_folder.c b/src/media_folder.c index e83d9e9..2a6cdb3 100755 --- a/src/media_folder.c +++ b/src/media_folder.c @@ -131,7 +131,6 @@ int media_folder_clone(media_folder_h *dst, media_folder_h src) _dst->name = g_strdup(_src->name); _dst->path = g_strdup(_src->path); _dst->storage_uuid = g_strdup(_src->storage_uuid); - _dst->storage_type = _src->storage_type; *dst = (media_folder_h)_dst; @@ -195,7 +194,6 @@ int media_folder_get_folder_from_db(const char *folder_id, media_folder_h *folde _folder->folder_id = g_strdup(folder_id); _folder->path = g_strdup((const char *)sqlite3_column_text(stmt, 0)); _folder->name = g_strdup((const char *)sqlite3_column_text(stmt, 1)); - _folder->storage_type = (int)sqlite3_column_int(stmt, 2); _folder->storage_uuid = g_strdup((const char *)sqlite3_column_text(stmt, 3)); *folder = (media_folder_h)_folder; @@ -277,15 +275,8 @@ int media_folder_insert_to_db(const char *path) ret = media_svc_check_folder_exist_by_path(_content_get_db_handle(), storage_id, path); if (ret == MS_MEDIA_ERR_DB_NO_RECORD) { content_sec_debug("media_svc_check_folder_exist_by_path : no record : %s", path); - ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL; - ret = ms_user_get_storage_type(_content_get_uid(), 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); - } - - ret = media_svc_insert_folder(_content_get_db_handle(), storage_id, storage_type, path, false, _content_get_uid()); + ret = media_svc_insert_folder(_content_get_db_handle(), storage_id, path, false, _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)", path); diff --git a/src/media_info.c b/src/media_info.c index e593c17..69ea2e8 100644 --- a/src/media_info.c +++ b/src/media_info.c @@ -200,7 +200,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); @@ -335,7 +334,6 @@ int media_info_insert_to_db(const char *path, media_info_h *info) { char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {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)); @@ -350,18 +348,12 @@ int media_info_insert_to_db(const char *path, media_info_h *info) return _content_error_capi(ret); } - ret = ms_user_get_storage_type(_content_get_uid(), 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, path, &modified_time); if (ret == MS_MEDIA_ERR_NONE) { /* Refresh if need */ if (modified_time != _media_util_get_file_time(path)) { - ret = media_svc_refresh_item(_content_get_db_handle(), false, storage_id, storage_type, path, _content_get_uid()); + 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); @@ -371,7 +363,7 @@ int media_info_insert_to_db(const char *path, media_info_h *info) 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, 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)", path); @@ -596,7 +588,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; @@ -1391,7 +1382,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); diff --git a/src/media_storage.c b/src/media_storage.c index f2d18ef..fa76910 100755 --- a/src/media_storage.c +++ b/src/media_storage.c @@ -73,7 +73,6 @@ int media_storage_clone(media_storage_h *dst, media_storage_h src) _dst->storage_id = g_strdup(_src->storage_id); _dst->storage_path = g_strdup(_src->storage_path); - _dst->storage_type = _src->storage_type; *dst = (media_storage_h)_dst; diff --git a/src/media_util_private.c b/src/media_util_private.c index 01dbb9e..2a383a8 100755 --- a/src/media_util_private.c +++ b/src/media_util_private.c @@ -185,9 +185,9 @@ static bool __is_scan_ignore_exist(const char *path) bool _media_util_is_ignorable_dir(const char *dir_path) { int ret = MEDIA_CONTENT_ERROR_NONE; - ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL; - content_retip_if_fail(STRING_VALID(dir_path)); + if (!STRING_VALID(dir_path)) + return true; content_sec_debug("dir_path : %s", dir_path); @@ -198,10 +198,9 @@ bool _media_util_is_ignorable_dir(const char *dir_path) } /*2. Check Scan Ignore Directory*/ - ret = ms_user_get_storage_type(_content_get_uid(), dir_path, &storage_type); - if (ret != MS_MEDIA_ERR_NONE) { - content_error("ms_user_get_storage_type failed : %d", ret); - return false; + if (!ms_user_is_valid_path(_content_get_uid(), dir_path)) { + content_error("ms_user_is_valid_path failed : %d", ret); + return true; } char *leaf_path = NULL; -- 2.7.4