change the query
authordykim <dydot1.kim@samsung.com>
Fri, 10 Feb 2012 08:08:11 +0000 (17:08 +0900)
committerdykim <dydot1.kim@samsung.com>
Fri, 10 Feb 2012 08:08:11 +0000 (17:08 +0900)
14 files changed:
debian/changelog
include/media_content_type.h
include/media_folder.h
include/media_info.h
include/media_info_private.h
include/media_video.h
src/media_audio.c
src/media_content.c
src/media_filter.c
src/media_folder.c
src/media_image.c
src/media_info.c
src/media_tag.c
src/media_video.c

index 374db7c..9749d11 100644 (file)
@@ -1,3 +1,11 @@
+capi-content-media-content (0.1.0-13) unstable; urgency=low
+
+  * changed the query
+  * Git: api/media-content
+  * Tag: capi-content-media-content_0.1.0-13
+
+ -- Dongyoung Kim <dydot1.kim@samsung.com>  Fri, 10 Feb 2012 16:27:25 +0900
+
 capi-content-media-content (0.1.0-10) unstable; urgency=low
 
   * Update the version.
index 7849214..3907703 100755 (executable)
@@ -55,8 +55,8 @@ typedef enum
  */\r
 typedef enum\r
 {\r
-    MEDIA_CONTENT_STORAGE_INTERNAL = 0x01 << 0,      /**< The device's internal storage */             \r
-    MEDIA_CONTENT_STORAGE_EXTERNAL = 0x01 << 1,    /**< The device's external storage */   \r
+    MEDIA_CONTENT_STORAGE_INTERNAL,    /**< The device's internal storage */           \r
+    MEDIA_CONTENT_STORAGE_EXTERNAL,   /**< The device's external storage */   \r
     //MEDIA_CONTENT_STORAGE_WEB = 0x01<< 2,\r
 } media_content_storage_e;\r
 \r
@@ -132,7 +132,7 @@ typedef enum
 typedef enum\r
 {\r
        MEDIA_FOLDER_SEARCH_NONE = 0x00,                                /**< No Search */\r
-       MEDIA_FOLDER_SEARCH_BY_FOLDER_NAME = 0x01 << 0,         /**< The searchabe type folder name */\r
+       MEDIA_FOLDER_SEARCH_BY_FOLDER_NAME = 0x01 << 0,         /**< The searchable type folder name */\r
 }media_folder_search_type_e;\r
 \r
 /**\r
@@ -142,11 +142,11 @@ typedef enum
 typedef enum\r
 {\r
        MEDIA_AUDIO_SEARCH_NONE = 0x00,                         /**< No Search */\r
-       MEDIA_AUDIO_SEARCH_BY_PLAYLIST = 0x01 << 0,             /**< The searchabe type of playlist */\r
-       MEDIA_AUDIO_SEARCH_BY_ARTIST = 0x01 << 1,               /**< The searchabe type of  artist */\r
-       MEDIA_AUDIO_SEARCH_BY_ALBUM = 0x01 << 2,                /**< The searchabe type of  album */\r
-       MEDIA_AUDIO_SEARCH_BY_AUTHOR = 0x01 << 3,               /**< The searchabe type of  author */\r
-       MEDIA_AUDIO_SEARCH_BY_GENRE = 0x01 << 4,                /**< The searchabe type of  genre */\r
+       MEDIA_AUDIO_SEARCH_BY_PLAYLIST = 0x01 << 0,             /**< The searchable type of playlist */\r
+       MEDIA_AUDIO_SEARCH_BY_ARTIST = 0x01 << 1,               /**< The searchable type of  artist */\r
+       MEDIA_AUDIO_SEARCH_BY_ALBUM = 0x01 << 2,                /**< The searchable type of  album */\r
+       MEDIA_AUDIO_SEARCH_BY_AUTHOR = 0x01 << 3,               /**< The searchable type of  author */\r
+       MEDIA_AUDIO_SEARCH_BY_GENRE = 0x01 << 4,                /**< The searchable type of  genre */\r
 }media_audio_search_type_e;\r
 \r
 /**\r
@@ -156,7 +156,7 @@ typedef enum
 typedef enum\r
 {\r
        MEDIA_TAG_SEARCH_NONE = 0x00,                           /**< No Search */\r
-       MEDIA_TAG_SEARCH_BY_TAG_NAME = 0x01 << 0,               /**< The searchabe type folder name */\r
+       MEDIA_TAG_SEARCH_BY_TAG_NAME = 0x01 << 0,               /**< The searchable type folder name */\r
 }media_tag_search_type_e;\r
 \r
 \r
@@ -165,7 +165,7 @@ typedef enum
 \r
 /**\r
  * @ingroup CAPI_CONTENT_MEDIA_FILTER_INFO_MODULE\r
- * @brief  The handle to media infon filter.\r
+ * @brief  The handle to media info filter.\r
  */\r
 typedef struct media_info_filter_s* media_info_filter_h;\r
 \r
@@ -294,7 +294,7 @@ typedef bool (*media_folder_cb)(media_folder_h folder, void *user_data);
  *\r
  * @remarks To use the @a media outside this function, copy the handle with #media_info_clone() function. \r
  *\r
- * @param[in] media  The hande to media info\r
+ * @param[in] media  The handle to media info\r
  * @param[in] user_data The user data passed from the foreach function \r
  * @return true to continue with the next iteration of the loop, \r
  * @return false to break out of the loop.\r
index e1f48bb..6aeb01f 100644 (file)
@@ -169,10 +169,10 @@ int media_folder_get_name(media_folder_h folder, char **folder_name);
 int media_folder_get_storage_type(media_folder_h folder, media_content_storage_e *storage_type);\r
 \r
 /**\r
- * @brief Gets the modifed date of the folder.\r
+ * @brief Gets the modified date of the folder.\r
  *\r
  * @param[in] folder The handle to media folder\r
- * @param[out] date The modifed date of folder \r
+ * @param[out] date The modified date of folder \r
  * @return 0 on success, otherwise a negative error value.\r
  * @retval #MEDIA_CONTENT_ERROR_NONE Successful\r
  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter\r
index a8faa91..7eb999e 100644 (file)
@@ -104,7 +104,7 @@ int media_info_clone(media_info_h* dst, media_info_h src);
 
 /**
  * @brief Destroys the media info.
- * @details The function frees all resources related to the meida info handle. This handle
+ * @details The function frees all resources related to the media info handle. This handle
  * no longer can be used to perform any operation. New media info handle has to
  * be created before next usage.
  *
index 758d60b..e078acc 100644 (file)
@@ -237,6 +237,7 @@ typedef struct
 #define QUERY_KEYWORD_SPACE " "
 #define DB_FIELD_FOLDER_UID "folder_uuid"
 #define DB_FILED_DISPLAY_NAME "display_name"
+#define DB_FILED_DATE_MODIFIED "date_modified"
 #define DB_FILED_MODIFIED_DATE "modified_date"
 #define DB_FILED_NAME "name"
 #define DB_FIELD_THUMBNAIL_PATH "thumbnail_path"
@@ -246,25 +247,25 @@ typedef struct
 #define DB_FIELD_ADDED_TIME "added_time"
 
 #define SELECT_MEDIA_ITEM "select item_id, file_path, display_name, thumbnail, date_modified,content_type, favourite from item_view where 1"
-#define SELECT_ALL_FOLDER "select uuid, path, name, storage_type,modified_date from (select uuid, path, folder_name as name, storage_type,modified_date from visual_folder where valid=1 union select _id, path, folder_name as name, storage_type,modified_date from audio_folder) where 1"
+#define SELECT_ALL_FOLDER "select folder_uuid, path, name, storage_type,modified_date from (select folder_uuid, path, folder_name as name, storage_type,modified_date from visual_folder where valid=1 union select audio_uuid, path, folder_name as name, storage_type,modified_date from audio_folder) where 1"
 #define SELECT_COUNT_ITEM "select count(*) from item_view where 1"
 #define SELECT_TAG_LIST "select _id, tag_name from visual_tag where 1"
-#define SELECT_MEDIA_FROM_TAG "SELECT t._id, tm.media_uuid, m.display_name as display_name, modified_date  from ( select _id, tag_name from visual_tag WHERE tag_name='%s' ORDER BY tag_name ASC  ) t, ( select media_uuid, tag_id from visual_tag_map ) tm, ( select uuid, folder_uuid, display_name, modified_date from visual_media) m, ( select uuid, lock_status from visual_folder where valid=1 ) f where tm.tag_id = t._id and m.uuid = tm.media_uuid and m.folder_uuid = f.uuid and f.lock_status=0 "
+#define SELECT_MEDIA_FROM_TAG "SELECT t._id, tm.visual_uuid, m.display_name as display_name, modified_date  from ( select _id, tag_name from visual_tag WHERE tag_name='%s' ORDER BY tag_name ASC  ) t, ( select visual_uuid, tag_id from visual_tag_map ) tm, ( select visual_uuid, folder_uuid, display_name, modified_date from visual_media) m, ( select folder_uuid, lock_status from visual_folder where valid=1 ) f where tm.tag_id = t._id and m.visual_uuid = tm.visual_uuid and m.folder_uuid = f.folder_uuid and f.lock_status=0 "
 #define SELECT_PLAYLIST "select _id,name from audio_playlists where 1"
-#define SELECT_MEDIA_FROM_PLAYLIST "select item_id, file_path, display_name, thumbnail, date_modified,content_type, favourite from item_view where 1 and content_type=3 and item_id IN (select audio_id from audio_playlists_map where playlist_id=%d)"
+#define SELECT_MEDIA_FROM_PLAYLIST "select item_id, file_path, display_name, thumbnail, date_modified,content_type, favourite from item_view where 1 and content_type=3 and item_id IN (select audio_uuid from audio_playlists_map where playlist_id=%d)"
 #define SELECT_GENRE_LIST "select distinct genre as name from audio_media where valid=1"
-#define SELECT_MEDIA_FROM_GENRE "select audio_id ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_id from audio_media where valid=1 and  genre='%s'"
+#define SELECT_MEDIA_FROM_GENRE "select audio_uuid ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_uuid from audio_media where valid=1 and  genre='%s'"
 #define SELECT_MEDIA_COUNT_FROM_GENRE "select count(*) from audio_media where valid=1 and genre='%s'"
 #define SELECT_ALBUM_LIST "select distinct album as name from audio_media where valid=1 "
-#define SELECT_MEDIA_FROM_ALBUM "select audio_id ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_id from audio_media where valid=1 and album='%s'"
+#define SELECT_MEDIA_FROM_ALBUM "select audio_uuid ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_uuid from audio_media where valid=1 and album='%s'"
 #define SELECT_MEDIA_COUNT_FROM_ALBUM "select count(*) from audio_media where valid=1 and genre='%s'"
 #define SELECT_AUTHOR_LIST "select distinct author as name from audio_media where valid=1 "
-#define SELECT_MEDIA_FROM_AUTHOR "select audio_id ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_id from audio_media where valid=1 and  author='%s'"
+#define SELECT_MEDIA_FROM_AUTHOR "select audio_uuid ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_uuid from audio_media where valid=1 and  author='%s'"
 #define SELECT_MEDIA_COUNT_FROM_AUTHOR "select count(*) from audio_media where valid=1 and genre='%s'"
 #define SELECT_MEDIA_ARTIST_LIST "select distinct artist as name from audio_media where valid=1"
-#define SELECT_MEDIA_FROM_ARTIST "select audio_id ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_id from audio_media where valid=1 and artist='%s'"
+#define SELECT_MEDIA_FROM_ARTIST "select audio_uuid ,path ,title as display_name,thumbnail_path,modified_date, content_type, favourite,valid,folder_uuid from audio_media where valid=1 and artist='%s'"
 #define SELECT_MEDIA_COUNT_FROM_ARTIST "select count(*) from audio_media where valid=1 and genre='%s'"
-#define SELECT_BOOKMARK_FROM_VIDEO "select _id,media_uuid,marked_time,thumbnail_path from video_bookmark where media_uuid='%s' "
+#define SELECT_BOOKMARK_FROM_VIDEO "select _id,visual_uuid,marked_time,thumbnail_path from video_bookmark where visual_uuid='%s' "
 
 
 /**
index 2fc4021..70d21e0 100644 (file)
@@ -262,7 +262,7 @@ int video_meta_update_time_played_to_db(video_meta_h video, int time_played);
  * @details This function gets all video bookmarks associated with the given folder and meeting desired filter option and 
 calls registered callback function for every retrieved item. If NULL is passed to the @a filter, no filtering is applied. 
  * @remarks Only start position and offset details of filter can be set,
- * beacuse searching by bookmark name information is not supported.
+ * because searching by bookmark name information is not supported.
  *
  * @param [in] video The handle to video metadata
  * @param [in] filter The handle to video bookmark filter
index db6ee70..0ff78d9 100644 (file)
@@ -16,9 +16,7 @@
 \r
 \r
 #include <media_content.h>\r
-#include <media-info-error.h>\r
-#include <media-svc-error.h>\r
-#include <media-info.h>\r
+#include <media-svc.h>\r
 #include <audio-svc.h>\r
 #include <audio-svc-error.h>\r
 #include <media_info_private.h>\r
@@ -31,7 +29,7 @@
 \r
 #define LOG_TAG "TIZEN_N_MEDIACONTENT"\r
 \r
-\r
+extern MediaSvcHandle* db_handle;\r
 \r
 int audio_meta_destroy(audio_meta_h audio)\r
 {\r
@@ -615,7 +613,7 @@ int audio_meta_update_count_played_to_db(audio_meta_h audio,int count)
 \r
        if(_audio != NULL)\r
        {\r
-               ret  = audio_svc_update_item_metadata(_audio->audio_id,AUDIO_SVC_TRACK_DATA_PLAYED_COUNT,count,-1);\r
+               ret  = audio_svc_update_item_metadata(db_handle,_audio->audio_id,AUDIO_SVC_TRACK_DATA_PLAYED_COUNT,count,-1);\r
 \r
                ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
        }\r
@@ -637,7 +635,7 @@ int audio_meta_update_time_played_to_db(audio_meta_h audio,time_t time)
        \r
        if(_audio != NULL)\r
        {\r
-               ret = audio_svc_update_item_metadata(_audio->audio_id,AUDIO_SVC_TRACK_DATA_PLAYED_TIME,time,-1);\r
+               ret = audio_svc_update_item_metadata(db_handle,_audio->audio_id,AUDIO_SVC_TRACK_DATA_PLAYED_TIME,time,-1);\r
                ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);              \r
        }\r
        else\r
@@ -891,7 +889,7 @@ int audio_playlist_get_media_count_from_db(audio_playlist_h playlist,int* count)
 \r
        if(_playlist != NULL)\r
        {\r
-               ret = audio_svc_count_playlist_item(_playlist->playlist_id,NULL,NULL, count);\r
+               ret = audio_svc_count_playlist_item(db_handle,_playlist->playlist_id,NULL,NULL, count);\r
 \r
                ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
        }\r
@@ -922,7 +920,7 @@ int audio_playlist_insert_to_db(const char* name, audio_playlist_h* playlist)
                }\r
                \r
                        \r
-               ret = audio_svc_add_playlist(name,&playlist_id);\r
+               ret = audio_svc_add_playlist(db_handle,name,&playlist_id);\r
                ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
                if(ret != MEDIA_CONTENT_ERROR_NONE)\r
                {\r
@@ -959,7 +957,7 @@ int audio_playlist_delete_from_db(audio_playlist_h playlist)
 \r
        if(_playlist != NULL)\r
        {\r
-               ret = audio_svc_delete_playlist(_playlist->playlist_id);\r
+               ret = audio_svc_delete_playlist(db_handle,_playlist->playlist_id);\r
 \r
                ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
        }\r
@@ -1077,7 +1075,7 @@ int audio_playlist_update_name_to_db(audio_playlist_h playlist,const char* name)
        \r
        if(_playlist != NULL && name != NULL)\r
        {\r
-               ret = audio_svc_update_playlist_name(_playlist->playlist_id,name);\r
+               ret = audio_svc_update_playlist_name(db_handle,_playlist->playlist_id,name);\r
                ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
                if(ret == MEDIA_CONTENT_ERROR_NONE)\r
                {\r
@@ -1111,7 +1109,7 @@ int audio_playlist_add_media_to_db(audio_playlist_h playlist, media_info_h item)
        if(_playlist != NULL && _item != NULL && _item->media_type == 4)\r
        {\r
 \r
-               ret = audio_svc_add_item_to_playlist(_playlist->playlist_id,_item->item_id);\r
+               ret = audio_svc_add_item_to_playlist(db_handle,_playlist->playlist_id,_item->item_id);\r
 \r
                ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
        \r
@@ -1136,7 +1134,7 @@ int audio_playlist_remove_media_from_db(audio_playlist_h playlist, media_info_h
        if(_playlist != NULL && _item != NULL && _item->media_type == 4)\r
        {\r
 \r
-               ret = audio_svc_remove_item_from_playlist_by_audio_id(_playlist->playlist_id,_item->item_id);\r
+               ret = audio_svc_remove_item_from_playlist_by_audio_id(db_handle,_playlist->playlist_id,_item->item_id);\r
 \r
                ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);      \r
        }\r
index 5f6dfad..e23654a 100644 (file)
 #include <audio-svc.h>\r
 #include <audio-svc-error.h>\r
 #include <audio-svc-types.h>\r
-#include <media-info-error.h>\r
-#include <media-svc-error.h>\r
-#include <minfo-types.h>\r
-#include <minfo-api.h>\r
-#include <media-info.h>\r
+#include <visual-svc-types.h>\r
+#include <visual-svc.h>\r
+#include <media-svc.h>\r
 \r
 \r
 #include <dlog.h>\r
 \r
 #define LOG_TAG "TIZEN_N_MEDIACONTENT"\r
 \r
-static sqlite3* db_handle;\r
-\r
+MediaSvcHandle* db_handle = NULL;\r
+static int ref_count = 0;\r
 \r
 \r
 \r
 int media_content_connect()\r
 {\r
        int ret = MEDIA_CONTENT_ERROR_NONE;\r
-       int _ret;\r
-       _ret  = mediainfo_connect_db_with_handle(&db_handle);\r
 \r
-       ret =  _content_error_capi(MEDIA_CONTENT_TYPE,_ret);\r
-       if( ret == MEDIA_CONTENT_ERROR_NONE)\r
+       if(ref_count == 0)\r
+       {\r
+               if(db_handle == NULL)\r
        {\r
-               _ret = mediainfo_open();\r
-               ret =  _content_error_capi(MEDIA_CONTENT_TYPE,_ret);\r
+                       ret = media_svc_connect(&db_handle);\r
        }\r
+\r
+               ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
+       }\r
+\r
+       ref_count++;\r
+       \r
        return ret;\r
 }\r
 \r
@@ -60,20 +62,31 @@ int media_content_connect()
 int media_content_disconnect()\r
 {\r
        int ret = MEDIA_CONTENT_ERROR_NONE;\r
-       int _ret;\r
        \r
+       if(ref_count > 0)\r
+       {\r
+               ref_count--;\r
+       }\r
+       else\r
+       {\r
+               LOGE("[%s]DB_FAILED(0x%08x) database is not connected", __FUNCTION__, MEDIA_CONTENT_ERROR_DB_FAILED);\r
+               return MEDIA_CONTENT_ERROR_DB_FAILED;\r
+       }\r
+\r
+       if(ref_count == 0)\r
+       {\r
        if(db_handle != NULL)\r
        {\r
-               _ret = mediainfo_disconnect_db_with_handle(db_handle);\r
-               ret =  _content_error_capi(MEDIA_CONTENT_TYPE,_ret);\r
+                       ret = media_svc_disconnect(db_handle);\r
+                       ret =  _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
                if( ret == MEDIA_CONTENT_ERROR_NONE)\r
                {               \r
-                       _ret = mediainfo_close();\r
-                       ret =  _content_error_capi(MEDIA_CONTENT_TYPE,_ret);\r
                        db_handle = NULL;\r
                }\r
        }\r
        \r
+       }\r
+       \r
        return ret;\r
 }\r
 \r
@@ -121,9 +134,9 @@ int _content_query_prepare(sqlite3_stmt** stmt,char* select_query,char* conditio
                snprintf(query,len_query,"%s %s %s %s %s",select_query,condition_query,search_query,order,limit_query );\r
 \r
                LOGV("[%s]Query : %s",__func__,query); \r
-               if( sqlite3_prepare(db_handle, query, strlen(query),stmt, NULL) != SQLITE_OK )\r
+               if( sqlite3_prepare((sqlite3*)db_handle, query, strlen(query),stmt, NULL) != SQLITE_OK )\r
                {\r
-                       LOGE("[%s]DB_FAILED(0x%08x) fail to sqlite3_prepare(), %s", __FUNCTION__, MEDIA_CONTENT_ERROR_DB_FAILED,sqlite3_errmsg(db_handle));\r
+                       LOGE("[%s]DB_FAILED(0x%08x) fail to sqlite3_prepare(), %s", __FUNCTION__, MEDIA_CONTENT_ERROR_DB_FAILED,sqlite3_errmsg((sqlite3*)db_handle));\r
                        exit(1);\r
                }       \r
                free(query);\r
index 2995884..e975741 100644 (file)
 #include <audio-svc.h>\r
 #include <audio-svc-error.h>\r
 #include <audio-svc-types.h>\r
-#include <media-info-error.h>\r
-#include <media-svc-error.h>\r
-#include <minfo-types.h>\r
-#include <minfo-api.h>\r
-#include <media-info.h>\r
+#include <visual-svc-types.h>\r
+#include <visual-svc.h>\r
+#include <media-svc.h>\r
 \r
 #include <dlog.h>\r
 \r
index 2b85b3c..ab0fa79 100644 (file)
 #include <audio-svc.h>\r
 #include <audio-svc-error.h>\r
 #include <audio-svc-types.h>\r
-#include <media-info-error.h>\r
-#include <media-svc-error.h>\r
-#include <minfo-types.h>\r
-#include <minfo-api.h>\r
+#include <visual-svc-types.h>\r
+#include <visual-svc.h>\r
 \r
 #include <dlog.h>\r
 \r
index 347b941..1a7a006 100644 (file)
 #include <media_image.h>
 #include <media_content.h>
 #include <media_info_private.h>
-#include <media-info-error.h>
-#include <media-svc-error.h>
-#include <minfo-types.h>
-#include <minfo-api.h>
-#include <media-info.h>
+#include <visual-svc-types.h>
+#include <visual-svc.h>
+#include <media-svc.h>
 
 #include <dlog.h>
 
index 8dcb895..5ac4178 100644 (file)
 \r
 #include <media_content.h>\r
 #include <media_info_private.h>\r
-#include <media-info-error.h>\r
-#include <media-svc-error.h>\r
-#include <media-info.h>\r
+#include <media-svc.h>\r
 #include <audio-svc.h>\r
 #include <audio-svc-error.h>\r
 #include <audio-svc-types.h>\r
 \r
-#include <media-svc-error.h>\r
-#include <minfo-types.h>\r
-#include <minfo-api.h>\r
-#include <media-info.h>\r
+#include <visual-svc-error.h>\r
+#include <visual-svc-types.h>\r
+#include <visual-svc.h>\r
 \r
 #include <drm-service.h>\r
 #include <aul.h>\r
 \r
 #define LOG_TAG "TIZEN_N_MEDIACONTENT"\r
 \r
+extern MediaSvcHandle* db_handle;\r
 \r
-#define SELECT_AUDIO_FROM_MEDIA "select audio_id,genre,album,artist,author,year,copyright,description,format,bitrate,track_num,duration,rating,played_count,last_played_time,added_time,size,category from audio_media where audio_id='%s' "\r
-#define SELECT_TAG_LIST_FROM_MEDIA "select t._id, t.tag_name from (select _id, tag_name from visual_tag ORDER BY tag_name ASC ) t, ( select media_uuid, tag_id from visual_tag_map where media_uuid='%s' ) tm, ( select uuid, folder_uuid from visual_media) m, ( select uuid, lock_status from visual_folder where valid=1 ) f where tm.tag_id = t._id and m.uuid = tm.media_uuid and m.folder_uuid = f.uuid and f.lock_status=0; "\r
+\r
+#define SELECT_AUDIO_FROM_MEDIA "select audio_uuid,genre,album,artist,author,year,copyright,description,format,bitrate,track_num,duration,rating,played_count,last_played_time,added_time,size,category from audio_media where audio_uuid='%s' "\r
+#define SELECT_TAG_LIST_FROM_MEDIA "select t._id, t.tag_name from (select _id, tag_name from visual_tag ORDER BY tag_name ASC ) t, ( select visual_uuid, tag_id from visual_tag_map where visual_uuid='%s' ) tm, ( select visual_uuid, folder_uuid from visual_media) m, ( select folder_uuid, lock_status from visual_folder where valid=1 ) f where tm.tag_id = t._id and m.visual_uuid = tm.visual_uuid and m.folder_uuid = f.folder_uuid and f.lock_status=0; "\r
 \r
 int media_info_insert_to_db(media_content_type_e type,const char* path)\r
 {\r
@@ -60,12 +59,12 @@ int media_info_insert_to_db(media_content_type_e type,const char* path)
        {\r
                case MEDIA_CONTENT_TYPE_IMAGE:\r
                        _type = MINFO_ITEM_IMAGE;\r
-                       ret = minfo_add_media(path, _type);\r
+                       ret = minfo_add_media(db_handle, path, _type);\r
                        ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret);\r
                break;\r
                case MEDIA_CONTENT_TYPE_VIDEO:\r
                        _type = MINFO_ITEM_VIDEO;\r
-                       ret = minfo_add_media(path, _type);\r
+                       ret = minfo_add_media(db_handle, path, _type);\r
                        ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret);                     \r
                break;\r
 \r
@@ -74,7 +73,7 @@ int media_info_insert_to_db(media_content_type_e type,const char* path)
                        ret = _content_get_audio_category(path,&category);\r
                        if(ret >= 0)\r
                        {\r
-                               ret = audio_svc_insert_item(storage_type,path,category);                                \r
+                               ret = audio_svc_insert_item(db_handle, storage_type,path,category);                             \r
                        }\r
                        else\r
                        {\r
@@ -369,16 +368,16 @@ int media_info_update_favorite_to_db(media_info_h media, int favorite)
                {\r
                        if(favorite)\r
                        {\r
-                               ret = audio_svc_add_item_to_playlist( AUDIO_SVC_FAVORITE_LIST_ID, _media->item_id);\r
+                               ret = audio_svc_add_item_to_playlist( db_handle, AUDIO_SVC_FAVORITE_LIST_ID, _media->item_id);\r
                        }\r
                        else\r
                        {\r
-                               ret = audio_svc_remove_item_from_playlist_by_audio_id(AUDIO_SVC_FAVORITE_LIST_ID, _media->item_id);\r
+                               ret = audio_svc_remove_item_from_playlist_by_audio_id(db_handle, AUDIO_SVC_FAVORITE_LIST_ID, _media->item_id);\r
                        }\r
                }\r
                else\r
                {       \r
-                       ret = minfo_update_media_favorite(_media->item_id,favorite);\r
+                       ret = minfo_update_media_favorite(db_handle, _media->item_id,favorite);\r
                }\r
                ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
        }\r
@@ -516,11 +515,11 @@ int media_info_foreach_media_from_db(media_info_filter_h filter,media_info_cb ca
        }\r
        else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_ASC)\r
        {\r
-               snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE);\r
+               snprintf(order_query,sizeof(order_query),"%s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_DATE_MODIFIED);\r
        }\r
        else if(_filter->order == MEDIA_CONTENT_SORT_BY_DATE_DESC)\r
        {\r
-               snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_MODIFIED_DATE,QUERY_KEYWORD_DESC);          \r
+               snprintf(order_query,sizeof(order_query),"%s %s %s",QUERY_KEYWORD_ORDER_BY,DB_FILED_DATE_MODIFIED,QUERY_KEYWORD_DESC);          \r
        }\r
 \r
        \r
@@ -586,12 +585,12 @@ int media_info_get_image_from_db(media_info_h item, image_meta_h* image)
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
        }\r
 \r
-       p_ret = minfo_get_item_by_id(_item->item_id,&p_item);\r
+       p_ret = minfo_get_item_by_id(db_handle, _item->item_id,&p_item);\r
 \r
        ret =  _content_error_capi(MEDIA_CONTENT_TYPE,p_ret);\r
        if( (ret == MEDIA_CONTENT_ERROR_NONE) && ( p_item != NULL))\r
        {\r
-               ret = minfo_get_meta_info(_item->item_id,&(p_item->meta_info));\r
+               ret = minfo_get_meta_info(db_handle, _item->item_id,&(p_item->meta_info));\r
                ret =  _content_error_capi(MEDIA_CONTENT_TYPE,p_ret);   \r
 \r
                if( ret != MEDIA_CONTENT_ERROR_NONE)\r
@@ -663,13 +662,13 @@ int media_info_get_video_from_db(media_info_h item, video_meta_h* video)
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
        }\r
 \r
-       p_ret = minfo_get_item_by_id(_item->item_id,&p_item);\r
+       p_ret = minfo_get_item_by_id(db_handle, _item->item_id,&p_item);\r
 \r
 \r
        ret =  _content_error_capi(MEDIA_CONTENT_TYPE,p_ret);\r
        if( (ret == MEDIA_CONTENT_ERROR_NONE) && ( p_item != NULL))\r
        {\r
-               ret = minfo_get_meta_info(_item->item_id,&(p_item->meta_info));\r
+               ret = minfo_get_meta_info(db_handle, _item->item_id,&(p_item->meta_info));\r
                ret =  _content_error_capi(MEDIA_CONTENT_TYPE,p_ret);   \r
                if( ret != MEDIA_CONTENT_ERROR_NONE)\r
                {\r
@@ -1005,7 +1004,7 @@ int _content_get_audio_category(const char* file_full_path,int* category)
                        *category = FEX_CATEGORY_MUSIC;\r
                        *category = *category | FEX_CATEGORY_DRM;\r
                }\r
-               else //check music file in soun files.\r
+               else //check music file in sound files.\r
                {\r
                        int prefix_len = strlen(content_category[0].content_type);\r
 \r
index c8d1850..161d539 100644 (file)
 #include <audio-svc.h>\r
 #include <audio-svc-error.h>\r
 #include <audio-svc-types.h>\r
-#include <media-info-error.h>\r
-#include <media-svc-error.h>\r
-#include <minfo-types.h>\r
-#include <minfo-api.h>\r
+#include <visual-svc-types.h>\r
+#include <visual-svc.h>\r
 #include <dlog.h>\r
 \r
 #ifdef LOG_TAG\r
@@ -32,6 +30,7 @@
 \r
 #define LOG_TAG "TIZEN_N_MEDIACONTENT"\r
 \r
+extern MediaSvcHandle* db_handle;\r
 \r
 \r
 int media_tag_foreach_tag_from_db(media_tag_filter_h filter, media_tag_cb callback,void* user_data)\r
@@ -177,7 +176,7 @@ int media_tag_insert_to_db(const char* tag_name,media_tag_h* tag)
                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;\r
        }\r
 \r
-       ret = minfo_add_tag(NULL,tag_name);\r
+       ret = minfo_add_tag(db_handle,NULL,tag_name);\r
 \r
        if(ret == MB_SVC_ERROR_NONE)\r
        {\r
@@ -203,7 +202,7 @@ int media_tag_delete_from_db(media_tag_h tag)
        media_tag_s* _tag = (media_tag_s*)tag;\r
        \r
        \r
-       ret = minfo_delete_tag(NULL, _tag->name);\r
+       ret = minfo_delete_tag(db_handle, NULL, _tag->name);\r
        \r
        return _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
 \r
@@ -237,7 +236,7 @@ int media_tag_add_media_to_db(media_tag_h tag,media_info_h media)
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;   \r
        }\r
        \r
-       ret = minfo_add_tag(_item->item_id,_tag->name);\r
+       ret = minfo_add_tag(db_handle, _item->item_id,_tag->name);\r
 \r
        return _content_error_capi(MEDIA_CONTENT_TYPE,ret);\r
 \r
@@ -269,7 +268,7 @@ int media_tag_remove_media_from_db(media_tag_h tag,media_info_h media)
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
        }\r
 \r
-       query_string = sqlite3_mprintf("DELETE FROM visual_tag_map WHERE media_id=%s and tag_name=%d",\r
+       query_string = sqlite3_mprintf("DELETE FROM visual_tag_map WHERE visual_uuid=%s and tag_name=%d",\r
                              _item->item_id, _tag->name);\r
 \r
        \r
@@ -387,7 +386,7 @@ int media_tag_update_name_to_db(media_tag_h tag, const char* name)
                return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;\r
        }\r
 \r
-       ret = minfo_rename_tag(_tag->name,name);\r
+       ret = minfo_rename_tag(db_handle,_tag->name,name);\r
 \r
        if(ret == MB_SVC_ERROR_NONE)\r
        {\r
@@ -502,7 +501,7 @@ int media_tag_foreach_media_from_db(media_tag_h tag,media_info_filter_h filter,
                }\r
                memset(_item,0x00,sizeof(media_info_s));\r
                media_id = (char*)sqlite3_column_text(stmt, 1);\r
-               ret = minfo_get_item_by_id(media_id, &mitem);\r
+               ret = minfo_get_item_by_id(db_handle,media_id, &mitem);\r
 \r
                if(ret < 0)\r
                {\r
index b8bc8c3..276f0a4 100644 (file)
 
 #include <media_content.h>
 #include <media_info_private.h>
-#include <media-info-error.h>
-#include <media-svc-error.h>
-#include <minfo-types.h>
-#include <minfo-api.h>
-#include <media-info.h>
+#include <visual-svc-error.h>
+#include <visual-svc-types.h>
+#include <visual-svc.h>
+#include <media-svc.h>
 
 #include <dlog.h>
 
@@ -30,6 +29,8 @@
 
 #define LOG_TAG "TIZEN_N_MEDIACONTENT"
 
+extern MediaSvcHandle* db_handle;
+
 
 int video_meta_destroy(video_meta_h video)
 {
@@ -466,7 +467,7 @@ int video_meta_update_time_played_to_db(video_meta_h video, int time_played)
 
        if(_video != NULL )
        {
-               ret = minfo_update_video_meta_info_int(_video->video_id,MINFO_VIDEO_META_BOOKMARK_LAST_PLAYED,time_played);
+               ret = minfo_update_video_meta_info_int(db_handle,_video->video_id,MINFO_VIDEO_META_BOOKMARK_LAST_PLAYED,time_played);
                ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);              
        }
        else
@@ -703,7 +704,7 @@ int video_bookmark_insert_to_db(video_meta_h video, time_t time, const char* thu
 
        if(_video != NULL)
        {
-               ret = minfo_add_bookmark(_video->video_id,time,thumbnail_path);
+               ret = minfo_add_bookmark(db_handle,_video->video_id,time,thumbnail_path);
                ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);              
        }
        else
@@ -724,7 +725,7 @@ int video_bookmark_delete_from_db(video_bookmark_h bookmark)
 
        if( _bookmark != NULL)
        {
-               ret = minfo_delete_bookmark(_bookmark->bookmark_id);
+               ret = minfo_delete_bookmark(db_handle,_bookmark->bookmark_id);
                ret = _content_error_capi(MEDIA_CONTENT_TYPE,ret);      
        }
        else