From 8c17e107edc9cd9197706840dc293e71027d87a6 Mon Sep 17 00:00:00 2001 From: "Haejeong, Kim" Date: Wed, 28 Oct 2015 19:47:35 +0900 Subject: [PATCH] add parameters for media_info_update_to_db Change-Id: I1fec84d6267c57a7aadf5b9be3919412afa1a14b --- packaging/capi-content-media-content.spec | 2 +- src/media_info.c | 36 +++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/packaging/capi-content-media-content.spec b/packaging/capi-content-media-content.spec index 3fc4f2d..6b9a4b8 100755 --- a/packaging/capi-content-media-content.spec +++ b/packaging/capi-content-media-content.spec @@ -1,6 +1,6 @@ Name: capi-content-media-content Summary: A Media content library in SLP C API -Version: 0.2.71 +Version: 0.2.72 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/media_info.c b/src/media_info.c index 681a392..e2232ab 100755 --- a/src/media_info.c +++ b/src/media_info.c @@ -2321,13 +2321,40 @@ int media_info_update_to_db(media_info_h media) media_svc_get_pinyin(_content_get_db_handle(), _media->keyword, &keyword_pinyin); } + char *album = NULL; + char *artist = NULL; + char *genre = NULL; + char *recorded_date = NULL; + + if (_media->media_type == MEDIA_CONTENT_TYPE_VIDEO) { + if (_media->video_meta->album != NULL) + album = strdup(_media->video_meta->album); + if (_media->video_meta->artist != NULL) + artist = strdup(_media->video_meta->artist); + if (_media->video_meta->genre != NULL) + genre = strdup(_media->video_meta->genre); + if (_media->video_meta->recorded_date != NULL) + recorded_date = strdup(_media->video_meta->recorded_date); + } else if ((_media->media_type == MEDIA_CONTENT_TYPE_MUSIC) || (_media->media_type == MEDIA_CONTENT_TYPE_SOUND)) { + if (_media->audio_meta->album != NULL) + album = strdup(_media->audio_meta->album); + if (_media->audio_meta->artist != NULL) + artist = strdup(_media->audio_meta->artist); + if (_media->audio_meta->genre != NULL) + genre = strdup(_media->audio_meta->genre); + if (_media->audio_meta->recorded_date != NULL) + recorded_date = strdup(_media->audio_meta->recorded_date); + } + set_sql = sqlite3_mprintf("file_name=%Q, added_time=%d, description=%Q, longitude=%f, latitude=%f, altitude=%f, \ played_count=%d, last_played_time=%d, last_played_position=%d, \ rating=%d, favourite=%d, author=%Q, provider=%Q, content_name=%Q, category=%Q, location_tag=%Q, age_rating=%Q, keyword=%Q, weather=%Q, sync_status=%d, \ - file_name_pinyin=%Q, description_pinyin=%Q, author_pinyin=%Q, provider_pinyin=%Q, content_name_pinyin=%Q, category_pinyin=%Q, location_tag_pinyin=%Q, age_rating_pinyin=%Q, keyword_pinyin=%Q, title=%Q", + file_name_pinyin=%Q, description_pinyin=%Q, author_pinyin=%Q, provider_pinyin=%Q, content_name_pinyin=%Q, category_pinyin=%Q, location_tag_pinyin=%Q, age_rating_pinyin=%Q, keyword_pinyin=%Q, title=%Q, \ + album=%Q, artist=%Q, genre=%Q, recorded_date=%Q", _media->display_name, _media->added_time, _media->description, _media->longitude, _media->latitude, _media->altitude, _media->played_count, _media->played_time, _media->played_position, _media->rating, _media->favourite, _media->author, _media->provider, _media->content_name, _media->category, _media->location_tag, _media->age_rating, _media->keyword, _media->weather, _media->sync_status, - file_name_pinyin, description_pinyin, author_pinyin, provider_pinyin, content_name_pinyin, category_pinyin, location_tag_pinyin, age_rating_pinyin, keyword_pinyin, _media->title); + file_name_pinyin, description_pinyin, author_pinyin, provider_pinyin, content_name_pinyin, category_pinyin, location_tag_pinyin, age_rating_pinyin, keyword_pinyin, _media->title, + album, artist, genre, recorded_date); sql = sqlite3_mprintf("UPDATE %Q SET %s WHERE media_uuid=%Q", _media->storage_uuid, set_sql, _media->media_id); @@ -2344,6 +2371,11 @@ int media_info_update_to_db(media_info_h media) SAFE_FREE(age_rating_pinyin); SAFE_FREE(keyword_pinyin); + SAFE_FREE(album); + SAFE_FREE(artist); + SAFE_FREE(genre); + SAFE_FREE(recorded_date); + if (_media->storage_type == MEDIA_CONTENT_STORAGE_CLOUD) { set_sql = NULL; sql = NULL; -- 2.7.4