int media_svc_create_table(uid_t uid);
int media_svc_check_item_exist_by_path(sqlite3 *handle, const char *storage_id, const char *path);
int media_svc_get_modified_time(sqlite3 *handle, const char *storage_id, const char *path, int *modified_time);
-int media_svc_insert_folder(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid);
+int media_svc_insert_folder(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
int media_svc_insert_item_begin(bool with_noti, int from_pid);
int media_svc_insert_item_end(uid_t uid);
-int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid);
-int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid);
+int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
+int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
int media_svc_move_item(sqlite3 *handle,
const char *src_path,
const char *dest_path,
int media_svc_set_item_validity(const char *path, int validity, 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_refresh_item(sqlite3 *handle, bool is_direct, const char *storage_id, 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_publish_noti(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_check_storage(sqlite3 *handle, const char *storage_id, char **storage_path, int *validity);
-int media_svc_insert_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, ms_user_storage_type_e storage_type, uid_t uid);
+int media_svc_insert_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, uid_t uid);
int media_svc_update_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, uid_t uid);
int media_svc_set_storage_validity(sqlite3 *handle, const char *storage_id, int validity, uid_t uid);
int media_svc_get_storage_id(sqlite3 *handle, const char *path, char *storage_id, uid_t uid);
Name: libmedia-service
Summary: Media information service library for multimedia applications
-Version: 0.4.32
+Version: 0.5.0
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0 and PD
return media_svc_insert_item_end(uid);
}
-int insert_item(sqlite3 *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid)
+int insert_item(sqlite3 *handle, const char *storage_id, const char *file_path, uid_t uid)
{
- return media_svc_insert_item_bulk(handle, storage_id, storage_type, file_path, uid);
+ return media_svc_insert_item_bulk(handle, storage_id, file_path, uid);
}
-int set_item_validity(const char *storage_id, const char *file_path, int storage_type, int validity, uid_t uid)
+int set_item_validity(const char *storage_id, const char *file_path, int validity, uid_t uid)
{
return media_svc_set_item_validity(file_path, validity, uid);
}
return media_svc_check_storage(handle, storage_id, storage_path, validity);
}
-int insert_storage(sqlite3 *handle, const char *storage_id, int storage_type, const char *storage_path, uid_t uid)
+int insert_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, uid_t uid)
{
- return media_svc_insert_storage(handle, storage_id, storage_path, storage_type, uid);
+ return media_svc_insert_storage(handle, storage_id, storage_path, uid);
}
int update_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, uid_t uid)
return media_svc_get_storage_id(handle, path, storage_id, uid);
}
-int insert_folder(sqlite3 *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid)
+int insert_folder(sqlite3 *handle, const char *storage_id, const char *file_path, uid_t uid)
{
- return media_svc_insert_folder(handle, storage_id, storage_type, file_path, uid);
+ return media_svc_insert_folder(handle, storage_id, file_path, uid);
}
int set_folder_validity(sqlite3 *handle, const char *storage_id, const char *start_path, int validity, bool is_recursive, uid_t uid)
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 media_svc_refresh_item(handle, true, storage_id, path, uid);
}
__add_column_info(&column_list[DB_LIST_MEDIA], "media_rating", DB_TYPE_INT, "DEFAULT 0", false, false, true);
__add_column_info(&column_list[DB_LIST_MEDIA], "media_favourite", DB_TYPE_INT, "DEFAULT 0", false, false, true);
__add_column_info(&column_list[DB_LIST_MEDIA], "media_is_drm", DB_TYPE_INT, "DEFAULT 0", false, false, true);
- __add_column_info(&column_list[DB_LIST_MEDIA], "media_storage_type", DB_TYPE_INT, NULL, false, false, true);
__add_column_info(&column_list[DB_LIST_MEDIA], "media_timeline", DB_TYPE_INT, "DEFAULT 0", false, false, true);
__add_column_info(&column_list[DB_LIST_MEDIA], "storage_uuid", DB_TYPE_TEXT, NULL, false, false, true);
__add_column_info(&column_list[DB_LIST_MEDIA], "validity", DB_TYPE_INT, "DEFAULT 1", false, false, false);
__add_column_info(&column_list[DB_LIST_FOLDER], "folder_path", DB_TYPE_TEXT, "NOT NULL", true, false, false);
__add_column_info(&column_list[DB_LIST_FOLDER], "folder_name", DB_TYPE_TEXT, "NOT NULL", false, false, false);
__add_column_info(&column_list[DB_LIST_FOLDER], "folder_modified_time", DB_TYPE_INT, "DEFAULT 0", false, false, false);
- __add_column_info(&column_list[DB_LIST_FOLDER], "folder_storage_type", DB_TYPE_INT, NULL, false, false, false);
__add_column_info(&column_list[DB_LIST_FOLDER], "storage_uuid", DB_TYPE_TEXT, NULL, true, false, false);
__add_column_info(&column_list[DB_LIST_FOLDER], "validity", DB_TYPE_INT, "DEFAULT 1", false, false, false);
/*storage*/
__add_column_info(&column_list[DB_LIST_STORAGE], "storage_id", DB_TYPE_TEXT, "PRIMARY KEY", false, false, false);
__add_column_info(&column_list[DB_LIST_STORAGE], "storage_path", DB_TYPE_TEXT, "NOT NULL", false, false, false);
- __add_column_info(&column_list[DB_LIST_STORAGE], "storage_type", DB_TYPE_INT, "DEFAULT 0", false, false, false);
__add_column_info(&column_list[DB_LIST_STORAGE], "validity", DB_TYPE_INT, "DEFAULT 1", false, false, false);
/*face scan list*/
return ret;
}
-static int __media_svc_append_folder(bool is_direct, const char *storage_id, ms_user_storage_type_e storage_type, const char *folder_path, uid_t uid)
+static int __media_svc_append_folder(bool is_direct, const char *storage_id, const char *folder_path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *folder_name = NULL;
folder_modified_date = _media_svc_get_file_time(folder_path);
/* Sometime SQLITE3 returns NO_RECORD, so need to consider conflict case.. */
- char *sql = sqlite3_mprintf("INSERT OR IGNORE INTO %q (folder_path, folder_name, storage_uuid, folder_storage_type, folder_modified_time) VALUES (%Q, %Q, %Q, '%d', '%d');",
- DB_TABLE_FOLDER, folder_path, folder_name, storage_id, storage_type, folder_modified_date);
+ char *sql = sqlite3_mprintf("INSERT OR IGNORE INTO %q (folder_path, folder_name, storage_uuid, folder_modified_time) VALUES (%Q, %Q, %Q, '%d');",
+ DB_TABLE_FOLDER, folder_path, folder_name, storage_id, folder_modified_date);
if (is_direct)
ret = _media_svc_sql_query_direct(sql, uid);
return ret;
}
-static int __media_svc_append_parent_folder(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, uid_t uid)
+static int __media_svc_append_parent_folder(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
unsigned int next_pos = 0;
char *next = NULL;
char *dir_path = NULL;
- const char *token = "/";
char *internal_path = NULL;
- if (storage_type == MS_USER_STORAGE_INTERNAL) {
+ if (MEDIA_ROOT_PATH_EXTERNAL && g_str_has_prefix(path, MEDIA_ROOT_PATH_EXTERNAL)) {
+ next_pos = strlen(MEDIA_ROOT_PATH_EXTERNAL) + 1;
+ } else {
ret = ms_user_get_internal_root_path(uid, &internal_path);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Fail to get root path");
next_pos = strlen(internal_path);
g_free(internal_path);
- } else {
- media_svc_retvm_if(!STRING_VALID(MEDIA_ROOT_PATH_EXTERNAL), MS_MEDIA_ERR_INTERNAL, "Failed to get root path");
- next_pos = strlen(MEDIA_ROOT_PATH_EXTERNAL) + 1;
}
do {
- next = strstr(path + next_pos, token);
+ next = strstr(path + next_pos, "/");
if (next) {
next_pos = (next - path);
dir_path = g_strndup(path, next_pos);
ret = _media_svc_check_folder_by_path(handle, dir_path);
if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
- ret = __media_svc_append_folder(is_direct, storage_id, storage_type, dir_path, uid);
+ ret = __media_svc_append_folder(is_direct, storage_id, dir_path, uid);
if (ret != MS_MEDIA_ERR_NONE)
media_svc_error("__media_svc_append_folder is failed");
else
return MS_MEDIA_ERR_NONE;
}
-int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, long long int *folder_id, uid_t uid)
+int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, long long int *folder_id, uid_t uid)
{
char *dir_path = NULL;
int ret = MS_MEDIA_ERR_NONE;
ret = __media_svc_get_folder_id(handle, dir_path, folder_id);
if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
- ret = __media_svc_append_parent_folder(handle, is_direct, storage_id, dir_path, storage_type, uid);
+ ret = __media_svc_append_parent_folder(handle, is_direct, storage_id, dir_path, uid);
if (ret != MS_MEDIA_ERR_NONE) {
media_svc_error("__media_svc_append_parent_folder failed");
goto FINALIZE;
return ret;
}
-int _media_svc_append_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, uid_t uid)
+int _media_svc_append_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
ret = _media_svc_check_folder_by_path(handle, path);
if (ret == MS_MEDIA_ERR_DB_NO_RECORD)
- ret = __media_svc_append_parent_folder(handle, true, storage_id, path, storage_type, uid);
+ ret = __media_svc_append_parent_folder(handle, true, storage_id, path, uid);
else
ret = _media_svc_set_folder_validity(true, path, 1, false, uid);
{
int ret = MS_MEDIA_ERR_NONE;
- const char *db_fields = "media_id, media_path, media_display_name, media_type, media_mime_type, media_size, media_added_time, media_modified_time, folder_id, media_thumbnail_path, media_title, album_id, media_album, media_artist, media_album_artist, media_genre, media_composer, media_year, media_recorded_date, media_copyright, media_track_num, media_description, media_bitrate, media_bitpersample, media_samplerate, media_channel, media_duration, media_longitude, media_latitude, media_altitude, exposure_time, fnumber, iso, model, media_width, media_height, media_datetaken, media_orientation, media_rating, media_storage_type, media_timeline, storage_uuid, media_360";
+ const char *db_fields = "media_id, media_path, media_display_name, media_type, media_mime_type, media_size, media_added_time, media_modified_time, folder_id, media_thumbnail_path, media_title, album_id, media_album, media_artist, media_album_artist, media_genre, media_composer, media_year, media_recorded_date, media_copyright, media_track_num, media_description, media_bitrate, media_bitpersample, media_samplerate, media_channel, media_duration, media_longitude, media_latitude, media_altitude, exposure_time, fnumber, iso, model, media_width, media_height, media_datetaken, media_orientation, media_rating, media_timeline, storage_uuid, media_360";
- const char *db_fields_basic = "media_id, media_path, media_display_name, media_type, media_mime_type, media_size, media_added_time, media_modified_time, folder_id, media_thumbnail_path, album_id, media_storage_type, media_timeline, storage_uuid, media_360";
+ const char *db_fields_basic = "media_id, media_path, media_display_name, media_type, media_mime_type, media_size, media_added_time, media_modified_time, folder_id, media_thumbnail_path, album_id, media_timeline, storage_uuid, media_360";
/* This sql is due to sqlite3_mprintf's wrong operation when using floating point in the text format */
/* This code will be removed when sqlite3_mprintf works clearly */
char *sql = sqlite3_mprintf("INSERT INTO %q(%q) VALUES (%Q, %Q, %Q, %d, %Q, %lld, %d, %d, %lld, \
%Q, %Q, %d, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, \
%d, %d, %d, %d, %d, %.6f, %.6f, %.6f, %Q, %.6f, %d, %Q, %d, %d, %Q, %d, \
- %d, %d, %d, %Q, %d);",
+ %d, %d, %Q, %d);",
DB_TABLE_MEDIA, db_fields,
content_info->media_uuid,
content_info->path,
content_info->media_meta.datetaken,
content_info->media_meta.orientation, /* 3rd line */
content_info->media_meta.rating,
- content_info->storage_type,
content_info->timeline,
content_info->storage_uuid,
content_info->media_meta.is_360 /* 4th line */
media_svc_debug("Query length is over %d byte.. So, remake query using only basic information..", MEDIA_SVC_QUERY_LEN_MAX - 1);
SQLITE3_SAFE_FREE(sql);
- sql = sqlite3_mprintf("INSERT INTO %q(%q) VALUES (%Q, %Q, %Q, %d, %Q, %lld, %d, %d, %lld, %Q, %d, %d, %d, %d, %d, %Q, %d);",
+ sql = sqlite3_mprintf("INSERT INTO %q(%q) VALUES (%Q, %Q, %Q, %d, %Q, %lld, %d, %d, %lld, %Q, %d, %d, %d, %d, %Q, %d);",
DB_TABLE_MEDIA, db_fields_basic,
content_info->media_uuid,
content_info->path,
content_info->folder_id,
content_info->thumbnail_path,
content_info->album_id,
- content_info->storage_type,
content_info->timeline,
content_info->storage_uuid,
content_info->media_meta.is_360
return ret;
}
-int _media_svc_update_item_by_path(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, long long int folder_id, uid_t uid)
+int _media_svc_update_item_by_path(const char *src_path, const char *dst_storage_id, const char *dest_path, const char *file_name, int modified_time, long long int folder_id, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- char *query = sqlite3_mprintf("UPDATE %q SET media_path=%Q, media_display_name=%Q, media_modified_time=%d, folder_id=%lld, media_storage_type=%d, storage_uuid='%q' WHERE media_path=%Q;",
- DB_TABLE_MEDIA, dest_path, file_name, modified_time, folder_id, dest_storage, dst_storage_id, src_path);
+ char *query = sqlite3_mprintf("UPDATE %q SET media_path=%Q, media_display_name=%Q, media_modified_time=%d, folder_id=%lld, storage_uuid='%q' WHERE media_path=%Q;",
+ DB_TABLE_MEDIA, dest_path, file_name, modified_time, folder_id, dst_storage_id, src_path);
ret = _media_svc_sql_query(query, uid);
SQLITE3_SAFE_FREE(query);
return MS_MEDIA_ERR_NONE;
}
-int _media_svc_append_storage(const char *storage_id, const char *storage_path, ms_user_storage_type_e storage_type, uid_t uid)
+int _media_svc_append_storage(const char *storage_id, const char *storage_path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- char *sql = sqlite3_mprintf("INSERT INTO %q (storage_id, storage_path, storage_type) values (%Q, %Q, %d);",
- DB_TABLE_STORAGE, storage_id, storage_path, storage_type);
+ char *sql = sqlite3_mprintf("INSERT INTO %q (storage_id, storage_path) values (%Q, %Q);",
+ DB_TABLE_STORAGE, storage_id, storage_path);
ret = _media_svc_sql_query_direct(sql, uid);
SQLITE3_SAFE_FREE(sql);
char *sql = NULL;
if (storage_id == NULL) {
- sql = sqlite3_mprintf("UPDATE %q SET validity=%d;UPDATE %q SET validity=%d WHERE folder_storage_type > 0;UPDATE %q SET validity=%d WHERE media_storage_type > 0;",
+ sql = sqlite3_mprintf("UPDATE %q SET validity=%d;UPDATE %q SET validity=%d WHERE storage_uuid IS NOT 'media';UPDATE %q SET validity=%d WHERE storage_uuid IS NOT 'media';",
DB_TABLE_STORAGE, validity, DB_TABLE_FOLDER, validity, DB_TABLE_MEDIA, validity);
} else {
sql = sqlite3_mprintf("UPDATE %q SET validity=%d WHERE storage_id=%Q;UPDATE %q SET validity=%d WHERE storage_uuid=%Q;UPDATE %q SET validity=%d WHERE storage_uuid=%Q;",
return statbuf.st_mtime;
}
-int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, bool refresh)
+int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, const char *path, bool refresh)
{
int ret = MS_MEDIA_ERR_NONE;
char mime_type[256] = {0, };
media_svc_media_type_e media_type;
- media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
media_svc_retvm_if(!STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
content_info->path = g_strdup(path);
content_info->storage_uuid = g_strdup(storage_id);
media_svc_retv_del_if(content_info->storage_uuid == NULL, MS_MEDIA_ERR_INTERNAL, content_info);
- content_info->storage_type = storage_type;
time(&content_info->added_time);
content_info->media_uuid = __media_info_generate_uuid();
content_info->mime_type = g_strdup(mime_type);
media_svc_retv_del_if(content_info->mime_type == NULL, MS_MEDIA_ERR_INTERNAL, content_info);
- media_svc_sec_debug("storage[%d], path[%s], media_type[%d]", storage_type, path, media_type);
+ media_svc_sec_debug("path[%s], media_type[%d]", path, media_type);
content_info->media_type = media_type;
int album_id = 0;
int ret = MS_MEDIA_ERR_NONE;
int convert_value = 0;
+ bool support_albumart = ms_user_thumb_support(uid, content_info->path);
/*Get Content Tag attribute ===========*/
- if (content_info->storage_type == MS_USER_STORAGE_EXTERNAL_USB)
- mmf_error = mm_file_create_tag_attrs_no_albumart(&tag, content_info->path);
- else
+ if (support_albumart)
mmf_error = mm_file_create_tag_attrs(&tag, content_info->path);
+ else
+ mmf_error = mm_file_create_tag_attrs_no_albumart(&tag, content_info->path);
if (mmf_error == FILEINFO_ERROR_NONE) {
content_info->media_meta.title = __media_svc_get_title(tag, content_info->path);
mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_SPHERICAL, &content_info->media_meta.is_360, NULL);
/*Do not extract artwork for the USB Storage content*/
- if (content_info->storage_type != MS_USER_STORAGE_EXTERNAL_USB) {
+ if (support_albumart) {
mmf_error = mm_file_get_attrs(tag, MM_FILE_TAG_ARTWORK, &image, &size, NULL);
if (mmf_error != FILEINFO_ERROR_NONE)
media_svc_error("fail to get tag artwork - err(%x)", mmf_error);
media_svc_retvm_if(!thumb_path, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid thumb_path");
media_svc_retvm_if(!g_file_test(path, G_FILE_TEST_IS_REGULAR), MS_MEDIA_ERR_INVALID_PARAMETER, "File doesn't exist[%s]", path);
- ms_user_storage_type_e store_type = -1;
- ret = ms_user_get_storage_type(uid, path, &store_type);
-
- if ((ret != MS_MEDIA_ERR_NONE) || ((store_type != MS_USER_STORAGE_INTERNAL) && (store_type != MS_USER_STORAGE_EXTERNAL))) {
- media_svc_sec_error("origin path(%s) is invalid. err : [%d] store_type [%d]", path, ret, store_type);
+ if (!ms_user_thumb_support(uid, path)) {
+ media_svc_sec_error("origin path(%s) is invalid", path);
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
return ret;
}
-bool _media_svc_is_valid_storage_type(ms_user_storage_type_e storage_type)
-{
- switch (storage_type) {
- case MS_USER_STORAGE_INTERNAL:
- case MS_USER_STORAGE_EXTERNAL:
- case MS_USER_STORAGE_EXTERNAL_USB:
- return true;
- default:
- media_svc_error("storage type is incorrect[%d]", storage_type);
- return false;
- }
-}
-
bool _media_svc_is_keyword_included(const char *path, const char *keyword)
{
bool ret = false;
return ret;
}
-int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid)
+int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
long long int folder_id = 0;
media_svc_retvm_if(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(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
- media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
media_svc_content_info_s content_info;
memset(&content_info, 0, sizeof(media_svc_content_info_s));
/*Set media info*/
- ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, path, false);
+ ret = _media_svc_set_media_info(&content_info, storage_id, path, false);
if (ret != MS_MEDIA_ERR_NONE)
return ret;
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
/*Set or Get folder id*/
- ret = _media_svc_get_and_append_folder_id_by_path(handle, true, storage_id, path, storage_type, &folder_id, uid);
+ ret = _media_svc_get_and_append_folder_id_by_path(handle, true, storage_id, path, &folder_id, uid);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
content_info.folder_id = folder_id;
return MS_MEDIA_ERR_NONE;
}
-int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid)
+int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
long long int folder_id = 0;
media_svc_retvm_if(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(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
- media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
media_svc_content_info_s content_info;
memset(&content_info, 0, sizeof(media_svc_content_info_s));
/*Set media info*/
- ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, path, false);
+ ret = _media_svc_set_media_info(&content_info, storage_id, path, false);
if (ret != MS_MEDIA_ERR_NONE)
return ret;
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
/*Set or Get folder id*/
- ret = _media_svc_get_and_append_folder_id_by_path(handle, false, storage_id, path, storage_type, &folder_id, uid);
+ ret = _media_svc_get_and_append_folder_id_by_path(handle, false, storage_id, path, &folder_id, uid);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
content_info.folder_id = folder_id;
long long int folder_id = 0;
char old_thumb_path[MEDIA_SVC_PATHNAME_SIZE] = {0, };
char dst_stg_id[MEDIA_SVC_UUID_SIZE + 1] = {0, };
- ms_user_storage_type_e org_stg_type = MS_USER_STORAGE_INTERNAL;
- ms_user_storage_type_e dst_stg_type = MS_USER_STORAGE_INTERNAL;
media_svc_debug_fenter();
/* Get storage_id */
ret = _media_svc_get_storage_uuid(handle, dest_path, dst_stg_id, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- /* Get storage_type */
- ret = ms_user_get_storage_type(uid, src_path, &org_stg_type);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = ms_user_get_storage_type(uid, dest_path, &dst_stg_type);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/*check and update folder*/
- ret = _media_svc_get_and_append_folder_id_by_path(handle, false, dst_stg_id, dest_path, dst_stg_type, &folder_id, uid);
+ ret = _media_svc_get_and_append_folder_id_by_path(handle, false, dst_stg_id, dest_path, &folder_id, uid);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/*get filename*/
_media_svc_remove_file(old_thumb_path);
/*move item*/
- ret = _media_svc_update_item_by_path(src_path, dst_stg_id, dst_stg_type, dest_path, file_name, modified_time, folder_id, uid);
+ ret = _media_svc_update_item_by_path(src_path, dst_stg_id, dest_path, file_name, modified_time, folder_id, uid);
g_free(file_name);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
return MS_MEDIA_ERR_NONE;
}
-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_refresh_item(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char thumb_path[MEDIA_SVC_PATHNAME_SIZE + 1] = {0, };
media_svc_retvm_if(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(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
- media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
/*Set media info*/
- ret = _media_svc_set_media_info(&content_info, storage_id, storage_type, path, true);
+ ret = _media_svc_set_media_info(&content_info, storage_id, path, true);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/* Initialize thumbnail information to remake thumbnail. */
return _media_svc_update_storage_path(handle, storage_id, storage_path, uid);
}
-int media_svc_insert_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, ms_user_storage_type_e storage_type, uid_t uid)
+int media_svc_insert_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
media_svc_retvm_if(handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
media_svc_retvm_if(storage_id == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
media_svc_retvm_if(storage_path == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "storage_path is NULL");
- media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
- ret = _media_svc_append_storage(storage_id, storage_path, storage_type, uid);
+ ret = _media_svc_append_storage(storage_id, storage_path, uid);
media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "append storage failed : %d", ret);
/* Remove external storage that validity is 0 */
return ret;
}
-int media_svc_insert_folder(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid)
+int media_svc_insert_folder(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
{
media_svc_retvm_if(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(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
- media_svc_retvm_if(!_media_svc_is_valid_storage_type(storage_type), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
- return _media_svc_append_by_folder_path(handle, storage_id, path, storage_type, uid);
+ return _media_svc_append_by_folder_path(handle, storage_id, path, uid);
}
int media_svc_set_folder_validity(const char *start_path, int validity, bool is_recursive, uid_t uid)
#include <media-util.h>
int _media_svc_update_folder_modified_time(const char *folder_path, uid_t uid);
-int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, long long int *folder_id, uid_t uid);
-int _media_svc_append_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, ms_user_storage_type_e storage_type, uid_t uid);
+int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, long long int *folder_id, uid_t uid);
+int _media_svc_append_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
int _media_svc_set_folder_validity(bool is_direct, const char *start_path, int validity, bool is_recursive, uid_t uid);
int _media_svc_check_folder_by_path(sqlite3 *handle, const char *path);
int _media_svc_get_thumbnail_path_by_path(sqlite3 *handle, const char *path, char *thumbnail_path);
int _media_svc_delete_item_by_path(const char *path, uid_t uid);
int _media_svc_update_item_validity(const char *path, int validity, bool stack_query, uid_t uid);
-int _media_svc_update_item_by_path(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, long long int folder_id, uid_t uid);
+int _media_svc_update_item_by_path(const char *src_path, const char *dst_storage_id, const char *dest_path, const char *file_name, int modified_time, long long int folder_id, uid_t uid);
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 *path, media_svc_noti_item **item);
#include <sqlite3.h>
int _media_svc_check_storage(sqlite3 *handle, const char *storage_id, char **storage_path, int *validity);
-int _media_svc_append_storage(const char *storage_id, const char *storage_path, ms_user_storage_type_e storage_type, uid_t uid);
+int _media_svc_append_storage(const char *storage_id, const char *storage_path, uid_t uid);
int _media_svc_update_storage_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
int _media_svc_delete_invalid_storage(sqlite3 *handle, uid_t uid);
int _media_svc_update_storage_validity(const char *storage_id, int validity, uid_t uid);
long long int folder_id; /**< Unique ID of folder */
int album_id; /**< Unique ID of album */
char *thumbnail_path; /**< Thumbnail image file path */
- int storage_type; /**< Storage of media file : internal/external */
char *storage_uuid; /**< Unique ID of storage */
media_svc_content_meta_s media_meta; /**< meta data structure for audio files */
} media_svc_content_info_s;
int _media_svc_get_thumbnail_path(char *thumb_path, const char *pathname, const char *img_format, uid_t uid);
int _media_svc_get_file_time(const char *full_path);
char * _media_svc_get_title_by_path(const char *path);
-int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, bool refresh);
+int _media_svc_set_media_info(media_svc_content_info_s *content_info, const char *storage_id, const char *path, bool refresh);
int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info);
int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc_content_info_s *content_info, uid_t uid);
int _media_svc_extract_book_metadata(media_svc_content_info_s *content_info);
void _media_svc_destroy_content_info(media_svc_content_info_s *content_info);
int _media_svc_create_thumbnail(const char *path, char *thumb_path, media_svc_media_type_e media_type, uid_t uid);
int _media_svc_get_media_type(const char *path, int *mediatype);
-bool _media_svc_is_valid_storage_type(ms_user_storage_type_e storage_type);
bool _media_svc_is_keyword_included(const char *path, const char *keyword);
void _media_svc_update_wordbook(const char *path, uid_t uid);
void _media_svc_clean_wordbook(uid_t uid);