#include <tzplatform_config.h>
-#define MS_VALIND 1
+#define MS_VALID 1
#define MS_INVALID 0
-#define MS_VALIND_V2 2
+#define MS_SCANNING 2
+#define MS_VALID_V2 2
#define MS_RECURSIVE 1
#define MS_NON_RECURSIVE 0
thumb_list = g_array_new(FALSE, FALSE, sizeof(char*));
- char *sql = sqlite3_mprintf("SELECT media_thumbnail_path FROM '%q' WHERE validity=0 AND media_thumbnail_path IS NOT NULL", storage_id);
+ char *sql = sqlite3_mprintf("SELECT media_thumbnail_path FROM '%q' WHERE validity IN (%d, %d) AND media_thumbnail_path IS NOT NULL", storage_id, MS_INVALID, MS_SCANNING);
MS_DBG_SLOG("[SQL query] : %s", sql);
MS_SQLITE3_FINALIZE(sql_stmt);
- sql = sqlite3_mprintf("DELETE FROM '%q' WHERE validity=0;", storage_id);
+ sql = sqlite3_mprintf("DELETE FROM '%q' WHERE validity IN (%d, %d)", storage_id, MS_INVALID, MS_SCANNING);
ret = media_db_update_db_direct(sql, uid);
MS_SQLITE3_SAFE_FREE(sql);
MS_DBG_RETVM_IF(!MS_STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
- sql = sqlite3_mprintf("DELETE FROM folder WHERE storage_uuid='%q' AND validity=0;", storage_id);
+ sql = sqlite3_mprintf("DELETE FROM folder WHERE storage_uuid='%q' AND validity IN (%d, %d)", storage_id, MS_INVALID, MS_SCANNING);
ret = media_db_update_db_direct(sql, uid);
ms_get_folder_scan_status(handle, storage_id, scan_data->msg, (int*)&scan_status);
if (scan_status == MS_DIR_SCAN_DONE)
- ms_set_folder_item_validity(handle, storage_id, scan_data->msg, MS_VALIND_V2, MS_RECURSIVE, uid);
+ ms_set_folder_item_validity(handle, storage_id, scan_data->msg, MS_VALID_V2, MS_RECURSIVE, uid);
else
ms_set_folder_item_validity(handle, storage_id, scan_data->msg, MS_INVALID, MS_RECURSIVE, uid);
}
/* do nothing */
MS_DBG_WARN("[%.*s] scan done", MAX_MSG_SIZE, scan_data->msg);
/*fix timing issue, deleted items scanned by storage scan is set validity 1 again*/
- /*err = ms_set_folder_item_validity(handle, storage_id, scan_data->msg, MS_VALIND, MS_NON_RECURSIVE, uid);*/
+ /*err = ms_set_folder_item_validity(handle, storage_id, scan_data->msg, MS_VALID, MS_NON_RECURSIVE, uid);*/
goto SCAN_DONE;
} else if (scan_status == MS_DIR_SCAN_PROCESSING) {
MS_DBG_WARN("[%.*s] scanning, waiting...", MAX_MSG_SIZE, scan_data->msg);
}
if (noti_type != MS_ITEM_INSERT) {
- /* folder validity set 0 under the start_path in folder table*/
- ret = ms_set_folder_validity(handle, storage_id, scan_data->msg, MS_INVALID, is_recursive, scan_data->uid);
+ /* folder validity set 2 under the start_path in folder table*/
+ ret = ms_set_folder_validity(handle, storage_id, scan_data->msg, MS_SCANNING, is_recursive, scan_data->uid);
if (ret != MS_MEDIA_ERR_NONE) {
MS_DBG_ERR("set_folder_validity failed [%d] ", scan_type);
goto NEXT;
}
/*change validity before scanning*/
- ret = ms_set_folder_item_validity(handle, storage_id, scan_data->msg, MS_INVALID, is_recursive, scan_data->uid);
+ ret = ms_set_folder_item_validity(handle, storage_id, scan_data->msg, MS_SCANNING, is_recursive, scan_data->uid);
if (ret != MS_MEDIA_ERR_NONE) {
MS_DBG_ERR("set_folder_validity failed [%d] ", scan_type);
goto NEXT;