Get storage_id internally 18/322918/2
authorMinje Ahn <minje.ahn@samsung.com>
Fri, 18 Apr 2025 00:00:54 +0000 (09:00 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Fri, 18 Apr 2025 00:09:08 +0000 (09:09 +0900)
Change-Id: I551b769ce3dafe9386a7249566ab59a0e3805147
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
include/media-svc-media.h
include/media-svc.h
src/media-svc-media.c
src/media-svc.c

index 088caf7e4fd89100b09efe6e1241df202b5f2fc3..b44a9bec0fc3ddcfe66645b9ba5ed29b0b5aa62e 100644 (file)
@@ -26,7 +26,6 @@
 #include "media-svc-env.h"
 
 int _media_svc_check_data_by_path(sqlite3 *handle, const char *path);
-int _media_svc_get_modified_time(sqlite3 *handle, const char *path, int *modified_time);
 int _media_svc_insert_item_stack(media_svc_content_info_s *content_info);
 int _media_svc_insert_item(media_svc_content_info_s *content_info, uid_t uid);
 int _media_svc_update_item_with_data(bool is_direct, media_svc_content_info_s *content_info, uid_t uid);
index 20072f1a1d382b06a94684ccb2cabde9b88ce7aa..f738519cc3adc79dc96b24f64ba49dc134423a6f 100644 (file)
@@ -35,12 +35,11 @@ extern "C" {
 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 *path);
-int media_svc_get_modified_time(sqlite3 *handle, const char *path, int *modified_time);
 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, 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_insert_item_immediately(sqlite3 *handle, const char *path, uid_t uid);
 int media_svc_move_item(sqlite3 *handle,
                                                const char *src_path,
                                                const char *dest_path,
index 2dee9208ba0617315e383ff7ba0b32654c436bd1..b6ea47e6b343d034b68f9a03dbe057b5a6d0dc92 100644 (file)
@@ -48,25 +48,6 @@ int _media_svc_check_data_by_path(sqlite3 *handle, const char *path)
        return ret;
 }
 
-int _media_svc_get_modified_time(sqlite3 *handle, const char *path, int *modified_time)
-{
-       int ret = MS_MEDIA_ERR_NONE;
-       sqlite3_stmt *stmt = NULL;
-       sql_autoptr q = NULL;
-
-       media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "Path is NULL");
-
-       q = sqlite3_mprintf("SELECT media_modified_time FROM %q WHERE media_path=%Q", DB_TABLE_MEDIA, path);
-       ret = _media_svc_get_result_with_check_record(handle, q, &stmt);
-       media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
-
-       *modified_time = sqlite3_column_int(stmt, 0);
-
-       sqlite3_finalize(stmt);
-
-       return MS_MEDIA_ERR_NONE;
-}
-
 static char *__media_svc_make_insert_query(media_svc_content_info_s *content_info)
 {
        return sqlite3_mprintf("INSERT INTO %q(media_id, media_path, media_display_name, media_type, media_mime_type, media_size, media_modified_time, folder_id, media_thumbnail_path, media_title, album_id, media_album, media_artist, media_album_artist, media_genre, media_year, media_recorded_date, media_track_num, media_width, media_height, media_datetaken, orientation, storage_uuid) VALUES (%Q, %Q, %Q, %d, %Q, %lld, %d, %lld, %Q, %Q, %d, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %d, %d, %Q, %d, %Q);",
index a6a28aa27bcdd4822f243293810e5f36b59572b6..183943b69506a334782e92eb0d08b5e4ebe4593c 100644 (file)
@@ -52,11 +52,6 @@ int media_svc_check_item_exist_by_path(sqlite3 *handle, const char *path)
        return _media_svc_check_data_by_path(handle, path);
 }
 
-int media_svc_get_modified_time(sqlite3 *handle, const char *path, int *modified_time)
-{
-       return _media_svc_get_modified_time(handle, path, modified_time);
-}
-
 int media_svc_insert_item_begin(bool with_noti, int from_pid)
 {
        g_media_svc_cur_data_cnt = 0;
@@ -186,10 +181,14 @@ int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, const ch
        return MS_MEDIA_ERR_NONE;
 }
 
-int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
+int media_svc_insert_item_immediately(sqlite3 *handle, const char *path, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
        media_svc_content_info_s content_info = { 0, };
+       char storage_id[MEDIA_SVC_UUID_SIZE + 1] = { 0, };
+
+       ret = _media_svc_get_storage_uuid(handle, path, storage_id, uid);
+       media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
 
        ret = __media_svc_set_info(handle, storage_id, path, uid, false, &content_info);
        media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);