This logic is for MX feature.
Change-Id: I88f4d307aff1f70fbee8f89d9b40bed5e913babf
Signed-off-by: minje.ahn <minje.ahn@samsung.com>
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_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_update_item_meta(sqlite3 *handle, uid_t uid);
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);
Name: libmedia-service
Summary: Media information service library for multimedia applications
-Version: 0.4.30
+Version: 0.4.31
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0 and PD
return media_svc_get_storage_id(handle, path, storage_id, uid);
}
-int update_item_meta(sqlite3 *handle, uid_t uid)
-{
- return media_svc_update_item_meta(handle, uid);
-}
-
int insert_folder(sqlite3 *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid)
{
return media_svc_insert_folder(handle, storage_id, storage_type, file_path, uid);
return MS_MEDIA_ERR_NONE;
}
-int _media_svc_update_meta_with_data(media_svc_content_info_s *content_info)
-{
- int ret = MS_MEDIA_ERR_NONE;
- media_svc_retvm_if(!content_info, MS_MEDIA_ERR_INTERNAL, "content_info is NULL");
-
- /* 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 *test_sql = sqlite3_mprintf("%f, %f, %f", content_info->media_meta.longitude, content_info->media_meta.latitude, content_info->media_meta.altitude);
- SQLITE3_SAFE_FREE(test_sql);
-
- char *sql = sqlite3_mprintf("UPDATE %q SET media_title=%Q, media_album=%Q, media_artist=%Q, media_album_artist=%Q, media_genre=%Q, media_composer=%Q, media_copyright=%Q, media_description=%Q WHERE media_path=%Q;",
- DB_TABLE_MEDIA,
- content_info->media_meta.title,
- content_info->media_meta.album,
- content_info->media_meta.artist,
- content_info->media_meta.album_artist,
- content_info->media_meta.genre,
- content_info->media_meta.composer,
- content_info->media_meta.copyright,
- content_info->media_meta.description,
- content_info->path
- );
-
- if (sql != NULL) {
- media_svc_debug("query[%s]", sql);
- _media_svc_sql_query_add(&g_media_svc_scanner_query_list, &sql);
- } else {
- media_svc_error("sqlite3_mprintf failed");
- ret = MS_MEDIA_ERR_OUT_OF_MEMORY;
- }
-
- return ret;
-}
-
int _media_svc_update_item_with_data(bool is_direct, media_svc_content_info_s *content_info, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
return ret;
}
-
-int _media_svc_get_storage_path(sqlite3 *handle, GPtrArray **storage_path)
-{
- int ret = MS_MEDIA_ERR_NONE;
- sqlite3_stmt *sql_stmt = NULL;
- char *sql = NULL;
- char *root_path = NULL;
-
- media_svc_retvm_if(!storage_path, MS_MEDIA_ERR_INVALID_PARAMETER, "storage_path is NULL");
-
- sql = sqlite3_mprintf("SELECT storage_path FROM %q WHERE validity=1", DB_TABLE_STORAGE);
-
- ret = _media_svc_sql_prepare_to_step_simple(handle, sql, &sql_stmt);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
-
- while (sqlite3_step(sql_stmt) == SQLITE_ROW) {
- root_path = g_strdup((const char *)sqlite3_column_text(sql_stmt, 0));
- g_ptr_array_add(*storage_path, root_path);
- }
-
- SQLITE3_FINALIZE(sql_stmt);
-
- return ret;
-}
-
return g_strdup(MEDIA_SVC_TAG_UNKNOWN);
}
-int _media_svc_extract_music_metadata_for_update(media_svc_content_info_s *content_info, const char *path)
-{
- MMHandleType tag = 0;
- int mmf_error = FILEINFO_ERROR_NONE;
-
- content_info->path = g_strdup(path);
-
- 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);
- content_info->media_meta.album = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_ALBUM);
- content_info->media_meta.artist = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_ARTIST);
- content_info->media_meta.album_artist = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_ALBUM_ARTIST);
- content_info->media_meta.genre = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_GENRE);
- content_info->media_meta.description = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_DESCRIPTION);
- content_info->media_meta.composer = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_AUTHOR);
- content_info->media_meta.copyright = __media_svc_get_tag_str_value(tag, MM_FILE_TAG_COPYRIGHT);
- } else {
- content_info->media_meta.title = __media_svc_get_title(NULL, content_info->path);
- }
-
- mm_file_destroy_tag_attrs(tag);
-
- return MS_MEDIA_ERR_NONE;
-}
-
int _media_svc_extract_media_metadata(sqlite3 *handle, bool is_direct, media_svc_content_info_s *content_info, uid_t uid)
{
MMHandleType content = 0;
return _media_svc_publish_dir_noti(update_type, dir_path, folder_id, pid);
}
-static void __media_svc_noti_all_storage(sqlite3 *handle, uid_t uid)
-{
- int ret = MS_MEDIA_ERR_NONE;
- char *root_path = NULL;
- GPtrArray *path_list = NULL;
- guint i = 0;
-
- ret = ms_user_get_internal_root_path(uid, &root_path);
- media_svc_retm_if(ret != MS_MEDIA_ERR_NONE, "Fail to get root path");
-
- ret = _media_svc_publish_dir_noti(MS_MEDIA_ITEM_UPDATE, root_path, NULL, 0);
- if (ret != MS_MEDIA_ERR_NONE)
- media_svc_error("Fail to send noti");
-
- g_free(root_path);
-
- path_list = g_ptr_array_new_with_free_func(g_free);
- _media_svc_get_storage_path(handle, &path_list);
-
- for (i = 0; i < path_list->len; i++) {
- root_path = g_ptr_array_index(path_list, i);
-
- ret = _media_svc_publish_dir_noti(MS_MEDIA_ITEM_UPDATE, root_path, NULL, 0);
- if (ret != MS_MEDIA_ERR_NONE)
- media_svc_error("Fail to send noti");
- }
-
- g_ptr_array_free(path_list, TRUE);
-}
-
-static void __media_svc_foreach_update_media(gpointer data, gpointer user_data)
-{
- media_svc_content_info_s content_info = {0, };
-
- if (_media_svc_extract_music_metadata_for_update(&content_info, (const char *)data) != MS_MEDIA_ERR_NONE) {
- media_svc_error("Fail to extract metadata");
- _media_svc_destroy_content_info(&content_info);
- return;
- }
-
- if (_media_svc_update_meta_with_data(&content_info) != MS_MEDIA_ERR_NONE)
- media_svc_error("Fail to append item[%s]", content_info.path);
-
- _media_svc_destroy_content_info(&content_info);
-}
-
-int media_svc_update_item_meta(sqlite3 *handle, uid_t uid)
-{
- int ret = MS_MEDIA_ERR_NONE;
- char *sql = NULL;
- GList *path_list = NULL;
-
- sql = sqlite3_mprintf("SELECT media_path FROM %q WHERE media_type=3 AND validity=1", DB_TABLE_MEDIA);
- ret = _media_svc_get_media(handle, sql, &path_list);
- media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Fail to get media list");
-
- if (path_list) {
- g_list_foreach(path_list, __media_svc_foreach_update_media, NULL);
- g_list_free_full(path_list, g_free);
-
- ret = _media_svc_list_query_do(MEDIA_SVC_QUERY_SCANNER, uid);
- media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "_media_svc_list_query_do failed");
- }
-
- /* Noti for this */
- __media_svc_noti_all_storage(handle, uid);
-
- return ret;
-}
-
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_publish_noti(update_type, path, media_type, uuid, mime_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 *path, media_svc_noti_item **item);
-int _media_svc_update_meta_with_data(media_svc_content_info_s *content_info);
int _media_svc_append_query_list(const char *query, uid_t uid);
int _media_svc_get_media(sqlite3 *handle, const char *sql, GList **path_list);
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);
int _media_svc_get_storage_uuid(sqlite3 *handle, const char *path, char *storage_id, uid_t uid);
-int _media_svc_get_storage_path(sqlite3 *handle, GPtrArray **storage_path);
#endif /*_MEDIA_SVC_STORAGE_H_*/
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_extract_music_metadata_for_update(media_svc_content_info_s *content_info, const char *path);
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);