Change folder_id to row id instead of uuid 41/282841/3 accepted/tizen/unified/20221102.020553
authorminje.ahn <minje.ahn@samsung.com>
Wed, 12 Oct 2022 07:16:57 +0000 (16:16 +0900)
committerMinje ahn <minje.ahn@samsung.com>
Wed, 26 Oct 2022 05:57:23 +0000 (05:57 +0000)
Change to row id instead of uuid for manageability.

Change-Id: I5f12e4984381788fd9245bec0028a349a9a4a4ba
Signed-off-by: minje.ahn <minje.ahn@samsung.com>
packaging/media-server.spec
src/common/media-common-db-svc.c
src/scanner-v2/media-scanner-extract-v2.c
src/scanner-v2/media-scanner-scan-v2.c
src/scanner/media-scanner-scan.c

index 885272c..2781301 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       media-server
 Summary:    A server for media content management
-Version:    0.4.25
+Version:    0.4.26
 Release:    0
 Group:      Multimedia/Service
 License:    Apache-2.0
index 32e54fc..748e219 100644 (file)
@@ -696,7 +696,11 @@ int ms_get_folder_id(sqlite3 *handle, const char *storage_id, const char *path,
        MS_DBG_RETV_IF(ret != MS_MEDIA_ERR_NONE, ret);
 
        if (sqlite3_step(sql_stmt) == SQLITE_ROW) {
+#ifdef _USE_TVPD_MODE
                *folder_id = g_strdup((const char *)sqlite3_column_text(sql_stmt, 0));
+#else
+               *folder_id = g_strdup_printf("%lld", sqlite3_column_int64(sql_stmt, 0));
+#endif
                MS_DBG("folder_id [%s]", *folder_id);
        } else {
                *folder_id = NULL;
index 35afee3..9668a5e 100644 (file)
@@ -238,10 +238,10 @@ NEXT:
                if (extract_data->result) {
                        MS_DBG_ERR("MS_MSG_SCANNER_COMPLETE");
                        if (extract_data->noti_type == MS_ITEM_INSERT || extract_data->noti_type == MS_ITEM_UPDATE) {
-                               char *folder_uuid = NULL;
-                               ms_get_folder_id(handle, extract_data->storage_id, extract_data->msg, &folder_uuid);
-                               MS_DBG_WARN("storage_id[%.*s] Path[%.*s] folder_id[%s] noti_type[%d]", MS_UUID_SIZE, extract_data->storage_id, MAX_MSG_SIZE, extract_data->msg, folder_uuid, extract_data->noti_type);
-                               ms_send_dir_update_noti(extract_data->msg, folder_uuid, extract_data->noti_type, extract_data->pid);
+                               char *folder_id = NULL;
+                               ms_get_folder_id(handle, extract_data->storage_id, extract_data->msg, &folder_id);
+                               MS_DBG_WARN("storage_id[%.*s] Path[%.*s] folder_id[%s] noti_type[%d]", MS_UUID_SIZE, extract_data->storage_id, MAX_MSG_SIZE, extract_data->msg, folder_id, extract_data->noti_type);
+                               ms_send_dir_update_noti(extract_data->msg, folder_id, extract_data->noti_type, extract_data->pid);
                        }
                        extract_data->msg_type = MS_MSG_EXTRACTOR_COMPLETE;
                        msc_send_result(ret, extract_data);
index d3406da..3cfbe6e 100644 (file)
@@ -781,7 +781,7 @@ gpointer msc_directory_scan_thread(gpointer data)
        bool modified = false;
        ms_dir_scan_status_e scan_status = MS_DIR_SCAN_NONE;
        ms_noti_type_e noti_type = MS_ITEM_INSERT;
-       char *folder_uuid = NULL;
+       char *folder_id = NULL;
        bool is_recursive = true;
 
        while (1) {
@@ -841,9 +841,9 @@ gpointer msc_directory_scan_thread(gpointer data)
                        noti_type = MS_ITEM_DELETE;
                        scan_data->msg_type = MS_MSG_DIRECTORY_SCANNING;
 
-                       ms_get_folder_id(handle, scan_data->storage_id, scan_data->msg, &folder_uuid);
+                       ms_get_folder_id(handle, scan_data->storage_id, scan_data->msg, &folder_id);
 
-                       MS_DBG_SWARN("[%.*s][%s] delete path", MAX_MSG_SIZE, scan_data->msg, folder_uuid);
+                       MS_DBG_SWARN("[%.*s][%s] delete path", MAX_MSG_SIZE, scan_data->msg, folder_id);
                }
 
                if (scan_data->msg_type == MS_MSG_DIRECTORY_SCANNING) {
@@ -943,7 +943,7 @@ SCAN_DONE:
                        }
 
                        if (noti_type == MS_ITEM_DELETE)
-                               ms_send_dir_update_noti(scan_data->msg, folder_uuid, noti_type, scan_data->pid);
+                               ms_send_dir_update_noti(scan_data->msg, folder_id, noti_type, scan_data->pid);
 
                        msc_insert_exactor_request(scan_data->msg_type, true, scan_data->storage_id, scan_data->msg, scan_data->pid, scan_data->uid, noti_type);
                }
@@ -958,8 +958,8 @@ NEXT:
 
                g_free(scan_data);
                scan_data = NULL;
-               g_free(folder_uuid);
-               folder_uuid = NULL;
+               g_free(folder_id);
+               folder_id = NULL;
 
                g_directory_scan_processing2 = DIR_SCAN_NON_SCAN;
                __msc_del_cur_scan_item();
@@ -1427,4 +1427,3 @@ FINALIZE:
        g_mutex_unlock(&scan_req_mutex2);
        MS_DBG_WARN("scan_req_mutex2 is UNLOCKED");
 }
-
index f4a6bcd..c2e4136 100644 (file)
@@ -174,7 +174,7 @@ static int __msc_directory_scan_insert_only(sqlite3 *handle, ms_comm_msg_s *scan
 {
        int ret = MS_MEDIA_ERR_NONE;
        char *start_path = NULL;
-       char *folder_uuid = NULL;
+       char *folder_id = NULL;
 
        MS_DBG_RETVM_IF(!handle, MS_MEDIA_ERR_INVALID_PARAMETER, "handle is NULL");
        MS_DBG_RETVM_IF(!scan_data, MS_MEDIA_ERR_INVALID_PARAMETER, "scan_data is NULL");
@@ -187,11 +187,11 @@ static int __msc_directory_scan_insert_only(sqlite3 *handle, ms_comm_msg_s *scan
 
        if (ret != MS_MEDIA_ERR_SCANNER_FORCE_STOP) {
                MS_DBG_INFO("working normally");
-               ret = ms_get_folder_id(handle, scan_data->storage_id, scan_data->msg, &folder_uuid);
+               ret = ms_get_folder_id(handle, scan_data->storage_id, scan_data->msg, &folder_id);
                MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "ms_get_folder_id failed");
-               ret = ms_send_dir_update_noti(scan_data->msg, folder_uuid, MS_ITEM_INSERT, scan_data->pid);
+               ret = ms_send_dir_update_noti(scan_data->msg, folder_id, MS_ITEM_INSERT, scan_data->pid);
 
-               MS_SAFE_FREE(folder_uuid);
+               MS_SAFE_FREE(folder_id);
        }
 
        return ret;
@@ -201,7 +201,7 @@ static int __msc_directory_scan_update_and_delete(sqlite3 *handle, ms_comm_msg_s
 {
        int ret = MS_MEDIA_ERR_NONE;
        char *start_path = NULL;
-       char *folder_uuid = NULL;
+       char *folder_id = NULL;
 
        MS_DBG_RETVM_IF(!handle, MS_MEDIA_ERR_INVALID_PARAMETER, "handle is NULL");
        MS_DBG_RETVM_IF(!scan_data, MS_MEDIA_ERR_INVALID_PARAMETER, "scan_data is NULL");
@@ -214,7 +214,7 @@ static int __msc_directory_scan_update_and_delete(sqlite3 *handle, ms_comm_msg_s
 
        start_path = g_strdup(scan_data->msg);
 
-       ret = ms_get_folder_id(handle, scan_data->storage_id, scan_data->msg, &folder_uuid);
+       ret = ms_get_folder_id(handle, scan_data->storage_id, scan_data->msg, &folder_id);
        if (ret != MS_MEDIA_ERR_NONE) {
                MS_DBG_ERR("ms_get_folder_id failed");
                g_free(start_path);
@@ -233,10 +233,10 @@ static int __msc_directory_scan_update_and_delete(sqlite3 *handle, ms_comm_msg_s
 
        if (ret != MS_MEDIA_ERR_SCANNER_FORCE_STOP) {
                MS_DBG_INFO("working normally");
-               ret = ms_send_dir_update_noti(scan_data->msg, folder_uuid, noti_type, scan_data->pid);
+               ret = ms_send_dir_update_noti(scan_data->msg, folder_id, noti_type, scan_data->pid);
        }
 
-       g_free(folder_uuid);
+       g_free(folder_id);
 
        return ret;
 }