return (char *) DB_FIELD_MEDIA_LATITUDE;
case MEDIA_CONTENT_GROUP_ALTITUDE:
return (char *) DB_FIELD_MEDIA_ALTITUDE;
- case MEDIA_CONTENT_GROUP_BURST_IMAGE:
- return (char *) DB_FIELD_MEDIA_BURST_ID;
case MEDIA_CONTENT_GROUP_RATING:
return (char *) DB_FIELD_MEDIA_RATING;
- case MEDIA_CONTENT_GROUP_AUTHOR:
- return (char *) DB_FIELD_MEDIA_AUTHOR;
- case MEDIA_CONTENT_GROUP_PROVIDER:
- return (char *) DB_FIELD_MEDIA_PROVIDER;
- case MEDIA_CONTENT_GROUP_CONTENT_NAME:
- return (char *) DB_FIELD_MEDIA_CONTENT_NAME;
- case MEDIA_CONTENT_GROUP_CATEGORY:
- return (char *) DB_FIELD_MEDIA_CATEGORY;
- case MEDIA_CONTENT_GROUP_LOCATION_TAG:
- return (char *) DB_FIELD_MEDIA_LOCATION_TAG;
- case MEDIA_CONTENT_GROUP_AGE_RATING:
- return (char *) DB_FIELD_MEDIA_AGE_RATING;
- case MEDIA_CONTENT_GROUP_KEYWORD:
- return (char *) DB_FIELD_MEDIA_KEYWORD;
- case MEDIA_CONTENT_GROUP_WEATHER:
- return (char *) DB_FIELD_MEDIA_WEATHER;
-#ifdef _USE_TV_PROFILE
+#ifdef _USE_TVPD_MODE
case MEDIA_CONTENT_GROUP_MODIFIED_MONTH:
return (char *) DB_FIELD_MEDIA_MODIFIED_DATE;
case MEDIA_CONTENT_GROUP_MODIFIED_DATE:
case MEDIA_CONTENT_GROUP_CONTACT:
return (char *) DB_FIELD_MEDIA_CONTACT;
#endif
-#ifdef _USE_TV_PROFILE
+#ifdef _USE_TVPD_MODE
case MEDIA_CONTENT_GROUP_ALBUM:
return (char *) DB_FIELD_MEDIA_ALBUM;
case MEDIA_PVR_GROUP_DURATION:
_filter = (filter_s*)filter;
if (STRING_VALID(_filter->condition)) {
- /*bracket should be added to condition. If application use "OR" condition, F/W restriction condition like "validity=1" is disregared
- ex) select path from media where validity=1 and media_type=3 or media_type=1;*/
- char bracket_added_condition[MAX_QUERY_SIZE] = {0, };
- memset(bracket_added_condition, 0x00, sizeof(bracket_added_condition));
-
- SAFE_STRLCAT(bracket_added_condition, QUERY_KEYWORD_OPEN_BRACKET, MAX_QUERY_SIZE);
- SAFE_STRLCAT(bracket_added_condition, _filter->condition, MAX_QUERY_SIZE);
- SAFE_STRLCAT(bracket_added_condition, QUERY_KEYWORD_BRACKET, MAX_QUERY_SIZE);
-
- ret = _media_filter_attribute_generate(attr, bracket_added_condition, _filter->condition_collate_type, condition_query);
+ ret = _media_filter_attribute_generate(attr, filter, condition_query);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
}
- ret = _media_filter_attribute_option_generate(attr, filter, option_query);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
- SAFE_FREE(*condition_query);
- return ret;
+ if (_filter->is_full_order == false) {
+ /* Process for filter v1 */
+ ret = _media_filter_attribute_option_generate(attr, filter, option_query);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SAFE_FREE(*condition_query);
+ return ret;
+ }
+ } else {
+ /* Process for filter v2 */
+ ret = _media_filter_attribute_option_generate_with_full_query(attr, filter, option_query);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ SAFE_FREE(*condition_query);
+ return ret;
+ }
}
if (STRING_VALID(*condition_query)) {
case MEDIA_GROUP_NONE:
case MEDIA_GROUP_TAG_BY_MEDIA_ID:
case MEDIA_GROUP_BOOKMARK_BY_MEDIA_ID:
+ case MEDIA_GROUP_FACE_BY_MEDIA_ID:
{
media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_ALBUM_COUNT, _filter->storage_id);
else
- snprintf(select_query, sizeof(select_query), SELECT_ALBUM_COUNT, DB_TABLE_MEDIA_VIEW);
+ snprintf(select_query, sizeof(select_query), SELECT_ALBUM_COUNT, DB_VIEW_MEDIA);
break;
case MEDIA_GROUP_FOLDER:
attr = _content_get_alias_attirbute_handle();
- if (!SAFE_STRLCPY(select_query, SELECT_FOLDER_COUNT, sizeof(select_query))) {
- media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
- return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
- }
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_FOLDER_COUNT_BY_STORAGE_ID, _filter->storage_id, _filter->storage_id);
else
- snprintf(select_query, sizeof(select_query), SELECT_FOLDER_COUNT, DB_TABLE_MEDIA_VIEW);
+ snprintf(select_query, sizeof(select_query), SELECT_FOLDER_COUNT, DB_VIEW_MEDIA);
break;
case MEDIA_GROUP_PLAYLIST:
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_COUNT, _filter->storage_id);
else
- snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_COUNT, DB_TABLE_MEDIA_VIEW);
+ snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_COUNT, DB_VIEW_MEDIA);
break;
case MEDIA_GROUP_STORAGE:
return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
}
break;
-#ifdef _USE_TV_PROFILE
+ case MEDIA_GROUP_FACE:
+ attr = _content_get_alias_attirbute_handle();
+
+ if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
+ snprintf(select_query, sizeof(select_query), SELECT_FACE_COUNT, _filter->storage_id);
+ else
+ snprintf(select_query, sizeof(select_query), SELECT_FACE_COUNT, DB_VIEW_MEDIA);
+ break;
+#ifdef _USE_TVPD_MODE
case MEDIA_GROUP_PVR:
case MEDIA_GROUP_UHD:
#endif
SAFE_FREE(option_query);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- while (sqlite3_step(stmt) == SQLITE_ROW)
+ if (sqlite3_step(stmt) == SQLITE_ROW)
*group_count = (int)sqlite3_column_int(stmt, 0);
SQLITE3_FINALIZE(stmt);
attr = _content_get_attirbute_handle();
memset(select_query, 0x00, sizeof(select_query));
-#ifdef _USE_TV_PROFILE
+#ifdef _USE_TVPD_MODE
if (group < MEDIA_PVR_GROUP_DURATION) { /*media content*/
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_COUNT, __media_db_get_group_name(group), _filter->storage_id);
else
- snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_COUNT, __media_db_get_group_name(group), DB_TABLE_MEDIA_VIEW);
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_COUNT, __media_db_get_group_name(group), DB_VIEW_MEDIA);
} else if (group < MEDIA_UHD_GROUP_CONTENT_TITLE) { /*pvr content*/
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_PVR_GROUP_COUNT_BY_STORAGE_ID, __media_db_get_group_name(group), _filter->storage_id);
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_COUNT, __media_db_get_group_name(group), _filter->storage_id);
else
- snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_COUNT, __media_db_get_group_name(group), DB_TABLE_MEDIA_VIEW);
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_COUNT, __media_db_get_group_name(group), DB_VIEW_MEDIA);
#endif
ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
SAFE_FREE(option_query);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- while (sqlite3_step(stmt) == SQLITE_ROW)
+ if (sqlite3_step(stmt) == SQLITE_ROW)
*group_count = (int)sqlite3_column_int(stmt, 0);
SQLITE3_FINALIZE(stmt);
attr = _content_get_attirbute_handle();
memset(select_query, 0x00, sizeof(select_query));
-#ifdef _USE_TV_PROFILE
+#ifdef _USE_TVPD_MODE
if (group < MEDIA_PVR_GROUP_DURATION) { /*media content */
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_LIST, __media_db_get_group_name(group), _filter->storage_id);
else
- snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_LIST, __media_db_get_group_name(group), DB_TABLE_MEDIA_VIEW);
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_LIST, __media_db_get_group_name(group), DB_VIEW_MEDIA);
} else if (group < MEDIA_UHD_GROUP_CONTENT_TITLE) { /*pvr content */
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_PVR_GROUP_LIST_BY_STORAGE_ID, __media_db_get_group_name(group), _filter->storage_id);
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_LIST, __media_db_get_group_name(group), _filter->storage_id);
else
- snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_LIST, __media_db_get_group_name(group), DB_TABLE_MEDIA_VIEW);
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_LIST, __media_db_get_group_name(group), DB_VIEW_MEDIA);
#endif
ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
return ret;
}
-#ifdef _USE_TV_PROFILE
+#ifdef _USE_TVPD_MODE
int _media_db_get_media_group_and_count(media_group_e group, filter_h filter, media_group_and_count_cb callback, void *user_data)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- char select_query[DEFAULT_QUERY_SIZE];
- char group_query[DEFAULT_QUERY_SIZE];
+ char select_query[DEFAULT_QUERY_SIZE] = {0, };
+ char group_query[DEFAULT_QUERY_SIZE] = {0, };
char *condition_query = NULL;
char *option_query = NULL;
char *name = NULL;
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_AND_COUNT, group_name, _filter->storage_id);
else
- snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_AND_COUNT, group_name, DB_TABLE_MEDIA_VIEW);
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_GROUP_AND_COUNT, group_name, DB_VIEW_MEDIA);
} else if (group < MEDIA_UHD_GROUP_CONTENT_TITLE) {/*pvr content*/
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_PVR_GROUP_AND_COUNT_BY_STORAGE_ID, group_name, _filter->storage_id);
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_ALBUM_LIST, _filter->storage_id);
else
- snprintf(select_query, sizeof(select_query), SELECT_ALBUM_LIST, DB_TABLE_MEDIA_VIEW);
+ snprintf(select_query, sizeof(select_query), SELECT_ALBUM_LIST, DB_VIEW_MEDIA);
ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
sqlite3_stmt *stmt = NULL;
attribute_h attr = NULL;
filter_s *_filter = (filter_s*)filter;
-#ifndef _USE_TV_PROFILE
- char *tmp_path = NULL;
- char repl_path[MAX_QUERY_SIZE] = {0, };
-#endif
attr = _content_get_alias_attirbute_handle();
memset(select_query, 0x00, sizeof(select_query));
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_FOLDER_LIST_BY_STORAGE_ID, _filter->storage_id, _filter->storage_id);
else
- snprintf(select_query, sizeof(select_query), SELECT_FOLDER_LIST, DB_TABLE_MEDIA_VIEW);
+ snprintf(select_query, sizeof(select_query), SELECT_FOLDER_LIST, DB_VIEW_MEDIA);
ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
}
_folder->folder_id = g_strdup((const char *)sqlite3_column_text(stmt, 0));
-#ifdef _USE_TV_PROFILE
_folder->path = g_strdup((const char *)sqlite3_column_text(stmt, 1));
-#else
- tmp_path = g_strdup((const char *)sqlite3_column_text(stmt, 1));
- _media_content_rollback_path(tmp_path, repl_path);
- _folder->path = g_strdup(repl_path);
- SAFE_FREE(tmp_path);
-#endif
_folder->name = g_strdup((const char *)sqlite3_column_text(stmt, 2));
_folder->storage_type = (int)sqlite3_column_int(stmt, 3);
- _folder->modified_time = (int)sqlite3_column_int(stmt, 4);
- _folder->storage_uuid = g_strdup((const char *)sqlite3_column_text(stmt, 5));
- _folder->folder_order = (int)sqlite3_column_int(stmt, 6);
- _folder->parent_folder_id = g_strdup((const char *)sqlite3_column_text(stmt, 7));
+ _folder->storage_uuid = g_strdup((const char *)sqlite3_column_text(stmt, 4));
if (callback((media_folder_h)_folder, user_data) == false) {
media_folder_destroy((media_folder_h) _folder);
char *option_query = NULL;
sqlite3_stmt *stmt = NULL;
attribute_h attr = NULL;
-#ifndef _USE_TV_PROFILE
- char *tmp_path = NULL;
- char repl_path[MAX_QUERY_SIZE] = {0, };
-#endif
attr = _content_get_attirbute_handle();
memset(select_query, 0x00, sizeof(select_query));
_playlist->playlist_id = (int)sqlite3_column_int(stmt, 0);
_playlist->name = g_strdup((const char *)sqlite3_column_text(stmt, 1));
-#ifdef _USE_TV_PROFILE
_playlist->thumbnail_path = g_strdup((const char *)sqlite3_column_text(stmt, 2));
-#else
- memset(repl_path, 0x00, sizeof(repl_path));
- tmp_path = g_strdup((const char *)sqlite3_column_text(stmt, 2));
- if (STRING_VALID(tmp_path)) {
- _media_content_rollback_path(tmp_path, repl_path);
- _playlist->thumbnail_path = g_strdup(repl_path);
- SAFE_FREE(tmp_path);
- } else {
- _playlist->thumbnail_path = NULL;
- }
-#endif
if (callback((media_playlist_h)_playlist, user_data) == false) {
media_playlist_destroy((media_playlist_h)_playlist);
sqlite3_stmt *stmt = NULL;
attribute_h attr = NULL;
filter_s *_filter = (filter_s*)filter;
-#ifndef _USE_TV_PROFILE
- char *tmp_path = NULL;
- char repl_path[MAX_QUERY_SIZE] = {0, };
-#endif
- attr = _content_get_attirbute_handle();
+ attr = _content_get_alias_attirbute_handle();
memset(select_query, 0x00, sizeof(select_query));
- if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
- snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_LIST_BY_MEDIA_ID, _filter->storage_id, media_id);
- else
- snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_LIST_BY_MEDIA_ID, DB_TABLE_MEDIA_VIEW, media_id);
+ if (STRING_VALID(media_id)) { //get bookmark by media_id
+ if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
+ snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_LIST_BY_MEDIA_ID, _filter->storage_id, media_id);
+ else
+ snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_LIST_BY_MEDIA_ID, DB_VIEW_MEDIA, media_id);
+ } else {
+ if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
+ snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_LIST, _filter->storage_id);
+ else
+ snprintf(select_query, sizeof(select_query), SELECT_BOOKMARK_LIST, DB_VIEW_MEDIA);
+ }
ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
bookmark->bookmark_id = (int)sqlite3_column_int(stmt, 0);
bookmark->media_id = g_strdup((const char *)sqlite3_column_text(stmt, 1));
bookmark->marked_time = (int)sqlite3_column_int(stmt, 2);
-#ifdef _USE_TV_PROFILE
bookmark->thumbnail_path = g_strdup((const char *)sqlite3_column_text(stmt, 3));
-#else
- tmp_path = g_strdup((const char *)sqlite3_column_text(stmt, 3));
- _media_content_rollback_path(tmp_path, repl_path);
- bookmark->thumbnail_path = g_strdup(repl_path);
- SAFE_FREE(tmp_path);
-#endif
+ bookmark->name = g_strdup((const char *)sqlite3_column_text(stmt, 4));
if (callback((media_bookmark_h)bookmark, user_data) == false) {
media_bookmark_destroy((media_bookmark_h)bookmark);
attribute_h attr = NULL;
filter_s *_filter = (filter_s*)filter;
- attr = _content_get_attirbute_handle();
+ attr = _content_get_alias_attirbute_handle();
memset(select_query, 0x00, sizeof(select_query));
- if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
- snprintf(select_query, sizeof(select_query), SELECT_FACE_LIST_BY_MEDIA_ID, _filter->storage_id, media_id);
- else
- snprintf(select_query, sizeof(select_query), SELECT_FACE_LIST_BY_MEDIA_ID, DB_TABLE_MEDIA_VIEW, media_id);
+ if (STRING_VALID(media_id)) { //get face by media_id
+ if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
+ snprintf(select_query, sizeof(select_query), SELECT_FACE_LIST_BY_MEDIA_ID, _filter->storage_id, media_id);
+ else
+ snprintf(select_query, sizeof(select_query), SELECT_FACE_LIST_BY_MEDIA_ID, DB_VIEW_MEDIA, media_id);
+ } else {
+ if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
+ snprintf(select_query, sizeof(select_query), SELECT_FACE_LIST, _filter->storage_id);
+ else
+ snprintf(select_query, sizeof(select_query), SELECT_FACE_LIST, DB_VIEW_MEDIA);
+ }
ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
}
- face->face_id = g_strdup((const char *)sqlite3_column_text(stmt, 0));
+ face->face_id = (int)sqlite3_column_int(stmt, 0);
face->media_id = g_strdup((const char *)sqlite3_column_text(stmt, 1));
face->face_rect_x = (int)sqlite3_column_int(stmt, 2);
face->face_rect_y = (int)sqlite3_column_int(stmt, 3);
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_ALBUM, _filter->storage_id, group_id);
else
- snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_ALBUM, DB_TABLE_MEDIA_VIEW, group_id);
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_ALBUM, DB_VIEW_MEDIA, group_id);
} else if (group_type == MEDIA_GROUP_PLAYLIST) {
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_PLAYLIST, group_id);
} else if (group_type == MEDIA_GROUP_TAG) {
SAFE_FREE(option_query);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- while (sqlite3_step(stmt) == SQLITE_ROW)
+ if (sqlite3_step(stmt) == SQLITE_ROW)
*item_count = (int)sqlite3_column_int(stmt, 0);
SQLITE3_FINALIZE(stmt);
if (STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_MEDIA_SIMPLE, _filter->storage_id);
else
- snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_MEDIA_SIMPLE, DB_TABLE_MEDIA_VIEW);
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_MEDIA_SIMPLE, DB_VIEW_MEDIA);
is_simple = TRUE;
} else {
- snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_MEDIA, DB_TABLE_MEDIA_VIEW);
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_MEDIA, DB_VIEW_MEDIA);
}
} else if (group_type == MEDIA_GROUP_FOLDER) {
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
tmp_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_FOLDER, _filter->storage_id, group_name);
else
- tmp_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_FOLDER, DB_TABLE_MEDIA_VIEW, group_name);
+ tmp_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_FOLDER, DB_VIEW_MEDIA, group_name);
SAFE_STRLCAT(select_query, tmp_query, sizeof(select_query));
} else if (group_type == MEDIA_GROUP_TAG_BY_MEDIA_ID) {
snprintf(select_query, sizeof(select_query), SELECT_TAG_COUNT_BY_MEDIA_ID, group_name);
} else if (group_type == MEDIA_GROUP_BOOKMARK_BY_MEDIA_ID) {
+ attr = _content_get_alias_attirbute_handle();
+
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
tmp_query = sqlite3_mprintf(SELECT_BOOKMARK_COUNT_BY_MEDIA_ID, _filter->storage_id, group_name);
else
- tmp_query = sqlite3_mprintf(SELECT_BOOKMARK_COUNT_BY_MEDIA_ID, DB_TABLE_MEDIA_VIEW, group_name);
+ tmp_query = sqlite3_mprintf(SELECT_BOOKMARK_COUNT_BY_MEDIA_ID, DB_VIEW_MEDIA, group_name);
SAFE_STRLCAT(select_query, tmp_query, sizeof(select_query));
} else if (group_type == MEDIA_GROUP_STORAGE) {
SAFE_STRLCAT(select_query, tmp_query, sizeof(select_query));
} else if (group_type == MEDIA_GROUP_FACE_BY_MEDIA_ID) {
+ attr = _content_get_alias_attirbute_handle();
+
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
tmp_query = sqlite3_mprintf(SELECT_FACE_COUNT_BY_MEDIA_ID, _filter->storage_id, group_name);
else
- tmp_query = sqlite3_mprintf(SELECT_FACE_COUNT_BY_MEDIA_ID, DB_TABLE_MEDIA_VIEW, group_name);
+ tmp_query = sqlite3_mprintf(SELECT_FACE_COUNT_BY_MEDIA_ID, DB_VIEW_MEDIA, group_name);
SAFE_STRLCAT(select_query, tmp_query, sizeof(select_query));
-#ifdef _USE_TV_PROFILE
+#ifdef _USE_TVPD_MODE
} else if (group_type == MEDIA_GROUP_PVR) {
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_PVR_COUNT_BY_STORAGE_ID, _filter->storage_id);
SAFE_FREE(option_query);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- while (sqlite3_step(stmt) == SQLITE_ROW)
+ if (sqlite3_step(stmt) == SQLITE_ROW)
*item_count = (int)sqlite3_column_int(stmt, 0);
SQLITE3_FINALIZE(stmt);
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_ALBUM, _filter->storage_id, group_id);
else
- snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_ALBUM, DB_TABLE_MEDIA_VIEW, group_id);
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_ALBUM, DB_VIEW_MEDIA, group_id);
} else if (group_type == MEDIA_GROUP_PLAYLIST) {
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_PLAYLIST, _filter->storage_id, group_id);
else
- snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_PLAYLIST, DB_TABLE_MEDIA_VIEW, group_id);
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_PLAYLIST, DB_VIEW_MEDIA, group_id);
} else if (group_type == MEDIA_GROUP_TAG) {
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_TAG, _filter->storage_id, group_id);
else
- snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_TAG, DB_TABLE_MEDIA_VIEW, group_id);
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_TAG, DB_VIEW_MEDIA, group_id);
} else {
media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_ITEM, _filter->storage_id);
else
- snprintf(select_query, sizeof(select_query), SELECT_MEDIA_ITEM, DB_TABLE_MEDIA_VIEW);
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_ITEM, DB_VIEW_MEDIA);
} else if (group_type == MEDIA_GROUP_FOLDER) {
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_FOLDER, _filter->storage_id, group_name);
else
- snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_FOLDER, DB_TABLE_MEDIA_VIEW, group_name);
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_FOLDER, DB_VIEW_MEDIA, group_name);
} else if (group_type == MEDIA_GROUP_STORAGE) {
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_STORAGE, group_name, group_name);
} else {
if ((_filter1 != NULL) && STRING_VALID(_filter1->storage_id))
snprintf(select_query1, sizeof(select_query1), SELECT_MEDIA_FROM_FOLDER, _filter1->storage_id, group_name);
else
- snprintf(select_query1, sizeof(select_query1), SELECT_MEDIA_FROM_FOLDER, DB_TABLE_MEDIA_VIEW, group_name);
+ snprintf(select_query1, sizeof(select_query1), SELECT_MEDIA_FROM_FOLDER, DB_VIEW_MEDIA, group_name);
ret = __media_db_make_query(filter1, attr, select_query1, sizeof(select_query1), &condition_query1, &option_query1);
if (ret != MEDIA_CONTENT_ERROR_NONE) {
if ((_filter2 != NULL) && STRING_VALID(_filter2->storage_id))
snprintf(select_query2, sizeof(select_query2), SELECT_MEDIA_FROM_FOLDER, _filter2->storage_id, group_name);
else
- snprintf(select_query2, sizeof(select_query2), SELECT_MEDIA_FROM_FOLDER, DB_TABLE_MEDIA_VIEW, group_name);
+ snprintf(select_query2, sizeof(select_query2), SELECT_MEDIA_FROM_FOLDER, DB_VIEW_MEDIA, group_name);
ret = __media_db_make_query(filter2, attr, select_query2, sizeof(select_query2), &condition_query2, &option_query2);
if (ret != MEDIA_CONTENT_ERROR_NONE) {
attr = _content_get_attirbute_handle();
memset(select_query, 0x00, sizeof(select_query));
-#ifdef _USE_TV_PROFILE
+#ifdef _USE_TVPD_MODE
if (group < MEDIA_PVR_GROUP_DURATION) { /*media content */
if (group_name != NULL) {
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
tmp_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_GROUP, _filter->storage_id, __media_db_get_group_name(group), group_name);
else
- tmp_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_GROUP, DB_TABLE_MEDIA_VIEW, __media_db_get_group_name(group), group_name);
+ tmp_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_GROUP, DB_VIEW_MEDIA, __media_db_get_group_name(group), group_name);
SAFE_STRLCAT(select_query, tmp_query, sizeof(select_query));
} else {
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_GROUP_NULL, _filter->storage_id, __media_db_get_group_name(group));
else
- snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_GROUP_NULL, DB_TABLE_MEDIA_VIEW, __media_db_get_group_name(group));
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_GROUP_NULL, DB_VIEW_MEDIA, __media_db_get_group_name(group));
}
} else if (group < MEDIA_UHD_GROUP_CONTENT_TITLE) {/*pvr content*/
if (group_name != NULL) {
tmp_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_GROUP, _filter->storage_id, __media_db_get_group_name(group), group_name);
SAFE_STRLCAT(select_query, tmp_query, sizeof(select_query));
} else {
- tmp_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_GROUP, DB_TABLE_MEDIA_VIEW, __media_db_get_group_name(group), group_name);
+ tmp_query = sqlite3_mprintf(SELECT_MEDIA_COUNT_FROM_GROUP, DB_VIEW_MEDIA, __media_db_get_group_name(group), group_name);
SAFE_STRLCAT(select_query, tmp_query, sizeof(select_query));
}
} else {
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_GROUP_NULL, _filter->storage_id, __media_db_get_group_name(group));
else
- snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_GROUP_NULL, DB_TABLE_MEDIA_VIEW, __media_db_get_group_name(group));
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_COUNT_FROM_GROUP_NULL, DB_VIEW_MEDIA, __media_db_get_group_name(group));
}
#endif
ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
SAFE_FREE(option_query);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- while (sqlite3_step(stmt) == SQLITE_ROW)
+ if (sqlite3_step(stmt) == SQLITE_ROW)
*item_count = (int)sqlite3_column_int(stmt, 0);
SQLITE3_FINALIZE(stmt);
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
tmp_query = sqlite3_mprintf(SELECT_MEDIA_FROM_GROUP, _filter->storage_id, __media_db_get_group_name(group), group_name);
else
- tmp_query = sqlite3_mprintf(SELECT_MEDIA_FROM_GROUP, DB_TABLE_MEDIA_VIEW, __media_db_get_group_name(group), group_name);
+ tmp_query = sqlite3_mprintf(SELECT_MEDIA_FROM_GROUP, DB_VIEW_MEDIA, __media_db_get_group_name(group), group_name);
SAFE_STRLCAT(select_query, tmp_query, sizeof(select_query));
} else {
if ((_filter != NULL) && STRING_VALID(_filter->storage_id))
snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_GROUP_NULL, _filter->storage_id, __media_db_get_group_name(group));
else
- snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_GROUP_NULL, DB_TABLE_MEDIA_VIEW, __media_db_get_group_name(group));
+ snprintf(select_query, sizeof(select_query), SELECT_MEDIA_FROM_GROUP_NULL, DB_VIEW_MEDIA, __media_db_get_group_name(group));
}
ret = __media_db_make_query(filter, attr, select_query, sizeof(select_query), &condition_query, &option_query);
int _media_db_get_storage(filter_h filter, media_storage_cb callback, void *user_data)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- char select_query[DEFAULT_QUERY_SIZE];
+ char select_query[DEFAULT_QUERY_SIZE] = {0, };
char *condition_query = NULL;
char *option_query = NULL;
sqlite3_stmt *stmt = NULL;
}
_storage->storage_id = g_strdup((const char *)sqlite3_column_text(stmt, 0));
- _storage->storage_name = g_strdup((const char *)sqlite3_column_text(stmt, 1));
- _storage->storage_path = g_strdup((const char *)sqlite3_column_text(stmt, 2));
- _storage->storage_account = g_strdup((const char *)sqlite3_column_text(stmt, 3));
- _storage->storage_type = (int)sqlite3_column_int(stmt, 4);
+ _storage->storage_path = g_strdup((const char *)sqlite3_column_text(stmt, 1));
+ _storage->storage_type = (int)sqlite3_column_int(stmt, 2);
if (callback((media_storage_h)_storage, user_data) == false) {
media_storage_destroy((media_storage_h) _storage);
return ret;
}
-#ifdef _USE_TV_PROFILE
+#ifdef _USE_TVPD_MODE
int _media_db_get_pvr_group_item(const char *group_name, filter_h filter, media_group_e group, media_pvr_cb callback, void *user_data)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- char select_query[DEFAULT_QUERY_SIZE];
+ char select_query[DEFAULT_QUERY_SIZE] = {0, };
char *tmp_query = NULL;
char *condition_query = NULL;
char *option_query = NULL;
MEDIA_PVR_CHANNEL_TYPE,
MEDIA_PVR_CHANNEL_NAME,
MEDIA_PVR_CHANNEL_NUM,
+ MEDIA_PVR_SERVICE_PROFILE,
MEDIA_PVR_PROGRAM_TITLE,
MEDIA_PVR_PROGRAM_NUM,
MEDIA_PVR_PROGRAM_CRID,
_pvr->channel_type = (int)sqlite3_column_int(stmt, MEDIA_PVR_CHANNEL_TYPE);
+ _pvr->service_profile = (unsigned int)sqlite3_column_int(stmt, MEDIA_PVR_SERVICE_PROFILE);
+
if (STRING_VALID((const char *)sqlite3_column_text(stmt, MEDIA_PVR_CHANNEL_NAME)))
_pvr->channel_name = strdup((const char *)sqlite3_column_text(stmt, MEDIA_PVR_CHANNEL_NAME));
int _media_db_get_pvr(filter_h filter, media_pvr_cb callback, void *user_data)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- char select_query[DEFAULT_QUERY_SIZE];
+ char select_query[DEFAULT_QUERY_SIZE] = {0, };
char *condition_query = NULL;
char *option_query = NULL;
sqlite3_stmt *stmt = NULL;
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
if (sqlite3_step(stmt) == SQLITE_ROW) {
- if (STRING_VALID((const char *)sqlite3_column_text(stmt, 0)))
- strncpy(storage_id, (const char *)sqlite3_column_text(stmt, 0), MEDIA_CONTENT_UUID_SIZE);
+ if (STRING_VALID((const char *)sqlite3_column_text(stmt, 0))) {
+ if (!SAFE_STRLCPY(storage_id, (const char *)sqlite3_column_text(stmt, 0), MEDIA_CONTENT_UUID_SIZE+1)) {
+ media_content_error("Storage id copy fail");
+ ret = MEDIA_CONTENT_ERROR_INVALID_OPERATION;
+ }
+ }
} else {
media_content_error("There's no media!!");
ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
return ret;
}
-#ifdef _USE_TV_PROFILE
+
+#ifdef _USE_TVPD_MODE
typedef enum {
MEDIA_UHD_MEDIA_ID = 0,
MEDIA_UHD_STORAGE_ID,
int _media_db_get_uhd(filter_h filter, media_uhd_cb callback, void *user_data)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
- char select_query[DEFAULT_QUERY_SIZE];
+ char select_query[DEFAULT_QUERY_SIZE] = {0, };
char *condition_query = NULL;
char *option_query = NULL;
sqlite3_stmt *stmt = NULL;