uid_t uid = MEDIA_DEFAULT_UID;
int disc_state = 0;
int end_flag = NORMAL_EVENT;
+ ms_noti_type_e noti_type = MS_ITEM_INSERT;
while (1) {
extract_data = g_async_queue_pop(folder_extract_queue);
}
scan_type = extract_data->msg_type;
+ noti_type = extract_data->noti_type;
storage_id = strdup(extract_data->storage_id);
if (storage_id == NULL) {
/*send notification*/
char *folder_uuid = NULL;
ms_get_folder_id(handle, storage_id, extract_data->msg, &folder_uuid);
- ms_send_dir_update_noti(handle, storage_id, update_path, folder_uuid, MS_ITEM_UPDATE, extract_data->pid);
+ ms_send_dir_update_noti(handle, storage_id, update_path, folder_uuid, noti_type, extract_data->pid);
extract_data->msg_type = MS_MSG_EXTRACTOR_COMPLETE;
msc_send_result(ret, extract_data);
}
return false;
}
-void msc_insert_exactor_request(int message_type, bool ins_status, const char *storage_id, const char *path, int pid, uid_t uid)
+void msc_insert_exactor_request(int message_type, bool ins_status, const char *storage_id, const char *path, int pid, uid_t uid, ms_noti_type_e noti_type)
{
ms_comm_msg_s *extract_data = NULL;
MS_MALLOC(extract_data, sizeof(ms_comm_msg_s));
extract_data->uid = uid;
extract_data->result = ins_status;
extract_data->msg_size = strlen(path);
+ extract_data->noti_type = noti_type;
SAFE_STRLCPY(extract_data->msg, path, sizeof(extract_data->msg));
SAFE_STRLCPY(extract_data->storage_id, storage_id, sizeof(extract_data->storage_id));
//MS_DBG_ERR("storage_id = [%s]", storage_id);
ret = __msc_check_stop_status(scan_type, storage_type, new_start_path, pid);
if (ret == MS_MEDIA_ERR_NONE) {
- msc_insert_exactor_request(scan_type, FALSE, storage_id, current_path, pid, uid);
+ msc_insert_exactor_request(scan_type, FALSE, storage_id, current_path, pid, uid, MS_ITEM_UPDATE);
} else {
if (is_recursive == true)
ms_change_validity_item_batch(handle, storage_id, new_start_path, 1, 2, uid);
if (scan_count >= MAX_SCAN_COUNT) {
scan_count = 0;
//MS_DBG_ERR("storage_id = [%s]", storage_id);
- msc_insert_exactor_request(scan_type, FALSE, storage_id, current_path, 0, uid);
+ msc_insert_exactor_request(scan_type, FALSE, storage_id, current_path, 0, uid, MS_ITEM_UPDATE);
}
}
} else if (d->d_type == DT_DIR) {
int index = 0;
ms_user_storage_type_e storage_type = MS_STORAGE_INTERNAL;
ms_dir_scan_status_e scan_status = MS_DIR_SCAN_NONE;
+ ms_noti_type_e noti_type = MS_ITEM_INSERT;
char *folder_uuid = NULL;
uid_t uid = MEDIA_DEFAULT_UID;
if (g_file_test(scan_data->msg, G_FILE_TEST_IS_DIR)) {
if (ms_check_folder_exist(handle, storage_id, scan_data->msg) == MS_MEDIA_ERR_NONE) {
/*already exist in media DB*/
+ noti_type = MS_ITEM_UPDATE;
MS_DBG_WARN("[%s] already exist", scan_data->msg);
} else {
+ noti_type = MS_ITEM_INSERT;
MS_DBG_WARN("[%s] new insert path", scan_data->msg);
}
} else {
/*directory is deleted*/
+ noti_type = MS_ITEM_DELETE;
scan_type = MS_MSG_DIRECTORY_SCANNING;
scan_data->msg_type = MS_MSG_DIRECTORY_SCANNING;
MS_DBG_ERR("deleting invalid folders in storage failed");
/*if (ret != MS_MEDIA_ERR_SCANNER_FORCE_STOP) {
- MS_DBG_INFO("working normally");
ms_send_dir_update_noti(handle, storage_id, scan_data->msg, folder_uuid, noti_type, scan_data->pid);
}*/
SCAN_DONE:
MS_DBG_WARN("storage_id = [%s], dir Path = [%s], pid = [%d]", storage_id, scan_data->msg, scan_data->pid);
if (ret != MS_MEDIA_ERR_SCANNER_FORCE_STOP) {
- msc_insert_exactor_request(scan_data->msg_type, TRUE, scan_data->storage_id, scan_data->msg, scan_data->pid, uid);
+ msc_insert_exactor_request(scan_data->msg_type, TRUE, scan_data->storage_id, scan_data->msg, scan_data->pid, uid, noti_type);
}
if (power_off2) {
MS_DBG_ERR("power off");
if (ret != MS_MEDIA_ERR_NONE) {
ms_set_storage_scan_status(handle, scan_data->storage_id, MEDIA_SCAN_STOP, uid);
MS_DBG_ERR("storage_id = [%s]", scan_data->storage_id);
- msc_insert_exactor_request(scan_type, TRUE, scan_data->storage_id, scan_data->msg, scan_data->pid, uid);
+ msc_insert_exactor_request(scan_type, TRUE, scan_data->storage_id, scan_data->msg, scan_data->pid, uid, MS_ITEM_UPDATE);
goto NEXT;
}
}
MS_DBG_WARN("storage_id = [%s]", scan_data->storage_id);
- msc_insert_exactor_request(scan_type, TRUE, scan_data->storage_id, scan_data->msg, scan_data->pid, uid);
+ msc_insert_exactor_request(scan_type, TRUE, scan_data->storage_id, scan_data->msg, scan_data->pid, uid, MS_ITEM_UPDATE);
NEXT:
msc_del_blocked_path();