int media_svc_set_item_validity_begin(int data_cnt);
int media_svc_set_item_validity_end(uid_t uid);
int media_svc_set_item_validity(const char *storage_id, const char *path, int validity, uid_t uid);
-int media_svc_delete_item_by_path(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, uid_t uid);
+int media_svc_delete_item_by_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
int media_svc_refresh_item(sqlite3 *handle, bool is_direct, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid);
int media_svc_send_dir_update_noti(const char *dir_path, const char *folder_id, media_item_update_type_e update_type, int pid);
int media_svc_check_db_upgrade(sqlite3 *handle, int user_version, uid_t uid);
Name: libmedia-service
Summary: Media information service library for multimedia applications
-Version: 0.4.2
+Version: 0.4.3
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0 and PD
return media_svc_set_item_validity(storage_id, file_path, validity, uid);
}
-int delete_item(sqlite3 *handle, const char *storage_id, const char *file_path, uid_t uid)
-{
- return media_svc_delete_item_by_path(handle, true, storage_id, file_path, uid);
-}
-
int send_dir_update_noti(const char *dir_path, const char *folder_id, int update_type, int pid)
{
return media_svc_send_dir_update_noti(dir_path, folder_id, (media_item_update_type_e)update_type, pid);
return MS_MEDIA_ERR_NONE;
}
-int _media_svc_delete_item_by_path(bool is_direct, const char *storage_id, const char *path, bool stack_query, uid_t uid)
+int _media_svc_delete_item_by_path(const char *storage_id, const char *path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = NULL;
sql = sqlite3_mprintf("DELETE FROM '%q' WHERE media_path='%q';", storage_id, path);
- if (!stack_query) {
- if (is_direct)
- ret = _media_svc_sql_query_direct(sql, uid);
- else
- ret = _media_svc_sql_query(sql, uid);
- SQLITE3_SAFE_FREE(sql);
- if (ret != MS_MEDIA_ERR_NONE) {
- media_svc_error("failed to delete item");
- return ret;
- }
- } else {
- media_svc_debug("query : %s", sql);
- _media_svc_sql_query_add(&g_media_svc_insert_item_query_list, &sql);
- }
+ ret = _media_svc_sql_query(sql, uid);
+ SQLITE3_SAFE_FREE(sql);
+ media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "failed to delete item");
return ret;
}
return MS_MEDIA_ERR_NONE;
}
-int media_svc_delete_item_by_path(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, uid_t uid)
+int media_svc_delete_item_by_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char thumb_path[MEDIA_SVC_PATHNAME_SIZE] = {0, };
+ media_svc_noti_item *noti_item = NULL;
media_svc_debug_fenter();
ret = _media_svc_get_thumbnail_path_by_path(handle, path, thumb_path);
media_svc_retv_if((ret != MS_MEDIA_ERR_NONE) && (ret != MS_MEDIA_ERR_DB_NO_RECORD), ret);
- if (g_media_svc_insert_item_data_cnt == 1) {
-
- /* Get notification info */
- media_svc_noti_item *noti_item = NULL;
- ret = _media_svc_get_noti_info(handle, storage_id, path, ¬i_item);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
-
- /*Delete item*/
- ret = _media_svc_delete_item_by_path(is_direct, storage_id, path, FALSE, uid);
- if (ret != MS_MEDIA_ERR_NONE) {
- media_svc_error("_media_svc_delete_item_by_path failed : %d", ret);
- _media_svc_destroy_noti_item(noti_item);
-
- return ret;
- }
+ /* Get notification info */
+ ret = _media_svc_get_noti_info(handle, storage_id, path, ¬i_item);
+ media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- /* Send notification */
- media_svc_debug("Deletion is successful. Sending noti for this");
- _media_svc_publish_noti(MS_MEDIA_ITEM_DELETE, path, noti_item->media_type, noti_item->media_uuid, noti_item->mime_type);
+ /*Delete item*/
+ ret = _media_svc_delete_item_by_path(storage_id, path, uid);
+ if (ret != MS_MEDIA_ERR_NONE) {
+ media_svc_error("_media_svc_delete_item_by_path failed : %d", ret);
_media_svc_destroy_noti_item(noti_item);
- } else {
- ret = _media_svc_delete_item_by_path(is_direct, storage_id, path, TRUE, uid);
- if (ret != MS_MEDIA_ERR_NONE) {
- media_svc_error("_media_svc_delete_item_by_path failed : %d", ret);
- return ret;
- }
+ return ret;
}
+ /* Send notification */
+ media_svc_debug("Deletion is successful. Sending noti for this");
+ _media_svc_publish_noti(MS_MEDIA_ITEM_DELETE, path, noti_item->media_type, noti_item->media_uuid, noti_item->mime_type);
+ _media_svc_destroy_noti_item(noti_item);
+
/*Delete thumbnail*/
if (STRING_VALID(thumb_path)) {
ret = _media_svc_remove_file(thumb_path);
int _media_svc_update_item_with_data(bool is_direct, const char *storage_id, media_svc_content_info_s *content_info, uid_t uid);
int _media_svc_get_thumbnail_path_by_path(sqlite3 *handle, const char *path, char *thumbnail_path);
int _media_svc_get_media_type_by_path(sqlite3 *handle, const char *storage_id, const char *path, int *media_type);
-int _media_svc_delete_item_by_path(bool is_direct, const char *storage_id, const char *path, bool stack_query, uid_t uid);
+int _media_svc_delete_item_by_path(const char *storage_id, const char *path, uid_t uid);
int _media_svc_update_item_validity(const char *storage_id, const char *path, int validity, bool stack_query, uid_t uid);
int _media_svc_update_item_by_path(const char *org_storage_id, const char *src_path, const char *dst_storage_id, ms_user_storage_type_e dest_storage, const char *dest_path, const char *file_name, int modified_time, const char *folder_uuid, uid_t uid);
int _media_svc_list_query_do(media_svc_query_type_e query_type, uid_t uid);