From c322a23dcec9d7014e3b18fcc2ea83f1c4f0b8ea Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Tue, 9 Aug 2016 19:20:26 +0900 Subject: [PATCH] Add some API and Fix remove folder query Change-Id: Ib48ac2bb65076661d7b4ac319bbf38845a0d9b7c Signed-off-by: Minje Ahn --- plugin/media-content-plugin.c | 110 ++++++++++++++++++++++++++++++++---- src/common/media-svc-media-folder.c | 2 +- 2 files changed, 99 insertions(+), 13 deletions(-) diff --git a/plugin/media-content-plugin.c b/plugin/media-content-plugin.c index 9cee799..992ab37 100755 --- a/plugin/media-content-plugin.c +++ b/plugin/media-content-plugin.c @@ -926,6 +926,73 @@ int update_item_extract(void * handle, const char *storage_id, int storage_type, return MEDIA_SVC_PLUGIN_ERROR_NONE; } +int get_extract_list(void* handle, const char* storage_id, int storage_type, int scan_type, const char* path, int burst, uid_t uid, void* array, char** err_msg) +{ +#if 0 + int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; + + if(handle == NULL) { + __set_error_message(ERR_HANDLE, err_msg); + return MEDIA_SVC_PLUGIN_ERROR; + } + + if(!STORAGE_VALID(storage_type)) { + __set_error_message(ERR_STORAGE_TYPE, err_msg); + return MEDIA_SVC_PLUGIN_ERROR; + } + + ret = media_svc_pass2_get_extract_list(handle, storage_id, storage_type, scan_type, path, burst, uid, array); + if(ret < 0) { + __set_error_message(ret, err_msg); + return MEDIA_SVC_PLUGIN_ERROR; + } +#endif + return MEDIA_SVC_PLUGIN_ERROR_NONE; +} + +int update_one_extract_item(void* handle, const char* storage_id, int storage_type, void* data, int burst, char** err_msg) +{ +#if 0 + int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; + + if(handle == NULL) { + __set_error_message(ERR_HANDLE, err_msg); + return MEDIA_SVC_PLUGIN_ERROR; + } + + if(!STORAGE_VALID(storage_type)) { + __set_error_message(ERR_STORAGE_TYPE, err_msg); + return MEDIA_SVC_PLUGIN_ERROR; + } + + ret = media_svc_insert_one_item_pass2(handle, storage_id, storage_type, data, burst); + if(ret < 0) { + __set_error_message(ret, err_msg); + return MEDIA_SVC_PLUGIN_ERROR; + } +#endif + return MEDIA_SVC_PLUGIN_ERROR_NONE; +} + +int query_do_update_list(void* handle, char** err_msg) +{ +#if 0 + 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_query_do_update_list(handle); + if(ret < 0) { + __set_error_message(ret, err_msg); + return MEDIA_SVC_PLUGIN_ERROR; + } +#endif + return MEDIA_SVC_PLUGIN_ERROR_NONE; +} + int insert_folder_begin(void * handle, int item_cnt, char **err_msg) { int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; @@ -1011,6 +1078,24 @@ 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; @@ -1106,7 +1191,7 @@ int change_validity_item_batch(void **handle, const char *storage_id, const char return ret; } -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 check_folder_exist(void * handle, const char *storage_id, const char *folder_path, char **err_msg) { int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; @@ -1115,7 +1200,7 @@ int delete_invalid_folder_by_path(void * handle, const char *storage_id, const c return MEDIA_SVC_PLUGIN_ERROR; } - ret = media_svc_delete_invalid_folder_by_path(handle, storage_id, folder_path, uid, delete_count); + ret = media_svc_check_folder_exist_by_path(handle, storage_id, folder_path); if (ret < 0) { __set_error_message(ret, err_msg); return MEDIA_SVC_PLUGIN_ERROR; @@ -1124,47 +1209,48 @@ int delete_invalid_folder_by_path(void * handle, const char *storage_id, const c return MEDIA_SVC_PLUGIN_ERROR_NONE; } -int check_folder_exist(void * handle, const char *storage_id, const char *folder_path, char **err_msg) +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_folder_exist_by_path(handle, storage_id, folder_path); + 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 count_subfolder(void *handle, const char *storage_id, const char *folder_path, int *count, char **err_msg) +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; - 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); + ret = media_svc_get_folder_id(handle, storage_id, path, folder_id); 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 get_media_type(void *handle, const char *path, int *mediatype, char **err_msg) { +#if 0 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE; if (handle == NULL) { @@ -1172,12 +1258,12 @@ int get_folder_id(void * handle, const char *storage_id, const char *path, char return MEDIA_SVC_PLUGIN_ERROR; } - ret = media_svc_get_folder_id(handle, storage_id, path, folder_id); + ret = media_svc_get_media_type(path, mediatype); if (ret < 0) { __set_error_message(ret, err_msg); return MEDIA_SVC_PLUGIN_ERROR; } - +#endif return MEDIA_SVC_PLUGIN_ERROR_NONE; } diff --git a/src/common/media-svc-media-folder.c b/src/common/media-svc-media-folder.c index e072551..19ecd58 100755 --- a/src/common/media-svc-media-folder.c +++ b/src/common/media-svc-media-folder.c @@ -590,7 +590,7 @@ int _media_svc_delete_invalid_folder(const char *storage_id, int storage_type, u int ret = MS_MEDIA_ERR_NONE; char *sql = NULL; - sql = sqlite3_mprintf("DELETE FROM '%s' WHERE storage_uuid = '%q' AND storage_type = %d validity = 0;", MEDIA_SVC_DB_TABLE_FOLDER, storage_type, storage_id); + sql = sqlite3_mprintf("DELETE FROM '%s' WHERE storage_uuid = '%q' AND storage_type = %d AND validity = 0;", MEDIA_SVC_DB_TABLE_FOLDER, storage_id, storage_type); ret = _media_svc_sql_query(sql, uid); sqlite3_free(sql); -- 2.7.4