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_refresh_item(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, 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);
int media_svc_publish_noti(media_item_update_type_e update_type, const char *path, media_type_e media_type, const char *uuid, const char *mime_type);
{
return media_svc_get_media_type(path, mediatype);
}
+
+int refresh_item(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
+{
+ int ret = MS_MEDIA_ERR_NONE;
+ ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
+
+ ret = ms_user_get_storage_type(uid, path, &storage_type);
+ if (ret != MS_MEDIA_ERR_NONE)
+ return ret;
+
+ return media_svc_refresh_item(handle, true, storage_id, storage_type, path, uid);
+}
return ret;
}
-int _media_svc_update_item_with_data(const char *storage_id, media_svc_content_info_s *content_info, uid_t uid)
+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 ret = MS_MEDIA_ERR_NONE;
content_info->path
);
- ret = _media_svc_sql_query(sql, uid);
+ /* Scanner use only batch insert */
+ if (is_direct) {
+ media_svc_sec_debug("Query [%s]", sql);
+ _media_svc_sql_query_add(&g_media_svc_insert_item_query_list, &sql);
+ } else {
+ ret = _media_svc_sql_query(sql, uid);
+ }
SQLITE3_SAFE_FREE(sql);
return ret;
return MS_MEDIA_ERR_NONE;
}
-int media_svc_refresh_item(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, 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 ret = MS_MEDIA_ERR_NONE;
char thumb_path[MEDIA_SVC_PATHNAME_SIZE + 1] = {0, };
else if (content_info.media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE)
ret = _media_svc_extract_image_metadata(&content_info);
else
- ret = _media_svc_extract_media_metadata(handle, false, &content_info, uid);
+ ret = _media_svc_extract_media_metadata(handle, is_direct, &content_info, uid);
if (ret != MS_MEDIA_ERR_NONE) {
_media_svc_destroy_noti_item(noti_item);
}
}
- ret = _media_svc_update_item_with_data(storage_id, &content_info, uid);
+ ret = _media_svc_update_item_with_data(is_direct, storage_id, &content_info, uid);
if (ret == MS_MEDIA_ERR_NONE) {
media_svc_debug("Update is successful. Sending noti for this");
int _media_svc_count_record_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count);
int _media_svc_get_modified_time(sqlite3 *handle, const char *storage_id, const char *path, int *modified_time);
int _media_svc_insert_item_with_data(sqlite3 *handle, bool is_direct, const char *storage_id, media_svc_content_info_s *content_info, bool stack_query, uid_t uid);
-int _media_svc_update_item_with_data(const char *storage_id, media_svc_content_info_s *content_info, uid_t uid);
+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);