*
* @file media_info_private.h
* @brief This file contains the media info API and related structure and enumeration. \n
-* Description of the audio, video,image content involves: album, artist, album_artist, author, genre and description tags. \n
+* Description of the audio, video,image content involves: album, artist, album_artist, genre and description tags. \n
* Parameters of the recording are also supported, as: format, bitrate, duration, size etc. \n
* Defenitions of media DB fields and tables, operations with media data relating to DB and handling with media filter attributes.
*/
MEDIA_INFO_DESCRIPTION,
MEDIA_INFO_RATING,
MEDIA_INFO_FAVOURITE,
- MEDIA_INFO_AUTHOR,
- MEDIA_INFO_PROVIDER,
- MEDIA_INFO_CONTENT_NAME,
- MEDIA_INFO_CATEGORY,
- MEDIA_INFO_LOCATION_TAG,
- MEDIA_INFO_AGE_RATING,
- MEDIA_INFO_KEYWORD,
MEDIA_INFO_IS_DRM,
MEDIA_INFO_STORAGE_TYPE,
MEDIA_INFO_LONGITUDE,
MEDIA_INFO_BITRATE,
MEDIA_INFO_BITPERSAMPLE,
MEDIA_INFO_DURATION,
- MEDIA_INFO_PLAYED_COUNT,
- MEDIA_INFO_LAST_PLAYED_TIME,
- MEDIA_INFO_LAST_PLAYED_POSITION,
MEDIA_INFO_SAMPLERATE,
MEDIA_INFO_CHANNEL,
- MEDIA_INFO_BURST_ID,
MEDIA_INFO_TIMELINE,
- MEDIA_INFO_WEATHER,
MEDIA_INFO_SYNC_STATUS,
MEDIA_INFO_STORAGE_UUID,
MEDIA_INFO_IS_360,
MEDIA_GROUP_FACE_BY_MEDIA_ID,
} group_list_e;
-typedef enum {
- MEDIA_BATCH_INSERT_NORMAL,
- MEDIA_BATCH_INSERT_BURSTSHOT,
-} media_batch_insert_e;
-
typedef struct _filter_s {
char *storage_id;
char *condition;
char *folder_id;
char *path;
char *name;
- time_t modified_time;
media_content_storage_e storage_type;
char *storage_uuid;
- int folder_order;
} media_folder_s;
typedef struct {
int height;
char *date_taken;
char *title;
- char *burst_id;
char *exposure_time;
double fnumber;
int iso;
double longitude;
double latitude;
double altitude;
- char *weather;
int rating;
time_t favourite;
char *title;
- char *author;
- char *provider;
- char *content_name;
- char *category;
- char *location_tag;
- char *age_rating;
- char *keyword;
int is_drm;
int storage_type;
- int played_count;
- time_t played_time;
- int played_position;
char *storage_uuid;
int sync_status;
unsigned int request_id;
#define DB_TABLE_PLAYLIST_MAP "playlist_map"
#define DB_TABLE_BOOKMARK "bookmark"
#define DB_TABLE_STORAGE "storage"
-#define DB_TABLE_MEDIA_VIEW "media_view"
#define DB_TABLE_FACE "face"
#define DB_TABLE_FACE_SCAN_LIST "face_scan_list"
/* DB View */
#define DB_VIEW_PLAYLIST "playlist_view"
#define DB_VIEW_TAG "tag_view"
+#define DB_VIEW_MEDIA "media_view"
/* DB Table Alias */
#define DB_TABLE_ALIAS_MEDIA "m"
#define DB_TABLE_ALIAS_PLAYLIST_MAP "pm"
#define DB_TABLE_ALIAS_TAG "t"
#define DB_TABLE_ALIAS_BOOKMARK "b"
-#define DB_TABLE_ALIAS_ALBUM "a"
#define DB_TABLE_ALIAS_FACE "fa"
/* DB field for media */
#define DB_FIELD_MEDIA_HEIGHT "height"
#define DB_FIELD_MEDIA_DATETAKEN "datetaken"
#define DB_FIELD_MEDIA_ORIENTATION "orientation"
-#define DB_FIELD_MEDIA_BURST_ID "burst_id"
-#define DB_FIELD_MEDIA_PLAYED_COUNT "played_count"
-#define DB_FIELD_MEDIA_LAST_PLAYED_TIME "last_played_time"
-#define DB_FIELD_MEDIA_LAST_PLAYED_POSITION "last_played_position"
#define DB_FIELD_MEDIA_RATING "rating"
#define DB_FIELD_MEDIA_FAVOURITE "favourite"
-#define DB_FIELD_MEDIA_AUTHOR "author"
-#define DB_FIELD_MEDIA_PROVIDER "provider"
-#define DB_FIELD_MEDIA_CONTENT_NAME "content_name"
-#define DB_FIELD_MEDIA_CATEGORY "category"
-#define DB_FIELD_MEDIA_LOCATION_TAG "location_tag"
-#define DB_FIELD_MEDIA_AGE_RATING "age_rating"
-#define DB_FIELD_MEDIA_KEYWORD "keyword"
-#define DB_FIELD_MEDIA_WEATHER "weather"
#define DB_FIELD_MEDIA_IS_DRM "is_drm"
#define DB_FIELD_MEDIA_STORAGE_TYPE "storage_type"
-#define DB_FIELD_MEDIA_EXPOSURE_TIME "exposure_time"
-#define DB_FIELD_MEDIA_FNUMBER "fnumber"
-#define DB_FIELD_MEDIA_ISO "iso"
-#define DB_FIELD_MEDIA_MODEL "model"
+
#define DB_FIELD_MEDIA_FILE_NAME_PINYIN "file_name_pinyin"
#define DB_FIELD_MEDIA_TITLE_PINYIN "title_pinyin"
#define DB_FIELD_MEDIA_ALBUM_PINYIN "album_pinyin"
#define DB_FIELD_MEDIA_COMPOSER_PINYIN "composer_pinyin"
#define DB_FIELD_MEDIA_COPYRIGHT_PINYIN "copyright_pinyin"
#define DB_FIELD_MEDIA_DESCRIPTION_PINYIN "description_pinyin"
-#define DB_FIELD_MEDIA_AUTHOR_PINYIN "author_pinyin"
-#define DB_FIELD_MEDIA_PROVIDER_PINYIN "provider_pinyin"
-#define DB_FIELD_MEDIA_CONTENT_NAME_PINYIN "content_name_pinyin"
-#define DB_FIELD_MEDIA_CATEGORY_PINYIN "category_pinyin"
-#define DB_FIELD_MEDIA_LOCATION_TAG_PINYIN "location_tag_pinyin"
-#define DB_FIELD_MEDIA_AGE_RATING_PINYIN "age_rating_pinyin"
-#define DB_FIELD_MEDIA_KEYWORD_PINYIN "keyword_pinyin"
#define DB_FIELD_MEDIA_360 "is_360"
/* DB field for folder */
#define DB_FIELD_FOLDER_ID "folder_uuid"
#define DB_FIELD_FOLDER_PATH "path"
#define DB_FIELD_FOLDER_NAME "name"
-#define DB_FIELD_FOLDER_MODIFIED_TIME "modified_time"
#define DB_FIELD_FOLDER_STORAGE_TYPE "storage_type"
#define DB_FIELD_FOLDER_NAME_PINYIN "name_pinyin"
-#define DB_FIELD_FOLDER_ORDER "folder_order"
/* DB field for playlist */
#define DB_FIELD_PLAYLIST_ID "playlist_id"
#define DB_FIELD_BOOKMARK_MARKED_TIME "marked_time"
#define DB_FIELD_BOOKMARK_NAME "name"
-/* DB field for album*/
-#define DB_FIELD_ALBUM_ID "album_id"
-#define DB_FIELD_ALBUM_NAME "name"
-#define DB_FIELD_ALBUM_ARTIST "artist"
-
/* DB field for Storage*/
#define DB_FIELD_STORAGE_ID "storage_uuid"
#define DB_FIELD_STORAGE_PATH "storage_path"
#define QUERY_KEYWORD_COLLATE "COLLATE "
/* DB TABLE JOIN */
-/*#define FOLDER_MEDIA_JOIN "("DB_TABLE_FOLDER" AS f LEFT OUTER JOIN '%s' AS m ON f.folder_uuid=m.folder_uuid AND m.validity=1) WHERE f.storage_uuid IN (SELECT storage_uuid FROM "DB_TABLE_STORAGE" WHERE validity=1) " */
#define FOLDER_MEDIA_JOIN "("DB_TABLE_FOLDER" AS f LEFT OUTER JOIN '%s' AS m ON f.folder_uuid=m.folder_uuid AND m.validity=1) WHERE f.validity=1 "
#define BOOKMARK_MEDIA_JOIN "("DB_TABLE_BOOKMARK" AS b INNER JOIN '%s' AS m ON (b.media_uuid = m.media_uuid)) WHERE m.validity=1"
#define ALBUM_MEDIA_JOIN "("DB_TABLE_ALBUM" AS a INNER JOIN '%s' AS m ON (a.album_id = m.album_id)) WHERE m.validity=1"
#define SELECT_ALBUM_LIST "SELECT DISTINCT a.album_id, a.name, a.artist, a.album_art FROM "ALBUM_MEDIA_JOIN
#define SELECT_MEDIA_GROUP_LIST "SELECT DISTINCT %s FROM '%s' WHERE validity=1 "
-#define SELECT_FOLDER_LIST "SELECT DISTINCT f.folder_uuid, f.path, f.name, f.storage_type, f.modified_time, f.storage_uuid, f.folder_order FROM "FOLDER_MEDIA_JOIN
+#define SELECT_FOLDER_LIST "SELECT DISTINCT f.folder_uuid, f.path, f.name, f.storage_type, f.storage_uuid FROM "FOLDER_MEDIA_JOIN
#define SELECT_FOLDER_LIST_BY_STORAGE_ID SELECT_FOLDER_LIST"AND f.storage_uuid='%s' "
#define SELECT_TAG_LIST "SELECT DISTINCT tag_id, name FROM "DB_VIEW_TAG" WHERE 1 "
#define SELECT_PLAYLIST_LIST "SELECT DISTINCT playlist_id, name, p_thumbnail_path FROM "DB_VIEW_PLAYLIST" WHERE 1 "
/* Get Group Info by Group ID*/
#define SELECT_ALBUM_FROM_ALBUM "SELECT * FROM "DB_TABLE_ALBUM" WHERE album_id=%d"
-#define SELECT_FOLDER_FROM_FOLDER "SELECT * FROM "DB_TABLE_FOLDER" WHERE folder_uuid='%s'"
-#define SELECT_FOLDER_BY_PATH "SELECT * FROM "DB_TABLE_FOLDER" WHERE path='%q'"
+#define SELECT_FOLDER_FROM_FOLDER "SELECT folder_uuid, path, name, storage_type, storage_uuid FROM "DB_TABLE_FOLDER" WHERE folder_uuid='%s'"
#define SELECT_PLAYLIST_FROM_PLAYLIST "SELECT * FROM "DB_TABLE_PLAYLIST" WHERE playlist_id=%d"
#define SELECT_TAG_FROM_TAG "SELECT * FROM "DB_TABLE_TAG" WHERE tag_id=%d"
#define SELECT_TAG_BY_NAME "SELECT * FROM "DB_TABLE_TAG" WHERE name='%q'"
/* Get Media list of Group */
#define MEDIA_INFO_ITEM "media_uuid, path, file_name, media_type, mime_type, size, added_time, modified_time, thumbnail_path, description, \
- rating, favourite, author, provider, content_name, category, location_tag, age_rating, keyword, is_drm, storage_type, longitude, latitude, altitude, exposure_time, fnumber, iso, model, width, height, datetaken, orientation, title, album, artist, album_artist, genre, composer, year, recorded_date, copyright, track_num, bitrate, bitpersample, duration, played_count, last_played_time, last_played_position, samplerate, channel, burst_id, timeline, weather, sync_status, storage_uuid, is_360"
-
-/*Folder info*/
-#define UPDATE_FOLDER_ORDER "UPDATE "DB_TABLE_FOLDER" SET folder_order=%d WHERE folder_uuid=%Q"
-#define SELECT_FOLDER_ID_BY_PATH "SELECT folder_uuid FROM "DB_TABLE_FOLDER" WHERE path = '%s'"
+ rating, favourite, is_drm, storage_type, longitude, latitude, altitude, exposure_time, fnumber, iso, \
+ model, width, height, datetaken, orientation, title, album, artist, album_artist, genre, \
+ composer, year, recorded_date, copyright, track_num, bitrate, bitpersample, duration, samplerate, channel, \
+ timeline, sync_status, storage_uuid, is_360"
/* Playlist Info */
#define INSERT_PLAYLIST_TO_PLAYLIST "INSERT INTO "DB_TABLE_PLAYLIST" (name) VALUES (%Q)"
#define UPDATE_PLAYLIST_NAME_FROM_PLAYLIST "UPDATE "DB_TABLE_PLAYLIST" SET name='%q' WHERE playlist_id=%d;"
#define UPDATE_PLAYLIST_THUMBNAIL_FROM_PLAYLIST "UPDATE "DB_TABLE_PLAYLIST" SET thumbnail_path='%q' WHERE playlist_id=%d;"
#define SELECT_PLAYLIST_ID_FROM_PLAYLIST "SELECT playlist_id FROM "DB_TABLE_PLAYLIST" WHERE name='%q'"
-#define SELECT_PLAYLIST_ITEM_ID_FROM_PLAYLIST_VIEW "SELECT pm_id, media_uuid FROM "DB_VIEW_PLAYLIST" WHERE (playlist_id=%d and media_count>0) "
#define SELECT_PLAYLIST_ITEM_ALL_FROM_PLAYLIST_VIEW "SELECT "MEDIA_INFO_ITEM", pm_id FROM "DB_VIEW_PLAYLIST" WHERE (playlist_id=%d and media_count>0) "
#define SELECT_PLAY_ORDER_FROM_PLAYLIST_VIEW "SELECT play_order FROM "DB_VIEW_PLAYLIST" WHERE playlist_id=%d and pm_id=%d"
#define SELECT_MAX_PLAY_ORDER_FROM_PLAYLIST_VIEW "SELECT MAX(play_order) FROM "DB_VIEW_PLAYLIST" WHERE playlist_id=%d"
#define SELECT_MEDIA_FROM_STORAGE "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE validity=1 AND storage_uuid='%s'"
#define SELECT_MEDIA_FROM_TAG "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE media_uuid IN (SELECT media_uuid FROM "DB_TABLE_TAG_MAP" WHERE tag_id=%d) AND validity=1"
#define SELECT_MEDIA_FROM_PLAYLIST "SELECT "MEDIA_INFO_ITEM" FROM '%s' WHERE media_uuid IN (SELECT media_uuid FROM "DB_TABLE_PLAYLIST_MAP" WHERE playlist_id=%d) AND validity=1"
-#define SELECT_MEDIA_PATH_BY_ID "SELECT path FROM "DB_TABLE_MEDIA_VIEW" WHERE media_uuid='%q'"
-#define SELECT_MEDIA_STORAGE_ID_BY_ID "SELECT storage_uuid FROM "DB_TABLE_MEDIA_VIEW" WHERE media_uuid='%q'"
+#define SELECT_MEDIA_PATH_BY_ID "SELECT path FROM "DB_VIEW_MEDIA" WHERE media_uuid='%q'"
+#define SELECT_MEDIA_STORAGE_ID_BY_ID "SELECT storage_uuid FROM "DB_VIEW_MEDIA" WHERE media_uuid='%q'"
/* Delete */
-#define DELETE_MEDIA_FROM_MEDIA_BATCH "DELETE FROM '%s' WHERE %s AND storage_type = %d"
#define DELETE_PLAYLIST_FROM_PLAYLIST "DELETE FROM "DB_TABLE_PLAYLIST" WHERE playlist_id=%d"
#define DELETE_TAG_FROM_TAG "DELETE FROM "DB_TABLE_TAG" WHERE tag_id=%d"
#define DELETE_BOOKMARK_FROM_BOOKMARK "DELETE FROM "DB_TABLE_BOOKMARK" WHERE bookmark_id=%d"
-/*For batch remove*/
-#define SELECT_STORAGE_BY_FILTER "SELECT DISTINCT storage_uuid, storage_type FROM "DB_TABLE_MEDIA_VIEW" WHERE %s"
-#define SELECT_THUMBNAIL_BY_FILTER "SELECT DISTINCT thumbnail_path FROM '%s' WHERE %s AND storage_type = %d"
-
/* Storage*/
#define SELECT_STORAGE_COUNT "SELECT COUNT(*) FROM "DB_TABLE_STORAGE" WHERE validity=1"
#define SELECT_STORAGE_LIST "SELECT storage_uuid, storage_path, storage_type FROM "DB_TABLE_STORAGE" WHERE validity=1"
#define DELETE_FACE_FROM_FACE "DELETE FROM "DB_TABLE_FACE" WHERE face_id=%d"
#define INSERT_FACE_TO_FACE "INSERT INTO "DB_TABLE_FACE" (media_uuid, face_rect_x , face_rect_y, face_rect_w, face_rect_h, orientation, face_tag) VALUES ('%q', %d, %d, %d, %d, %d, %Q);"
#define UPDATE_FACE_TO_FACE "UPDATE "DB_TABLE_FACE" SET face_rect_x=%d, face_rect_y=%d, face_rect_w=%d, face_rect_h=%d, orientation=%d, face_tag=%Q WHERE face_id=%d"
-#define SELECT_MEDIA_COUNT_FROM_MEDIA_BY_ID "SELECT COUNT(*) FROM "DB_TABLE_MEDIA_VIEW" WHERE media_uuid='%q' AND validity=1"
+#define SELECT_MEDIA_COUNT_FROM_MEDIA_BY_ID "SELECT COUNT(*) FROM "DB_VIEW_MEDIA" WHERE media_uuid='%q' AND validity=1"
#define SELECT_FACE_COUNT "SELECT COUNT(*) FROM "FACE_MEDIA_JOIN
#define SELECT_FACE_COUNT_BY_MEDIA_ID "SELECT COUNT(*) FROM "FACE_MEDIA_JOIN" AND fa.media_uuid='%s'"
#define SELECT_FACE_LIST "SELECT fa.face_id, fa.media_uuid, fa.face_rect_x, fa.face_rect_y, fa.face_rect_w, fa.face_rect_h, fa.orientation, fa.face_tag FROM "FACE_MEDIA_JOIN
#define SELECT_FACE_LIST_BY_MEDIA_ID "SELECT fa.face_id, fa.media_uuid, fa.face_rect_x, fa.face_rect_y, fa.face_rect_w, fa.face_rect_h, fa.orientation, fa.face_tag FROM "FACE_MEDIA_JOIN" AND fa.media_uuid='%s'"
-#define SELECT_FACE_PATH_FROM_MEDIA "SELECT path FROM "DB_TABLE_MEDIA_VIEW" media_uuid='%s'"
-#define SELECT_MEDIA_FROM_FACE "SELECT media_uuid FROM "DB_TABLE_FACE" WHERE face_id=%d"
-#define UPDATE_MEDIA_INFO_IN_FACE_SCAN_LIST "UPDATE "DB_TABLE_FACE_SCAN_LIST" SET modified_time = 0 WHERE media_uuid='%q'"
+#define UPDATE_MEDIA_INFO_IN_FACE_SCAN_LIST "UPDATE "DB_TABLE_FACE_SCAN_LIST" SET modified_time = 0 WHERE media_uuid IN (SELECT media_uuid FROM "DB_TABLE_FACE" WHERE face_id=%d)"
#define SELECT_FACE_ID "SELECT face_id FROM "DB_TABLE_FACE" WHERE media_uuid='%q' AND face_rect_x=%d AND face_rect_y=%d AND face_rect_w=%d AND face_rect_h=%d AND orientation=%d"
-#define DEFAULT_MEDIA_STORAGE_ID "media"
-
int _content_query_prepare(sqlite3_stmt **stmt, char *select_query, char *condition_query, char *option_query);
int _content_error_capi(int type, int cotent_error);
int _content_query_sql(char *query_str);
-MediaSvcHandle* _content_get_db_handle(void);
+sqlite3 * _content_get_db_handle(void);
uid_t _content_get_uid(void);
attribute_h _content_get_attirbute_handle(void);
attribute_h _content_get_alias_attirbute_handle(void);