#define test_image_id "db1c184c-6f31-43b4-b924-8c00ac5b6197"
media_folder_h g_folder = NULL;
-bool get_audio_meta(audio_meta_h audio)
+void get_audio_meta(audio_meta_h audio)
{
char *c_value = NULL;
int i_value = 0;
media_content_error("error when get meta : [%d]", ret);
media_content_debug("duration : [%d]", i_value);
- return true;
}
-bool get_video_meta(video_meta_h video)
+void get_video_meta(video_meta_h video)
{
char *c_value = NULL;
int i_value = 0;
media_content_error("error when get meta : [%d]", ret);
media_content_debug("height : [%d]", i_value);
- return true;
+}
+
+void get_image_meta(image_meta_h image)
+{
+ char *c_value = NULL;
+ int i_value = 0;
+ media_content_orientation_e orientation;
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ media_content_debug("=== image meta ===");
+
+ ret = image_meta_get_width(image, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error image_meta_get_width : [%d]", ret);
+ media_content_debug("width : [%d]", i_value);
+
+ ret = image_meta_get_height(image, &i_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error image_meta_get_height : [%d]", ret);
+ media_content_debug("height : [%d]", i_value);
+
+ ret = image_meta_get_orientation(image, &orientation);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error image_meta_get_orientation : [%d]", ret);
+ media_content_debug("orientation : [%d]", orientation);
+
+ ret = image_meta_get_date_taken(image, &c_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error image_meta_get_date_taken : [%d]", ret);
+ media_content_debug("date_taken : [%s]", c_value);
+ SAFE_FREE(c_value);
+
}
bool gallery_folder_list_cb(media_folder_h folder, void *user_data)
bool gallery_media_item_cb(media_info_h media, void *user_data)
{
media_info_h new_media = NULL;
- media_info_clone(&new_media, media);
+ int ret = MEDIA_CONTENT_ERROR_NONE;
- GList **list = (GList**)user_data;
- *list = g_list_append(*list, new_media);
+ ret = media_info_clone(&new_media, media);
+
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ GList **list = (GList**)user_data;
+ *list = g_list_append(*list, new_media);
+ }
return true;
}
} else if (media_type == MEDIA_CONTENT_TYPE_IMAGE) {
image_meta_h image;
media_content_orientation_e orientation = 0;
- bool is_burst_shot = false;
- char *burst_id = NULL;
- char *weather = NULL;
if (media_info_get_image(media, &image) == MEDIA_CONTENT_ERROR_NONE) {
ret = image_meta_get_orientation(image, &orientation);
else
media_content_debug("[image] orientation : %d", orientation);
- ret = image_meta_is_burst_shot(image, &is_burst_shot);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_is_burst_shot : [%d]", ret);
- if (is_burst_shot) {
- ret = image_meta_get_burst_id(image, &burst_id);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_burst_id : [%d]", ret);
- else
- media_content_debug("[image] burst_id : [%s]", burst_id);
-
- SAFE_FREE(burst_id);
- }
-
ret = image_meta_destroy(image);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error image_meta_destroy : [%d]", ret);
media_content_debug("description : [%s]", c_value);
SAFE_FREE(c_value);
- ret = media_info_get_author(media, &c_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get info : [%d]", ret);
- media_content_debug("author : [%s]", c_value);
- SAFE_FREE(c_value);
-
- ret = media_info_get_provider(media, &c_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get info : [%d]", ret);
- media_content_debug("provider : [%s]", c_value);
- SAFE_FREE(c_value);
-
- ret = media_info_get_content_name(media, &c_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get info : [%d]", ret);
- media_content_debug("content_name : [%s]", c_value);
- SAFE_FREE(c_value);
-
- ret = media_info_get_category(media, &c_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get info : [%d]", ret);
- media_content_debug("category : [%s]", c_value);
- SAFE_FREE(c_value);
-
- ret = media_info_get_location_tag(media, &c_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get info : [%d]", ret);
- media_content_debug("location_tag : [%s]", c_value);
- SAFE_FREE(c_value);
-
- ret = media_info_get_age_rating(media, &c_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get info : [%d]", ret);
- media_content_debug("age_rating : [%s]", c_value);
- SAFE_FREE(c_value);
-
- ret = media_info_get_keyword(media, &c_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get info : [%d]", ret);
- media_content_debug("keyword : [%s]", c_value);
- SAFE_FREE(c_value);
-
ret = media_info_get_size(media, &size);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error when get info : [%d]", ret);
media_content_error("error when get info : [%d]", ret);
media_content_debug("360 engine : [%d]", i_value);
- ret = media_info_set_weather(media, "Sunny");
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("Fail to set weather");
- return ret;
-
- ret = media_info_get_weather(media, &c_value);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error when get info : [%d]", ret);
- media_content_debug("weather : [%s]", c_value);
- SAFE_FREE(c_value);
-
- /* Media server can't update when another db handle holds DB connection by sqlite3_prepare */
- /*ret = media_info_set_location_tag(media, "Test location tag");*/
/*media_info_update_to_db(media);*/
SAFE_FREE(media_id);
#endif
int item_count = 0;
char *folder_id = NULL;
char *str_val = NULL;
- int int_val = -1;
media_content_storage_e storage_type;
bool ret;
media_folder_h *_folder = (media_folder_h*)user_data;
}
media_content_debug("folder_id = [%s]", folder_id);
- if (media_folder_get_parent_folder_id(folder, &str_val) != MEDIA_CONTENT_ERROR_NONE) {
- SAFE_FREE(folder_id);
- media_content_error("[ERROR] media_folder_get_parent_folder_id is failed");
- return false;
- }
- media_content_debug("parent_folder_id = [%s]", str_val);
- SAFE_FREE(str_val);
-
if (media_folder_get_path(folder, &str_val) != MEDIA_CONTENT_ERROR_NONE) {
SAFE_FREE(folder_id);
media_content_error("[ERROR] media_folder_get_path is failed");
media_content_debug("storage_id = [%s]", str_val);
SAFE_FREE(str_val);
- if (media_folder_get_order(folder, &int_val) != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("[ERROR] media_folder_get_order is failed");
- return false;
- }
- media_content_debug("folder_order = [%d]", int_val);
#if 1
if (media_folder_get_media_count_from_db(folder_id, g_filter, &item_count) != MEDIA_CONTENT_ERROR_NONE) {
SAFE_FREE(folder_id);
bool playlist_list_cb(media_playlist_h playlist, void *user_data)
{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
int playlist_id = 0;
char *playlist_name = NULL;
media_playlist_h playlist_h;
return false;
}
- media_playlist_get_playlist_id(playlist, &playlist_id);
+ ret = media_playlist_get_playlist_id(playlist, &playlist_id);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_get_playlist_id : [%d]", ret);
+
media_content_debug("playlist_id : %d", playlist_id);
/* 64bit build issue */
#if 0
if (user_data != NULL)
*list = g_list_append(*list, (gpointer)playlist_id);
#endif
- media_playlist_get_name(playlist, &playlist_name);
+ ret = media_playlist_get_name(playlist, &playlist_name);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_get_name : [%d]", ret);
+
media_content_debug("playlist_name : %s", playlist_name);
SAFE_FREE(playlist_name);
- media_playlist_get_thumbnail_path(playlist, &playlist_thumbnail_path);
+ ret = media_playlist_get_thumbnail_path(playlist, &playlist_thumbnail_path);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_get_thumbnail_path : [%d]", ret);
+
media_content_debug("playlist_thumbnail_path : %s", playlist_thumbnail_path);
SAFE_FREE(playlist_thumbnail_path);
- media_playlist_get_playlist_from_db(playlist_id, &playlist_h);
+ ret = media_playlist_get_playlist_from_db(playlist_id, &playlist_h);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_get_playlist_from_db : [%d]", ret);
- media_playlist_destroy(playlist_h);
+ ret = media_playlist_destroy(playlist_h);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("error media_playlist_destroy : [%d]", ret);
return true;
}
if (media_type == MEDIA_CONTENT_TYPE_IMAGE) {
image_meta_h image_handle;
- int width = 0, height = 0;
- media_content_orientation_e orientation = 0;
- char *datetaken = NULL;
- char *burst_id = NULL;
ret = media_info_get_image(media_handle, &image_handle);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_get_image failed: %d", ret);
- } else {
- ret = image_meta_get_width(image_handle, &width);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_width : [%d]", ret);
- ret = image_meta_get_height(image_handle, &height);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_height : [%d]", ret);
- ret = image_meta_get_orientation(image_handle, &orientation);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_orientation : [%d]", ret);
- ret = image_meta_get_date_taken(image_handle, &datetaken);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_date_taken : [%d]", ret);
- ret = image_meta_get_burst_id(image_handle, &burst_id);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_burst_id : [%d]", ret);
-
- media_content_debug("This is Image");
- media_content_debug("Width : %d, Height : %d, Orientation : %d, Date taken : %s", width, height, orientation, datetaken);
- }
+ else
+ get_image_meta(image_handle);
- SAFE_FREE(datetaken);
- SAFE_FREE(burst_id);
ret = image_meta_destroy(image_handle);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error image_meta_destroy : [%d]", ret);
} else if (media_type == MEDIA_CONTENT_TYPE_VIDEO) {
video_meta_h video_handle;
- char *title = NULL, *artist = NULL, *album = NULL, *album_artist = NULL;
- int duration = 0;
-
ret = media_info_get_video(media_handle, &video_handle);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_get_video failed: %d", ret);
- } else {
- ret = video_meta_get_artist(video_handle, &artist);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_artist : [%d]", ret);
- ret = video_meta_get_album(video_handle, &album);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_album : [%d]", ret);
- ret = video_meta_get_album_artist(video_handle, &album_artist);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_album_artist : [%d]", ret);
- ret = video_meta_get_duration(video_handle, &duration);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_duration : [%d]", ret);
-
- media_content_debug("This is Video");
- media_content_debug("Title: %s, Album: %s, Artist: %s, Album_artist: %s \n Duration: %d", title, album, artist, album_artist, duration);
- }
-
- SAFE_FREE(title);
- SAFE_FREE(artist);
- SAFE_FREE(album);
- SAFE_FREE(album_artist);
+ else
+ get_video_meta(video_handle);
ret = video_meta_destroy(video_handle);
if (ret != MEDIA_CONTENT_ERROR_NONE)
if (media_type == MEDIA_CONTENT_TYPE_IMAGE) {
image_meta_h image_handle;
- int width = 0, height = 0;
- media_content_orientation_e orientation = 0;
- char *datetaken = NULL;
ret = media_info_get_image(media_handle, &image_handle);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_get_image failed: %d", ret);
- } else {
- ret = image_meta_get_width(image_handle, &width);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_width : [%d]", ret);
- ret = image_meta_get_height(image_handle, &height);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_height : [%d]", ret);
- ret = image_meta_get_orientation(image_handle, &orientation);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_orientation : [%d]", ret);
- ret = image_meta_get_date_taken(image_handle, &datetaken);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error image_meta_get_date_taken : [%d]", ret);
-
- media_content_debug("This is Image");
- media_content_debug("Width : %d, Height : %d, Orientation : %d, Date taken : %s", width, height, orientation, datetaken);
- }
+ else
+ get_image_meta(image_handle);
- SAFE_FREE(datetaken);
ret = image_meta_destroy(image_handle);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("error image_meta_destroy : [%d]", ret);
} else if (media_type == MEDIA_CONTENT_TYPE_VIDEO) {
video_meta_h video_handle;
- char *title = NULL, *artist = NULL, *album = NULL, *album_artist = NULL;;
- int duration = 0;
ret = media_info_get_video(media_handle, &video_handle);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_get_video failed: %d", ret);
- } else {
- ret = video_meta_get_artist(video_handle, &artist);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_artist : [%d]", ret);
- ret = video_meta_get_album(video_handle, &album);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_album : [%d]", ret);
- ret = video_meta_get_album_artist(video_handle, &album_artist);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_album_artist : [%d]", ret);
- ret = video_meta_get_duration(video_handle, &duration);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("error video_meta_get_duration : [%d]", ret);
-
- media_content_debug("This is Video");
- media_content_debug("Title: %s, Album: %s, Artist: %s, Album_artist: %s \n Duration: %d\n", title, album, artist, album_artist, duration);
- }
-
- SAFE_FREE(title);
- SAFE_FREE(artist);
- SAFE_FREE(album);
- SAFE_FREE(album_artist);
+ else
+ get_video_meta(video_handle);
ret = video_meta_destroy(video_handle);
if (ret != MEDIA_CONTENT_ERROR_NONE)
return ret;
}
-bool folder_update_cb(media_folder_h folder, void *user_data)
-{
- char *folder_id = NULL;
- char *folder_path = NULL;
- char *folder_name = NULL;
- int folder_order = -1;
- bool ret = true;
-
- if (folder != NULL) {
- ret = media_folder_get_folder_id(folder, &folder_id);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- media_content_debug("folder_id = [%s]", folder_id);
- SAFE_FREE(folder_id);
-
- ret = media_folder_get_path(folder, &folder_path);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- media_content_debug("folder_path = [%s]", folder_path);
- SAFE_FREE(folder_path);
-
- ret = media_folder_get_name(folder, &folder_name);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- media_content_debug("folder_name = [%s]", folder_name);
- SAFE_FREE(folder_name);
-
- ret = media_folder_get_order(folder, &folder_order);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- media_content_debug("folder_order = [%d]", folder_order);
-
- ret = media_folder_clone(&g_folder, folder);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
-}
-
-
-int test_folder_update(void)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- filter_h filter;
- int folder_count = 0;
-
- media_content_debug("\n============Folder Update Test============\n\n");
-
- ret = media_filter_create(&filter);
- media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
-
- ret = media_filter_set_condition(filter, "MEDIA_TYPE=0 and MEDIA_STORAGE_TYPE=0", MEDIA_CONTENT_COLLATE_DEFAULT); /*MEDIA_TYPE 0-image, 1-video, 2-sound, 3-music, 4-other*/
- ret = media_filter_set_order(filter, MEDIA_CONTENT_ORDER_DESC, FOLDER_ORDER, MEDIA_CONTENT_COLLATE_NOCASE);
-
- ret = media_folder_get_folder_count_from_db(filter, &folder_count);
-
- media_content_debug("Folder count : %d", folder_count);
-
- ret = media_folder_foreach_folder_from_db(filter, folder_update_cb, NULL);
-
- media_filter_destroy(filter);
-
- ret = media_folder_set_name(g_folder, "test_folder");
-
- ret = media_folder_set_order(g_folder, 200);
-
- ret = media_folder_update_to_db(g_folder);
-
- ret = media_folder_destroy(g_folder);
-
- return ret;
-}
-
int test_playlist_operation(void)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
media_content_debug("media_info_get_video success");
/* update video meta */
- video_meta_set_played_count(video_handle, 5);
- video_meta_set_played_time(video_handle, 5);
- video_meta_set_played_position(video_handle, 5);
video_meta_update_to_db(video_handle);
ret = video_meta_update_to_db(video_handle);
} else {
media_content_debug("media_info_get_audio success");
- audio_meta_set_played_count(audio_handle, 5);
- audio_meta_set_played_time(audio_handle, 1000);
- audio_meta_set_played_position(audio_handle, 180);
-
ret = audio_meta_update_to_db(audio_handle);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("audio_meta_update_to_db failed: %d", ret);
{
int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_h media = NULL;
- char *content_name = NULL;
bool favorite = FALSE;
ret = media_info_get_media_from_db("71b19196-5b38-4ab1-ab34-bfe05c369614", &media);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_get_media_from_db failed: %d", ret);
- ret = media_info_set_content_name(media, "TEST_content_name");
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("media_info_set_content_name failed: %d", ret);
-
ret = media_info_set_favorite(media, TRUE);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_set_favorite failed: %d", ret);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_get_media_from_db failed: %d", ret);
- ret = media_info_get_content_name(media, &content_name);
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- media_content_error("media_info_get_content_name failed: %d", ret);
- else
- media_content_debug("content name [%s]", content_name);
-
- SAFE_FREE(content_name);
-
ret = media_info_get_favorite(media, &favorite);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_get_favorite failed: %d", ret);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("media_info_insert_batch_to_db failed : %d\n", ret);
- filter_h filter;
- char condition[2048] = {0, };
- const char *temp = NULL;
- memset(condition, 0x00, sizeof(condition));
-
- temp = tzplatform_mkpath(TZ_USER_CONTENT, "test/image%%jpg\'");
- snprintf(condition, sizeof(condition), "MEDIA_PATH LIKE \'%s", temp);
-
- ret = media_filter_create(&filter);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("Fail to create filter");
- return ret;
- }
-
- ret = media_filter_set_condition(filter, condition, MEDIA_CONTENT_COLLATE_DEFAULT);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_filter_destroy(filter);
- media_content_error("Fail to set condition");
- return ret;
- }
-
- ret = media_info_delete_batch_from_db(filter);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_filter_destroy(filter);
- media_content_error("media_info_delete_batch_from_db failed : %d\n", ret);
- return ret;
- }
-
- ret = media_filter_destroy(filter);
-
return ret;
}
-void insert_burst_shot_cb(media_content_error_e error, void * user_data)
-{
- media_content_debug("media_info_insert_burst_shot_to_db completed![%d]\n", error);
- g_main_loop_quit(g_loop);
-}
-
-gboolean test_insert_burst_shot_to_db_start(gpointer data)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- int i = 0;
- char *file_list[10];
-
- for (i = 0; i < 10; i++) {
- char filepath[255] = {0,};
- snprintf(filepath, sizeof(filepath), "%s%d.jpg", tzplatform_mkpath(TZ_USER_CONTENT, "test/image"), i+1);
- media_content_debug("File : %s\n", filepath);
- file_list[i] = strdup(filepath);
- }
-
- ret = media_info_insert_burst_shot_to_db((const char **)file_list, 10, insert_burst_shot_cb, NULL);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("media_info_insert_burst_shot_to_db failed : %d\n", ret);
- g_main_loop_quit(g_loop);
- }
-
- return ret;
-}
-
-int test_insert_burst_shot_to_db(void)
-{
- GSource *source = NULL;
- GMainContext *context = NULL;
-
- g_loop = g_main_loop_new(NULL, FALSE);
- context = g_main_loop_get_context(g_loop);
- source = g_idle_source_new();
- g_source_set_callback(source, test_insert_burst_shot_to_db_start, NULL, NULL);
- g_source_attach(source, context);
-
- g_main_loop_run(g_loop);
- g_main_loop_unref(g_loop);
-
- return 0;
-}
-
void _scan_cb(media_content_error_e err, void *user_data)
{
media_content_debug("scan callback is called : %d\n", err);
media_content_debug("media_info_insert_to_db success");
- /* media_info_delete_batch_from_db */
- filter_h filter;
- char condition[2048] = {0,};
- const char *temp = NULL;
- memset(condition, 0x00, sizeof(condition));
-
- temp = tzplatform_mkpath(TZ_USER_CONTENT, "test/image%%\'");
- snprintf(condition, sizeof(condition), "MEDIA_PATH LIKE \'%s", temp);
-
- ret = media_filter_create(&filter);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("Fail to create filter");
- media_info_destroy(media_item);
- return ret;
- }
-
- ret = media_filter_set_condition(filter, condition, MEDIA_CONTENT_COLLATE_DEFAULT);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_filter_destroy(filter);
- media_info_destroy(media_item);
- media_content_error("Fail to set condition");
- return ret;
- }
- ret = media_info_delete_batch_from_db(filter);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_filter_destroy(filter);
- media_info_destroy(media_item);
- media_content_error("media_info_delete_batch_from_db failed : %d\n", ret);
- return ret;
- }
-
- media_filter_destroy(filter);
-
media_content_remove_db_updated_cb(noti_h);
/* media_info_update_to_db */
return ret;
}
-int test_create_handle(void)
-{
- int ret = MEDIA_CONTENT_ERROR_NONE;
- media_info_h media = NULL;
- const char *path = tzplatform_mkpath(TZ_USER_CONTENT, "test/test.txt");
- char *str_value = NULL;
- int int_value = -1;
- bool bool_value = FALSE;
- unsigned long long content_size = 0;
- time_t modified_time = 0;
- double double_value = 0.0;
-
- ret = media_info_create(path, &media);
-
- ret = media_info_set_title(media, "test_title");
- ret = media_info_set_album(media, "test_album");
- ret = media_info_set_artist(media, "test_artist");
- ret = media_info_set_genre(media, "test_genre");
- ret = media_info_set_recorded_date(media, "test_recorded_date");
- ret = media_info_set_age_rating(media, "test_age_rating");
- ret = media_info_set_author(media, "test_author");
- ret = media_info_set_category(media, "test_category");
- ret = media_info_set_content_name(media, "test_content_name");
- ret = media_info_set_description(media, "test_description");
- ret = media_info_set_display_name(media, "test_display_name");
- ret = media_info_set_keyword(media, "test_keyword");
- ret = media_info_set_location_tag(media, "test_location_tag");
- ret = media_info_set_weather(media, "test_weather");
- ret = media_info_set_provider(media, "test_provider");
-
- ret = media_info_set_altitude(media, 100.10);
- ret = media_info_set_latitude(media, 200.20);
- ret = media_info_set_longitude(media, 300.30);
- ret = media_info_set_rating(media, 10);
- ret = media_info_set_played_time(media);
- ret = media_info_set_favorite(media, TRUE);
- ret = media_info_increase_played_count(media);
- ret = media_info_set_added_time(media, 12345);
-
- ret = media_info_insert_to_db_with_data(media);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- media_content_error("media_info_insert_to_db_with_data failed : %d\n", ret);
- media_info_destroy(media);
- return ret;
- }
-
- ret = media_info_get_media_id(media, &str_value);
- media_content_debug("media_id = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_file_path(media, &str_value);
- media_content_debug("file_path = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_title(media, &str_value);
- media_content_debug("title = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_age_rating(media, &str_value);
- media_content_debug("age_rating = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_author(media, &str_value);
- media_content_debug("author = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_category(media, &str_value);
- media_content_debug("category = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_content_name(media, &str_value);
- media_content_debug("content_name = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_description(media, &str_value);
- media_content_debug("description = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_display_name(media, &str_value);
- media_content_debug("display_name = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_keyword(media, &str_value);
- media_content_debug("keyword = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_location_tag(media, &str_value);
- media_content_debug("location_tag = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_weather(media, &str_value);
- media_content_debug("weather = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_provider(media, &str_value);
- media_content_debug("provider = [%s]", str_value);
- SAFE_FREE(str_value);
-
- ret = media_info_get_longitude(media, &double_value);
- media_content_debug("longitude = [%lf]", double_value);
-
- ret = media_info_get_latitude(media, &double_value);
- media_content_debug("latitude = [%lf]", double_value);
-
- ret = media_info_get_altitude(media, &double_value);
- media_content_debug("altitud = [%lf]", double_value);
-
- ret = media_info_get_rating(media, &int_value);
- media_content_debug("rating = [%d]", int_value);
-
- ret = media_info_get_favorite(media, &bool_value);
- media_content_debug("favorite = [%d]", bool_value);
-
- ret = media_info_get_played_time(media, &modified_time);
- media_content_debug("played_time = [%ld]", modified_time);
-
- ret = media_info_get_played_count(media, &int_value);
- media_content_debug("played_count = [%d]", int_value);
-
- ret = media_info_get_added_time(media, &modified_time);
- media_content_debug("added_time = [%ld]", modified_time);
-
- ret = media_info_get_size(media, &content_size);
- media_content_debug("size = [%llu]", content_size);
-
- ret = media_info_get_modified_time(media, &modified_time);
- media_content_debug("modified_time = [%ld]", modified_time);
-
- ret = media_info_get_media_type(media, (media_content_type_e *)&int_value);
- media_content_debug("media_type = [%d]", int_value);
-
- ret = media_info_get_storage_type(media, (media_content_storage_e *)&int_value);
- media_content_debug("storage_type = [%d]", int_value);
-
- media_info_destroy(media);
-
- return ret;
-
-}
-
bool media_face_test_cb(media_face_h face, void *user_data)
{
char *face_id = NULL;
media_content_error("Fail to media_pvr_get_program_num");
media_content_debug("program_num [%d]", i_value);
+ unsigned int ui_value = 0;
+ ret = media_pvr_get_service_profile(pvr, &ui_value);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
+ media_content_error("Fail to media_pvr_get_service_profile");
+ media_content_debug("service_profile [%u]", ui_value);
+
ret = media_pvr_get_duration(pvr, &i_value);
if (ret != MEDIA_CONTENT_ERROR_NONE)
media_content_error("Fail to media_pvr_get_duration");
if (ret != MEDIA_CONTENT_ERROR_NONE)
return ret;
- ret = test_folder_update();
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- return ret;
-
ret = test_playlist_operation();
if (ret != MEDIA_CONTENT_ERROR_NONE)
return ret;
if (ret != MEDIA_CONTENT_ERROR_NONE)
return MEDIA_CONTENT_ERROR_NONE;
- ret = test_insert_burst_shot_to_db();
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- return MEDIA_CONTENT_ERROR_NONE;
-
ret = test_scan_file();
if (ret != MEDIA_CONTENT_ERROR_NONE)
return MEDIA_CONTENT_ERROR_NONE;
if (ret != MEDIA_CONTENT_ERROR_NONE)
return MEDIA_CONTENT_ERROR_NONE;
- ret = test_create_handle();
- if (ret != MEDIA_CONTENT_ERROR_NONE)
- return MEDIA_CONTENT_ERROR_NONE;
-
ret = test_face();
if (ret != MEDIA_CONTENT_ERROR_NONE)
return MEDIA_CONTENT_ERROR_NONE;