diff options
-rwxr-xr-x | include/media-svc.h | 5 | ||||
-rw-r--r-- | packaging/libmedia-service.spec | 2 | ||||
-rwxr-xr-x | plugin/media-content-plugin.c | 113 | ||||
-rwxr-xr-x | src/common/media-svc-media-folder.c | 140 | ||||
-rwxr-xr-x | src/common/media-svc-media.c | 108 | ||||
-rwxr-xr-x | src/common/media-svc.c | 77 | ||||
-rwxr-xr-x | src/include/common/media-svc-media-folder.h | 3 | ||||
-rwxr-xr-x | src/include/common/media-svc-media.h | 2 |
8 files changed, 1 insertions, 449 deletions
diff --git a/include/media-svc.h b/include/media-svc.h index 6f280e0..af8a1bb 100755 --- a/include/media-svc.h +++ b/include/media-svc.h @@ -50,7 +50,6 @@ int media_svc_set_item_validity(const char *storage_id, const char *path, int va int media_svc_delete_item_by_path(MediaSvcHandle *handle, const char *storage_id, const char *path, uid_t uid); int media_svc_delete_all_items_in_storage(const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid); int media_svc_delete_invalid_items_in_storage(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid); -int media_svc_delete_invalid_items_in_folder(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, bool is_recursive, uid_t uid); int media_svc_set_all_storage_items_validity(const char *storage_id, media_svc_storage_type_e storage_type, int validity, uid_t uid); int media_svc_set_folder_items_validity(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, int validity, int recursive, uid_t uid); int media_svc_refresh_item(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, const char *path, uid_t uid); @@ -59,10 +58,8 @@ int media_svc_request_update_db(const char *db_query, uid_t uid); int media_svc_get_storage_type(const char *path, media_svc_storage_type_e *storage_type, uid_t uid); int media_svc_get_file_info(MediaSvcHandle *handle, const char *storage_id, const char *path, time_t *modified_time, unsigned long long *size); int media_svc_send_dir_update_noti(MediaSvcHandle *handle, const char *storage_id, const char *dir_path, const char *folder_id, media_item_update_type_e update_type, int pid); -int media_svc_count_invalid_items_in_folder(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, int *count); int media_svc_check_db_upgrade(MediaSvcHandle *handle, int user_version, uid_t uid); int media_svc_check_db_corrupt(MediaSvcHandle *handle); -int media_svc_get_folder_list(MediaSvcHandle *handle, char *start_path, char ***folder_list, time_t **modified_time_list, int *count); int media_svc_update_folder_time(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, uid_t uid); int media_svc_publish_noti(media_item_type_e update_item, media_item_update_type_e update_type, const char *path, media_type_e media_type, const char *uuid, const char *mime_type); int media_svc_get_pinyin(const char *src_str, char **pinyin_str); @@ -99,9 +96,7 @@ int media_svc_set_folder_scan_status(const char *storage_id, const char *path, i int media_svc_get_folder_modified_time(MediaSvcHandle *handle, const char *path, const char *storage_id, bool *modified); int media_svc_get_null_scan_folder_list(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, char ***folder_list, int *count); int media_svc_change_validity_item_batch(const char *storage_id, const char *path, int des_validity, int src_validity, uid_t uid); -int media_svc_delete_invalid_folder_by_path(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, uid_t uid, int *delete_count); int media_svc_check_folder_exist_by_path(MediaSvcHandle *handle, const char *storage_id, const char *folder_path); -int media_svc_check_subfolder_by_path(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, int *count); int media_svc_get_folder_id(MediaSvcHandle *handle, const char *storage_id, const char *path, char *folder_id); int media_svc_append_query(const char *query, uid_t uid); diff --git a/packaging/libmedia-service.spec b/packaging/libmedia-service.spec index 3ef1e8f..1f7de80 100644 --- a/packaging/libmedia-service.spec +++ b/packaging/libmedia-service.spec @@ -1,6 +1,6 @@ Name: libmedia-service Summary: Media information service library for multimedia applications -Version: 0.3.16 +Version: 0.3.17 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 and PD diff --git a/plugin/media-content-plugin.c b/plugin/media-content-plugin.c index f0f1b33..ca8e2f4 100755 --- a/plugin/media-content-plugin.c +++ b/plugin/media-content-plugin.c @@ -395,29 +395,6 @@ int delete_all_invalid_items_in_storage(void *handle, const char *storage_id, in return MEDIA_SVC_PLUGIN_ERROR_NONE; } -int delete_all_invalid_items_in_folder(void *handle, const char *storage_id, const char *folder_path, bool is_recursve, uid_t uid, char **err_msg) -{ - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - if (!STRING_VALID(folder_path)) { - __set_error_message(ERR_FOLDER_PATH, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_delete_invalid_items_in_folder(handle, storage_id, folder_path, is_recursve, uid); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; -} - int send_dir_update_noti(void *handle, const char *storage_id, const char *dir_path, const char *folder_id, int update_type, int pid, char **err_msg) { int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; @@ -436,34 +413,6 @@ int send_dir_update_noti(void *handle, const char *storage_id, const char *dir_p return MEDIA_SVC_PLUGIN_ERROR_NONE; } -int count_delete_items_in_folder(void *handle, const char *storage_id, const char *folder_path, int *count, char **err_msg) -{ - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - if (count == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - if (!STRING_VALID(folder_path)) { - __set_error_message(ERR_FOLDER_PATH, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_count_invalid_items_in_folder(handle, storage_id, folder_path, count); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; -} - int check_db(void *handle, uid_t uid, char **err_msg) { int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; @@ -508,29 +457,6 @@ int check_db_corrupt(void *handle, char **err_msg) return MEDIA_SVC_PLUGIN_ERROR_NONE; } -int get_folder_list(void *handle, const char *storage_id, char *start_path, char ***folder_list, int **modified_time_list, int *count, char **err_msg) -{ - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - if (count == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_get_folder_list(handle, start_path, folder_list, (time_t **)modified_time_list, count); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; -} - int update_folder_time(void *handle, const char *storage_id, char *folder_path, uid_t uid, char **err_msg) { int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; @@ -982,24 +908,6 @@ int set_folder_validity(void * handle, const char *storage_id, const char* start return MEDIA_SVC_PLUGIN_ERROR_NONE; } -int delete_invalid_folder_by_path(void * handle, const char *storage_id, const char *folder_path, uid_t uid, int *delete_count, char **err_msg) -{ - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_delete_invalid_folder_by_path(handle, storage_id, folder_path, uid, delete_count); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - return MEDIA_SVC_PLUGIN_ERROR_NONE; -} - int get_folder_scan_status(void *handle, const char *storage_id, const char *path, int *status, char **err_msg) { int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; @@ -1113,27 +1021,6 @@ int check_folder_exist(void * handle, const char *storage_id, const char *folder return MEDIA_SVC_PLUGIN_ERROR_NONE; } -int count_subfolder(void *handle, const char *storage_id, const char *folder_path, int *count, char **err_msg) -{ - int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; - int cnt = 0; - - if (handle == NULL) { - __set_error_message(ERR_HANDLE, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - ret = media_svc_check_subfolder_by_path(handle, storage_id, folder_path, &cnt); - if (ret < 0) { - __set_error_message(ret, err_msg); - return MEDIA_SVC_PLUGIN_ERROR; - } - - *count = cnt; - - return MEDIA_SVC_PLUGIN_ERROR_NONE; -} - int get_folder_id(void * handle, const char *storage_id, const char *path, char *folder_id, char **err_msg) { int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; diff --git a/src/common/media-svc-media-folder.c b/src/common/media-svc-media-folder.c index 89c9711..f3f1548 100755 --- a/src/common/media-svc-media-folder.c +++ b/src/common/media-svc-media-folder.c @@ -334,96 +334,6 @@ static int __media_svc_count_all_folders(sqlite3 *handle, char *start_path, int return MS_MEDIA_ERR_NONE; } -int _media_svc_get_all_folders(sqlite3 *handle, char *start_path, char ***folder_list, time_t **modified_time_list, int *count) -{ - int ret = MS_MEDIA_ERR_NONE; - int idx = 0; - sqlite3_stmt *sql_stmt = NULL; - char *sql = NULL; - int cnt = 0; - char **folder_uuid = NULL; - int i = 0; - - ret = __media_svc_count_all_folders(handle, start_path, &cnt); - if (ret != MS_MEDIA_ERR_NONE) { - media_svc_error("error when __media_svc_count_all_folders. err = [%d]", ret); - return ret; - } - - if (cnt > 0) { - sql = sqlite3_mprintf("SELECT path, modified_time, folder_uuid FROM '%s' WHERE path LIKE '%q%%'", MEDIA_SVC_DB_TABLE_FOLDER, start_path); - } else { - *folder_list = NULL; - *modified_time_list = NULL; - return MS_MEDIA_ERR_NONE; - } - - *folder_list = malloc(sizeof(char *) * cnt); - *modified_time_list = malloc(sizeof(int) * cnt); - folder_uuid = malloc(sizeof(char *) * cnt); - - if ((*folder_list == NULL) || (*modified_time_list == NULL) || (folder_uuid == NULL)) { - media_svc_error("Out of memory"); - goto ERROR; - } - memset(folder_uuid, 0x0, sizeof(char *) * cnt); - memset(*folder_list, 0x0, sizeof(char *) * cnt); - - ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); - if (ret != MS_MEDIA_ERR_NONE) { - media_svc_error("prepare error [%s]", sqlite3_errmsg(handle)); - goto ERROR; - } - - media_svc_debug("QEURY OK"); - - while (idx < cnt) { - (*folder_list)[idx] = g_strdup((char *)sqlite3_column_text(sql_stmt, 0)); - (*modified_time_list)[idx] = (int)sqlite3_column_int(sql_stmt, 1); - - /* get the folder's id */ - folder_uuid[idx] = g_strdup((char *)sqlite3_column_text(sql_stmt, 2)); - - idx++; - - if (sqlite3_step(sql_stmt) != SQLITE_ROW) - break; - } - SQLITE3_FINALIZE(sql_stmt); - - if (cnt == idx) { - *count = cnt; - media_svc_debug("Get Folder is OK"); - } else { - media_svc_error("Fail to get folder"); - ret = MS_MEDIA_ERR_INTERNAL; - goto ERROR; - } - - /* free all data */ - for (i = 0; i < idx; i++) - SAFE_FREE(folder_uuid[i]); - - SAFE_FREE(folder_uuid); - - return ret; - -ERROR: - - /* free all data */ - for (i = 0; i < idx; i++) { - SAFE_FREE((*folder_list)[i]); - SAFE_FREE(folder_uuid[i]); - } - SAFE_FREE(*folder_list); - SAFE_FREE(*modified_time_list); - SAFE_FREE(folder_uuid); - - *count = 0; - - return ret; -} - int _media_svc_get_folder_info_by_foldername(sqlite3 *handle, const char *storage_id, const char *folder_name, char *folder_id, time_t *modified_time) { int ret = MS_MEDIA_ERR_NONE; @@ -718,38 +628,6 @@ int _media_svc_get_null_scan_folder_list(sqlite3 *handle, const char *storage_id return ret; } -int _media_svc_delete_invalid_folder_by_path(sqlite3 *handle, const char *storage_id, const char *folder_path, uid_t uid, int *delete_count) -{ - int ret = MS_MEDIA_ERR_NONE; - char *sql = NULL; - int del_count = 0; - sqlite3_stmt *sql_stmt = NULL; - - if (folder_path == NULL) - return MS_MEDIA_ERR_INVALID_PARAMETER; - - /*check the number of the deleted folder*/ - sql = sqlite3_mprintf("SELECT count(*) FROM '%s' WHERE (storage_uuid = '%q' AND validity = 0 AND PATH LIKE '%q/%%');", MEDIA_SVC_DB_TABLE_FOLDER, storage_id, folder_path); - - ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); - media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); - - del_count = sqlite3_column_int(sql_stmt, 0); - - SQLITE3_FINALIZE(sql_stmt); - sql = NULL; - - /*delete invalid folder*/ - sql = sqlite3_mprintf("DELETE FROM '%s' WHERE (storage_uuid = '%q' AND validity = 0 AND PATH LIKE '%q%%');", MEDIA_SVC_DB_TABLE_FOLDER, storage_id, folder_path); - ret = _media_svc_sql_query(sql, uid); - - SQLITE3_SAFE_FREE(sql); - - *delete_count = del_count; - - return ret; -} - int _media_svc_count_folder_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count) { int ret = MS_MEDIA_ERR_NONE; @@ -768,24 +646,6 @@ int _media_svc_count_folder_with_path(sqlite3 *handle, const char *storage_id, c return MS_MEDIA_ERR_NONE; } -int _media_svc_count_subfolder_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count) -{ - int ret = MS_MEDIA_ERR_NONE; - sqlite3_stmt *sql_stmt = NULL; - - char *sql = sqlite3_mprintf("SELECT count(*) FROM '%s' WHERE (storage_uuid='%q' AND path LIKE'%q/%%')", MEDIA_SVC_DB_TABLE_FOLDER, storage_id, path); - - ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); - - media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); - - *count = sqlite3_column_int(sql_stmt, 0); - - SQLITE3_FINALIZE(sql_stmt); - - return MS_MEDIA_ERR_NONE; -} - int _media_svc_get_folder_uuid(sqlite3 *handle, const char *storage_id, const char *path, char *folder_id) { int ret = MS_MEDIA_ERR_NONE; diff --git a/src/common/media-svc-media.c b/src/common/media-svc-media.c index 1892d21..053c10d 100755 --- a/src/common/media-svc-media.c +++ b/src/common/media-svc-media.c @@ -61,33 +61,6 @@ static int __media_svc_get_invalid_records_with_thumbnail(sqlite3 *handle, media return MS_MEDIA_ERR_NONE; } -static int __media_svc_get_invalid_folder_records_with_thumbnail(sqlite3 *handle, const char *folder_path, const char *folder_uuid, bool is_recursive, GArray **thumb_path) -{ - int ret = MS_MEDIA_ERR_NONE; - sqlite3_stmt *sql_stmt = NULL; - char *sql = NULL; - - if (is_recursive) - sql = sqlite3_mprintf("SELECT thumbnail_path FROM '%s' WHERE validity=0 AND path LIKE '%q/%%' AND thumbnail_path IS NOT NULL", MEDIA_SVC_DB_TABLE_MEDIA, folder_path); - else - sql = sqlite3_mprintf("SELECT thumbnail_path FROM '%s' WHERE validity=0 AND folder_uuid = '%q' AND thumbnail_path IS NOT NULL", MEDIA_SVC_DB_TABLE_MEDIA, folder_uuid); - - media_svc_debug("[SQL query] : %s", sql); - - ret = _media_svc_sql_prepare_to_step_simple(handle, sql, &sql_stmt); - media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Query failed. err[%d]", ret); - - while (sqlite3_step(sql_stmt) == SQLITE_ROW) { - char *path = NULL; - path = g_strdup((const char *)sqlite3_column_text(sql_stmt, 0)); - g_array_append_val(*thumb_path, path); - } - - SQLITE3_FINALIZE(sql_stmt); - - return MS_MEDIA_ERR_NONE; -} - int _media_svc_count_record_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count) { int ret = MS_MEDIA_ERR_NONE; @@ -559,66 +532,6 @@ int _media_svc_delete_invalid_items(sqlite3 *handle, const char *storage_id, med return MS_MEDIA_ERR_NONE; } -int _media_svc_delete_invalid_folder_items(sqlite3 *handle, const char *storage_id, const char *folder_path, bool is_recursive, uid_t uid) -{ - int ret = MS_MEDIA_ERR_NONE; - char folder_uuid[MEDIA_SVC_UUID_SIZE+1] = {0,}; - GArray *thumb_list = NULL; - char *sql = NULL; - - /*get folder uuid from DB*/ - ret = _media_svc_get_folder_id_by_foldername(handle, storage_id, folder_path, folder_uuid, uid); - media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); - - thumb_list = g_array_new(FALSE, FALSE, sizeof(char*)); - - ret = __media_svc_get_invalid_folder_records_with_thumbnail(handle, folder_path, folder_uuid, is_recursive, &thumb_list); - if (ret != MS_MEDIA_ERR_NONE) { - media_svc_error("error when get thumbnail record"); - g_array_free(thumb_list, false); - thumb_list = NULL; - return ret; - } - - if (is_recursive) - sql = sqlite3_mprintf("DELETE FROM '%s' WHERE validity = 0 AND path LIKE '%q/%%';", storage_id, folder_path); - else - sql = sqlite3_mprintf("DELETE FROM '%s' WHERE validity = 0 AND folder_uuid='%q';", storage_id, folder_uuid); - - ret = _media_svc_sql_query(sql, uid); - SQLITE3_SAFE_FREE(sql); - if (ret != MS_MEDIA_ERR_NONE) { - while (thumb_list->len != 0) { - char *thumb_path = NULL; - thumb_path = g_array_index(thumb_list , char*, 0); - g_array_remove_index(thumb_list, 0); - SAFE_FREE(thumb_path); - } - g_array_free(thumb_list, false); - thumb_list = NULL; - - return ret; - } - - /*Delete thumbnails*/ - while (thumb_list->len != 0) { - char *thumb_path = NULL; - thumb_path = g_array_index(thumb_list , char*, 0); - g_array_remove_index(thumb_list, 0); - - ret = _media_svc_remove_file(thumb_path); - if (ret != MS_MEDIA_ERR_NONE) - media_svc_error("fail to remove thumbnail file."); - - SAFE_FREE(thumb_path); - } - - g_array_free(thumb_list, false); - thumb_list = NULL; - - return MS_MEDIA_ERR_NONE; -} - int _media_svc_update_item_validity(const char *storage_id, const char *path, int validity, bool stack_query, uid_t uid) { int ret = MS_MEDIA_ERR_NONE; @@ -864,27 +777,6 @@ int _media_svc_get_noti_info(sqlite3 *handle, const char *storage_id, const char return MS_MEDIA_ERR_NONE; } -int _media_svc_count_invalid_folder_items(sqlite3 *handle, const char *storage_id, const char *folder_path, int *count) -{ - int ret = MS_MEDIA_ERR_NONE; - sqlite3_stmt *sql_stmt = NULL; - - char *sql = sqlite3_mprintf("SELECT count(*) FROM '%s' WHERE validity=0 AND path LIKE '%q/%%'", storage_id, folder_path); - - ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt); - - if (ret != MS_MEDIA_ERR_NONE) { - media_svc_error("error when _media_svc_count_invalid_folder_items. err = [%d]", ret); - return ret; - } - - *count = sqlite3_column_int(sql_stmt, 0); - - SQLITE3_FINALIZE(sql_stmt); - - return MS_MEDIA_ERR_NONE; -} - int _media_svc_get_fileinfo_by_path(sqlite3 *handle, const char *storage_id, const char *path, time_t *modified_time, unsigned long long *size) { int ret = MS_MEDIA_ERR_NONE; diff --git a/src/common/media-svc.c b/src/common/media-svc.c index 4956262..4af9bde 100755 --- a/src/common/media-svc.c +++ b/src/common/media-svc.c @@ -784,19 +784,6 @@ int media_svc_delete_invalid_items_in_storage(MediaSvcHandle *handle, const char return _media_svc_delete_invalid_items(db_handle, storage_id, storage_type, uid); } -int media_svc_delete_invalid_items_in_folder(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, bool is_recursive, uid_t uid) -{ - sqlite3 *db_handle = (sqlite3 *)handle; - - media_svc_debug_fenter(); - - media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL"); - media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL"); - - /*Delete from DB and remove thumbnail files*/ - return _media_svc_delete_invalid_folder_items(db_handle, storage_id, folder_path, is_recursive, uid); -} - int media_svc_set_all_storage_items_validity(const char *storage_id, media_svc_storage_type_e storage_type, int validity, uid_t uid) { media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL"); @@ -1123,20 +1110,6 @@ int media_svc_send_dir_update_noti(MediaSvcHandle *handle, const char *storage_i return ret; } -int media_svc_count_invalid_items_in_folder(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, int *count) -{ - sqlite3 *db_handle = (sqlite3 *)handle; - - media_svc_debug_fenter(); - - media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL"); - media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL"); - media_svc_retvm_if(folder_path == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "folder_path is NULL"); - media_svc_retvm_if(count == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "count is NULL"); - - return _media_svc_count_invalid_folder_items(db_handle, storage_id, folder_path, count); -} - int media_svc_check_db_upgrade(MediaSvcHandle *handle, int user_version, uid_t uid) { sqlite3 *db_handle = (sqlite3 *)handle; @@ -1159,18 +1132,6 @@ int media_svc_check_db_corrupt(MediaSvcHandle *handle) return _media_db_check_corrupt(db_handle); } -int media_svc_get_folder_list(MediaSvcHandle *handle, char *start_path, char ***folder_list, time_t **modified_time_list, int *count) -{ - sqlite3 *db_handle = (sqlite3 *)handle; - - media_svc_debug_fenter(); - - media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL"); - media_svc_retvm_if(count == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "count is NULL"); - - return _media_svc_get_all_folders(db_handle, start_path, folder_list, modified_time_list, count); -} - int media_svc_update_folder_time(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, uid_t uid) { int ret = MS_MEDIA_ERR_NONE; @@ -2028,18 +1989,6 @@ int media_svc_change_validity_item_batch(const char *storage_id, const char *pat return _media_svc_change_validity_item_batch(storage_id, path, des_validity, src_validity, uid); } -int media_svc_delete_invalid_folder_by_path(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, uid_t uid, int *delete_count) -{ - int ret = MS_MEDIA_ERR_NONE; - sqlite3 * db_handle = (sqlite3 *)handle; - - media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL"); - - ret = _media_svc_delete_invalid_folder_by_path(db_handle, storage_id, folder_path, uid, delete_count); - - return ret; -} - int media_svc_check_folder_exist_by_path(MediaSvcHandle *handle, const char *storage_id, const char *folder_path) { int ret = MS_MEDIA_ERR_NONE; @@ -2064,32 +2013,6 @@ int media_svc_check_folder_exist_by_path(MediaSvcHandle *handle, const char *sto return MS_MEDIA_ERR_NONE; } -int media_svc_check_subfolder_by_path(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, int *count) -{ - int ret = MS_MEDIA_ERR_NONE; - sqlite3 * db_handle = (sqlite3 *)handle; - int cnt = -1; - - media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL"); - media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL"); - media_svc_retvm_if(!STRING_VALID(folder_path), MS_MEDIA_ERR_INVALID_PARAMETER, "Path is NULL"); - - *count = 0; - ret = _media_svc_count_subfolder_with_path(db_handle, storage_id, folder_path, &cnt); - media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret); - *count = cnt; - - if (cnt > 0) { - media_svc_debug("item is exist in database"); - return MS_MEDIA_ERR_NONE; - } else { - media_svc_debug("item is not exist in database"); - return MS_MEDIA_ERR_DB_NO_RECORD; - } - - return MS_MEDIA_ERR_NONE; -} - int media_svc_get_folder_id(MediaSvcHandle *handle, const char *storage_id, const char *path, char *folder_id) { int ret = MS_MEDIA_ERR_NONE; diff --git a/src/include/common/media-svc-media-folder.h b/src/include/common/media-svc-media-folder.h index bb5a651..d82689f 100755 --- a/src/include/common/media-svc-media-folder.h +++ b/src/include/common/media-svc-media-folder.h @@ -32,7 +32,6 @@ int _media_svc_update_folder_modified_time_by_folder_uuid(const char *folder_uui int _media_svc_get_and_append_folder(sqlite3 *handle, const char *storage_id, const char *path, media_svc_storage_type_e storage_type, char *folder_id, uid_t uid); int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, const char *storage_id, const char *path, media_svc_storage_type_e storage_type, char *folder_id, uid_t uid); int _media_svc_update_folder_table(const char *storage_id, uid_t uid); -int _media_svc_get_all_folders(sqlite3 *handle, char *start_path, char ***folder_list, time_t **modified_time_list, int *count); int _media_svc_get_and_append_folder_id_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, media_svc_storage_type_e storage_type, char *folder_id, bool stack_query, uid_t uid); int _media_svc_get_folder_info_by_foldername(sqlite3 *handle, const char *storage_id, const char *folder_name, char *folder_id, time_t *modified_time); int _media_svc_delete_invalid_folder(const char *storage_id, int storage_type, uid_t uid); @@ -44,9 +43,7 @@ int _media_svc_get_folder_scan_status(sqlite3 *handle, const char *storage_id, c int _media_svc_set_folder_scan_status(const char *storage_id, const char *path, int scan_status, uid_t uid); int _media_svc_get_folder_modified_time_by_path(sqlite3 *handle, const char *path, const char *storage_id, time_t *modified_time); int _media_svc_get_null_scan_folder_list(sqlite3 *handle, const char *storage_id, const char *path, char ***folder_list, int *count); -int _media_svc_delete_invalid_folder_by_path(sqlite3 *handle, const char *storage_id, const char *folder_path, uid_t uid, int *del_count); int _media_svc_count_folder_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count); -int _media_svc_count_subfolder_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count); int _media_svc_get_folder_uuid(sqlite3 *handle, const char *storage_id, const char *path, char *folder_id); #endif /*_MEDIA_SVC_MEDIA_FOLDER_H_*/ diff --git a/src/include/common/media-svc-media.h b/src/include/common/media-svc-media.h index 805d1ff..129ce27 100755 --- a/src/include/common/media-svc-media.h +++ b/src/include/common/media-svc-media.h @@ -37,7 +37,6 @@ int _media_svc_get_burst_id(sqlite3 *handle, const char *storage_id, int *id); int _media_svc_delete_item_by_path(const char *storage_id, const char *path, bool stack_query, uid_t uid); int _media_svc_truncate_table(const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid); int _media_svc_delete_invalid_items(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid); -int _media_svc_delete_invalid_folder_items(sqlite3 *handle, const char *storage_id, const char *folder_path, bool is_recursive, uid_t uid); int _media_svc_update_storage_item_validity(const char *storage_id, media_svc_storage_type_e storage_type, int validity, uid_t uid); int _media_svc_update_folder_item_validity(sqlite3 *handle, const char *storage_id, const char *folder_path, int validity, uid_t uid); int _media_svc_update_recursive_folder_item_validity(const char *storage_id, const char *folder_path, int validity, uid_t uid); @@ -46,7 +45,6 @@ int _media_svc_update_item_by_path(const char *src_path, media_svc_storage_type_ int _media_svc_list_query_do(media_svc_query_type_e query_type, uid_t uid); int _media_svc_update_thumbnail_path(const char *path, const char *thumb_path, uid_t uid); int _media_svc_get_noti_info(sqlite3 *handle, const char *storage_id, const char *path, int update_item, media_svc_noti_item **item); -int _media_svc_count_invalid_folder_items(sqlite3 *handle, const char *storage_id, const char *folder_path, int *count); int _media_svc_get_fileinfo_by_path(sqlite3 *handle, const char *storage_id, const char *path, time_t *modified_time, unsigned long long *size); int _media_svc_update_meta_with_data(media_svc_content_info_s *content_info); |