#include <media_info_private.h>
#include <media_util_private.h>
#include <system_info.h>
+#ifdef _USE_TV_PROFILE
+#include <media_content_internal.h>
+#endif
static void __media_info_insert_completed_cb(media_request_result_s *result, void *user_data);
static void __media_info_thumbnail_completed_cb(int error, const char *path, void *user_data);
if (_thumb_cb != NULL) {
media = _thumb_cb->handle;
if ((media != NULL) && STRING_VALID(path)) {
- SAFE_FREE(media->thumbnail_path);
+ media->thumbnail_path = NULL;
media->thumbnail_path = g_strdup(path);
}
void _media_info_item_get_detail(sqlite3_stmt* stmt, media_info_h media)
{
media_info_s *_media = (media_info_s*)media;
+#ifndef _USE_TV_PROFILE
+ char *tmp_path = NULL;
+ char repl_path[MAX_QUERY_SIZE] = {0, };
+#endif
_media->media_id = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_UUID));
+#ifdef _USE_TV_PROFILE
_media->file_path = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_PATH));
+#else
+ tmp_path = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_PATH));
+ _media_content_rollback_path(tmp_path, repl_path);
+ _media->file_path = g_strdup(repl_path);
+ SAFE_FREE(tmp_path);
+#endif
_media->display_name = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_FILE_NAME));
_media->media_type = (int)sqlite3_column_int(stmt, MEDIA_INFO_TYPE);
_media->mime_type = g_strdup((const char *)sqlite3_column_text(stmt, MEDIA_INFO_MIME_TYPE));
bool ignore_dir = FALSE;
char *folder_path = NULL;
char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
+ char repl_path[MAX_QUERY_SIZE] = {0, };
int ret = MEDIA_CONTENT_ERROR_NONE;
media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid path");
media_content_retvm_if(info == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid info");
+ memset(repl_path, 0, sizeof(repl_path));
+ ret = _media_content_replace_path(path, repl_path);
+ media_content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
- ret = _media_util_check_ignore_file(path, &ignore_file);
+ ret = _media_util_check_ignore_file(repl_path, &ignore_file);
media_content_retvm_if(ignore_file == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
- ret = _media_util_check_file_exist(path);
+ ret = _media_util_check_file_exist(repl_path);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- folder_path = g_path_get_dirname(path);
+ folder_path = g_path_get_dirname(repl_path);
ret = _media_util_check_ignore_dir(folder_path, &ignore_dir);
SAFE_FREE(folder_path);
media_content_retvm_if(ignore_dir == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
memset(storage_id, 0x00, sizeof(storage_id));
- ret = media_svc_get_storage_id(_content_get_db_handle(), path, storage_id);
+ ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id);
if (ret != MS_MEDIA_ERR_NONE) {
media_content_error("media_svc_get_storage_id failed : %d", ret);
return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
}
- ret = media_svc_check_item_exist_by_path(_content_get_db_handle(), storage_id, path);
+ ret = media_svc_check_item_exist_by_path(_content_get_db_handle(), storage_id, repl_path);
if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
- media_content_sec_debug("media_svc_check_item_exist_by_path : no record : %s", path);
+ media_content_sec_debug("media_svc_check_item_exist_by_path : no record : %s", repl_path);
media_svc_storage_type_e storage_type = 0;
- ret = media_svc_get_storage_type(path, &storage_type, tzplatform_getuid(TZ_USER_NAME));
+ ret = media_svc_get_storage_type(repl_path, &storage_type, tzplatform_getuid(TZ_USER_NAME));
if (ret != MS_MEDIA_ERR_NONE) {
media_content_sec_error("media_svc_get_storage_type failed : %d", ret);
return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
}
- ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_id, storage_type, path, tzplatform_getuid(TZ_USER_NAME));
+ ret = media_svc_insert_item_immediately(_content_get_db_handle(), storage_id, storage_type, repl_path, tzplatform_getuid(TZ_USER_NAME));
if (ret != MS_MEDIA_ERR_NONE) {
if (ret == MS_MEDIA_ERR_DB_CONSTRAINT_FAIL) {
- media_content_sec_error("This item is already inserted. This may be normal operation because other process already did this (%s)", path);
+ media_content_sec_error("This item is already inserted. This may be normal operation because other process already did this (%s)", repl_path);
ret = MEDIA_CONTENT_ERROR_NONE;
} else {
- media_content_sec_error("media_svc_insert_item_immediately failed : %d (%s)", ret, path);
+ media_content_sec_error("media_svc_insert_item_immediately failed : %d (%s)", ret, repl_path);
}
return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
}
} else if (ret != MS_MEDIA_ERR_NONE) {
- media_content_sec_error("media_svc_check_item_exist_by_path failed : %d (%s)", ret, path);
+ media_content_sec_error("media_svc_check_item_exist_by_path failed : %d (%s)", ret, repl_path);
return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
}
media_info_s *_media = (media_info_s*)calloc(1, sizeof(media_info_s));
media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
- ret = _media_info_get_media_info_from_db(path, DEFAULT_MEDIA_STORAGE_ID, (media_info_h)_media);
+ if (STRING_VALID(storage_id))
+ ret = _media_info_get_media_info_from_db(repl_path, storage_id, (media_info_h)_media);
+ else
+ ret = _media_info_get_media_info_from_db(repl_path, DEFAULT_MEDIA_STORAGE_ID, (media_info_h)_media);
*info = (media_info_h)_media;
return ret;
media_insert_completed_cb completed_cb,
void *user_data)
{
+ char **repl_path_array = NULL;
+ int idx = 0;
+ int ret = MS_MEDIA_ERR_NONE;
+ char repl_path[MAX_QUERY_SIZE] = {0, };
+
media_content_retvm_if(path_array == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path_array");
media_content_retvm_if(array_length <= 0, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid array_length");
- return __media_info_insert_batch(MEDIA_BATCH_INSERT_NORMAL, path_array, array_length, completed_cb, user_data);
+ repl_path_array = calloc(1, sizeof(char *) * array_length);
+
+ for (idx = 0; idx < array_length; idx++) {
+ if (STRING_VALID(path_array[idx])) {
+ memset(repl_path, 0, sizeof(repl_path));
+ _media_content_replace_path(path_array[idx], repl_path);
+ repl_path_array[idx] = strndup(repl_path, strlen(repl_path));
+ } else {
+ media_content_error("path[%d] is invalid string", idx);
+ }
+ }
+
+ ret = __media_info_insert_batch(MEDIA_BATCH_INSERT_NORMAL, (const char **)repl_path_array, array_length, completed_cb, user_data);
+ for (idx = 0; idx < array_length; idx++)
+ SAFE_FREE(repl_path_array[idx]);
+
+ SAFE_FREE(repl_path_array);
+
+ return ret;
}
int media_info_insert_burst_shot_to_db(const char **path_array, unsigned int array_length, media_insert_burst_shot_completed_cb callback, void *user_data)
{
+ char **repl_path_array = NULL;
+ int idx = 0;
+ int ret = MS_MEDIA_ERR_NONE;
+ char repl_path[MAX_QUERY_SIZE] = {0, };
+
media_content_retvm_if(path_array == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path_array");
media_content_retvm_if(array_length <= 0, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid array_length");
- return __media_info_insert_batch(MEDIA_BATCH_INSERT_BURSTSHOT, path_array, array_length, callback, user_data);
+ repl_path_array = calloc(1, sizeof(char *) * array_length);
+
+ for (idx = 0; idx < array_length; idx++) {
+ if (STRING_VALID(path_array[idx])) {
+ memset(repl_path, 0, sizeof(repl_path));
+ _media_content_replace_path(path_array[idx], repl_path);
+ repl_path_array[idx] = strndup(repl_path, strlen(repl_path));
+ } else {
+ media_content_error("path[%d] is invalid string", idx);
+ }
+ }
+
+ ret = __media_info_insert_batch(MEDIA_BATCH_INSERT_BURSTSHOT, (const char **)repl_path_array, array_length, callback, user_data);
+ for (idx = 0; idx < array_length; idx++)
+ SAFE_FREE(repl_path_array[idx]);
+
+ SAFE_FREE(repl_path_array);
+
+ return ret;
+}
+
+#ifdef _USE_SENIOR_MODE
+int media_info_insert_to_db_with_contact_data(const char *path, const char* contact, const char* app_data, media_info_h *info)
+{
+ int ret = media_info_insert_to_db(path, info);
+ media_content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "media_info_insert_to_db [%s] failed", path);
+
+ ret = media_info_set_contact(*info, contact);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ media_content_error("media_info_set_contact [%s] failed", contact);
+
+ media_info_s* _media_info = (media_info_s*)*info;
+ ret = media_info_delete_from_db(_media_info->media_id);
+ media_content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "media_info_delete_from_db [%s] failed", _media_info->media_id);
+
+ media_info_destroy(*info);
+ return ret;
+ }
+
+ ret = media_info_set_app_data(*info, app_data);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ media_content_error("media_info_set_app_data [%s] failed", app_data);
+
+ media_info_s* _media_info = (media_info_s*)*info;
+ ret = media_info_delete_from_db(_media_info->media_id);
+ media_content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "media_info_delete_from_db [%s] failed", _media_info->media_id);
+
+ media_info_destroy(*info);
+ return ret;
+ }
+
+ ret = media_info_update_to_db(*info);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ media_content_error("media_info_update_to_db [] failed");
+
+ media_info_s* _media_info = (media_info_s*)*info;
+ ret = media_info_delete_from_db(_media_info->media_id);
+ media_content_retvm_if(ret != MEDIA_CONTENT_ERROR_NONE, ret, "media_info_delete_from_db [%s] failed", _media_info->media_id);
+
+ media_info_destroy(*info);
+ return ret;
+ }
+
+ return ret;
}
+int media_info_delete_contact_from_db(const char* contact, const char* storage_id)
+{
+ return -1;
+}
+
+int media_info_get_media_info_by_path_from_db(const char* path, media_info_h* media)
+{
+ char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0,};
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid path");
+ media_content_retvm_if(media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid info");
+
+ memset(storage_id, 0x00, sizeof(storage_id));
+ ret = media_svc_get_storage_id(_content_get_db_handle(), path, storage_id);
+ if (ret != MS_MEDIA_ERR_NONE) {
+ media_content_error("media_svc_get_storage_id failed : %d", ret);
+ return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+ }
+
+ media_info_s *_media = (media_info_s*)calloc(1, sizeof(media_info_s));
+ media_content_retvm_if(_media == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+
+ ret = _media_info_get_media_info_from_db(path, storage_id, (media_info_h)_media);
+ *media = (media_info_h)_media;
+
+ return ret;
+}
+
+int media_info_delete_item(const char *media_id)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ char *path = NULL;
+ char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0,};
+
+ if (!STRING_VALID(media_id)) {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ memset(storage_id, 0x00, sizeof(storage_id));
+
+ ret = __media_info_get_media_path_by_id_from_db(media_id, &path);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ media_content_error("__media_info_get_media_path_by_id_from_db failed : %d", ret);
+ SAFE_FREE(path);
+ return ret;
+ }
+
+ ret = _media_db_get_storage_id_by_media_id(media_id, storage_id);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ media_content_error("_media_db_get_storage_id_by_media_id failed : %d", ret);
+ SAFE_FREE(path);
+ return ret;
+ }
+
+ ret = media_svc_delete_item_by_path(_content_get_db_handle(), storage_id, path, tzplatform_getuid(TZ_USER_NAME));
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ media_content_error("remove from DB failed : %d", ret);
+ SAFE_FREE(path);
+ return ret;
+ }
+
+ ret = media_svc_remove_file(path);
+ SAFE_FREE(path);
+ return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
+}
+
+#endif
+
int media_info_delete_from_db(const char *media_id)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
SAFE_FREE(_media->age_rating);
SAFE_FREE(_media->keyword);
SAFE_FREE(_media->title);
+#ifdef _USE_TV_PROFILE
+ SAFE_FREE(_media->modified_month);
+#endif
SAFE_FREE(_media->weather);
SAFE_FREE(_media->storage_uuid);
+#ifdef _USE_SENIOR_MODE
+ SAFE_FREE(_media->contact);
+ SAFE_FREE(_media->app_data);
+#endif
if (_media->image_meta) {
SAFE_FREE(_media->image_meta->media_id);
return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
}
}
+#ifdef _USE_TV_PROFILE
+ if (STRING_VALID(_src->modified_month)) {
+ _dst->modified_month = strdup(_src->modified_month);
+ if (_dst->modified_month == NULL) {
+ media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ media_info_destroy((media_info_h)_dst);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ }
+#endif
+#ifdef _USE_SENIOR_MODE
+ if (STRING_VALID(_src->contact)) {
+ _dst->contact = strdup(_src->contact);
+ if (_dst->contact == NULL) {
+ media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ media_info_destroy((media_info_h)_dst);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ }
+
+ if (STRING_VALID(_src->app_data)) {
+ _dst->app_data = strdup(_src->app_data);
+ if (_dst->app_data == NULL) {
+ media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ media_info_destroy((media_info_h)_dst);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ }
+#endif
_dst->media_type = _src->media_type;
_dst->size = _src->size;
_dst->request_id = _src->request_id;
_dst->face_request_id = _src->face_request_id;
_dst->is_360 = _src->is_360;
+#ifdef _USE_TV_PROFILE
+ _dst->extract_flag = _src->extract_flag;
+#endif
if (_src->media_type == MEDIA_CONTENT_TYPE_IMAGE && _src->image_meta) {
_dst->image_meta = (image_meta_s *)calloc(1, sizeof(image_meta_s));
return ret;
}
+#ifdef _USE_TV_PROFILE
+int media_info_get_extract_flag(media_info_h media, int *extract_flag)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_info_s *_media = (media_info_s *)media;
+
+ if (_media && extract_flag) {
+ *extract_flag = _media->extract_flag;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ } else {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+}
+#endif
int media_info_get_description(media_info_h media, char **description)
{
return ret;
}
+#ifdef _USE_TV_PROFILE
+int media_info_get_played_position(media_info_h media, int *played_position)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_info_s *_media = (media_info_s*)media;
+
+ if (_media) {
+ *played_position = _media->played_position;
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ } else {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+}
+#endif
+
int media_info_get_played_count(media_info_h media, int *played_count)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
return ret;
}
+#ifdef _USE_TV_PROFILE
+int media_info_get_modified_month(media_info_h media, char **modified_month)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_info_s *_media = (media_info_s*)media;
+
+ if (_media && modified_month) {
+ if (STRING_VALID(_media->modified_month)) {
+ *modified_month = strdup(_media->modified_month);
+ if (*modified_month == NULL) {
+ media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ } else {
+ *modified_month = NULL;
+ }
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ } else {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+}
+#endif
+#ifdef _USE_SENIOR_MODE
+int media_info_get_contact(media_info_h media, char **contact)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_info_s *_media = (media_info_s*)media;
+
+ if (_media && contact) {
+ if (STRING_VALID(_media->contact)) {
+ *contact = strdup(_media->contact);
+ if (*contact == NULL) {
+ media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ } else {
+ *contact = NULL;
+ }
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ } else {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+}
+
+int media_info_get_app_data(media_info_h media, char **app_data)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_info_s *_media = (media_info_s*)media;
+
+ if (_media && app_data) {
+ if (STRING_VALID(_media->app_data)) {
+ *app_data = strdup(_media->app_data);
+ if (*app_data == NULL) {
+ media_content_error("OUT_OF_MEMORY(0x%08x)", MEDIA_CONTENT_ERROR_OUT_OF_MEMORY);
+ return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
+ }
+ } else {
+ *app_data = NULL;
+ }
+ ret = MEDIA_CONTENT_ERROR_NONE;
+ } else {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+}
+#endif
+#ifdef _USE_TV_PROFILE
+int media_info_set_played_count(media_info_h media, int played_count)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+
+ media_info_s *_media = (media_info_s*)media;
+
+ if (_media) {
+ _media->played_count = played_count;
+ } else {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+}
+#endif
+
int media_info_set_played_time(media_info_h media)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
return ret;
}
+#ifdef _USE_TV_PROFILE
+int media_info_set_played_position(media_info_h media, int played_position)
+{
+ int ret = MEDIA_CONTENT_ERROR_NONE;
+ media_info_s *_media = (media_info_s*)media;
+
+ if ((_media != NULL) && (played_position >= 0)) {
+ _media->played_position = played_position;
+ } else {
+ media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
+ ret = MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
+ }
+
+ return ret;
+}
+#endif
int media_info_get_media_from_db(const char *media_id, media_info_h *media)
{
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, \
- 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,
- album, artist, genre, recorded_date);
+#ifdef _USE_SENIOR_MODE
+ if (_media_content_is_support_senior_mode()) {
+ 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, contact=%Q, app_data=%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, _media->contact, _media->app_data);
+ } else
+#endif
+ {
+ 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, \
+ 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,
+ album, artist, genre, recorded_date);
+ }
sql = sqlite3_mprintf("UPDATE %Q SET %s WHERE media_uuid=%Q", _media->storage_uuid, set_sql, _media->media_id);
char *file_path = NULL;
media_content_storage_e storage_type = 0;
char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
+ char repl_path[MAX_QUERY_SIZE] = {0, };
if (!STRING_VALID(media_id)) {
media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
media_info_destroy(media);
return ret;
}
+ memset(repl_path, 0, sizeof(repl_path));
+ ret = _media_content_replace_path(file_path, repl_path);
- ret = _media_util_check_file_exist(file_path);
+ ret = _media_util_check_file_exist(repl_path);
if (ret != MEDIA_CONTENT_ERROR_NONE) {
SAFE_FREE(file_path);
media_info_destroy(media);
}
memset(storage_id, 0x00, sizeof(storage_id));
- ret = media_svc_get_storage_id(_content_get_db_handle(), file_path, storage_id);
+ ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id);
if (ret != MS_MEDIA_ERR_NONE) {
media_content_error("media_svc_get_storage_id failed : %d", ret);
SAFE_FREE(file_path);
return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
}
- ret = media_svc_refresh_item(_content_get_db_handle(), storage_id, storage_type, file_path, tzplatform_getuid(TZ_USER_NAME));
+ ret = media_svc_refresh_item(_content_get_db_handle(), storage_id, storage_type, repl_path, tzplatform_getuid(TZ_USER_NAME));
if (ret != MS_MEDIA_ERR_NONE)
ret = _content_error_capi(MEDIA_CONTENT_TYPE, ret);
media_svc_storage_type_e src_storage_type = 0;
media_svc_storage_type_e dst_storage_type = 0;
char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
+ char repl_path[MAX_QUERY_SIZE] = {0, };
+ char org_repl_path[MAX_QUERY_SIZE] = {0, };
media_content_retvm_if(media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid media");
media_content_retvm_if(!STRING_VALID(dst_path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "invalid dst_path");
+ memset(repl_path, 0, sizeof(repl_path));
+ memset(org_repl_path, 0, sizeof(org_repl_path));
+ ret = _media_content_replace_path(dst_path, repl_path);
+ media_content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
media_info_s *_media = (media_info_s*)media;
- ret = _media_util_check_ignore_file(dst_path, &ignore_file);
+ ret = _media_util_check_ignore_file(repl_path, &ignore_file);
media_content_retvm_if(ignore_file == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
+ ret = _media_content_replace_path(_media->file_path, org_repl_path);
+ media_content_retvm_if(!STRING_VALID(org_repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
- ret = _media_util_check_file_exist(dst_path);
+ ret = _media_util_check_file_exist(repl_path);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- folder_path = g_path_get_dirname(dst_path);
+ folder_path = g_path_get_dirname(repl_path);
ret = _media_util_check_ignore_dir(folder_path, &ignore_dir);
SAFE_FREE(folder_path);
media_content_retvm_if(ignore_dir == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
- ret = media_svc_get_storage_type(_media->file_path, &src_storage_type, tzplatform_getuid(TZ_USER_NAME));
+ ret = media_svc_get_storage_type(org_repl_path, &src_storage_type, tzplatform_getuid(TZ_USER_NAME));
if (ret != MS_MEDIA_ERR_NONE) {
media_content_sec_error("media_svc_get_storage_type failed : %d", ret);
return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
}
- ret = media_svc_get_storage_type(dst_path, &dst_storage_type, tzplatform_getuid(TZ_USER_NAME));
+ ret = media_svc_get_storage_type(repl_path, &dst_storage_type, tzplatform_getuid(TZ_USER_NAME));
if (ret != MS_MEDIA_ERR_NONE) {
media_content_sec_error("media_svc_get_storage_type failed : %d", ret);
return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
}
memset(storage_id, 0x00, sizeof(storage_id));
- ret = media_svc_get_storage_id(_content_get_db_handle(), _media->file_path, storage_id);
+ ret = media_svc_get_storage_id(_content_get_db_handle(), org_repl_path, storage_id);
if (ret != MS_MEDIA_ERR_NONE) {
media_content_error("media_svc_get_storage_id failed : %d", ret);
return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
}
- ret = media_svc_move_item(_content_get_db_handle(), storage_id, src_storage_type, _media->file_path, dst_storage_type, dst_path, tzplatform_getuid(TZ_USER_NAME));
+ ret = media_svc_move_item(_content_get_db_handle(), storage_id, src_storage_type, org_repl_path, dst_storage_type, repl_path, tzplatform_getuid(TZ_USER_NAME));
return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
}
{
int ret = MEDIA_CONTENT_ERROR_NONE;
static unsigned int req_id = 0;
+ char repl_path[MAX_QUERY_SIZE] = {0, };
media_info_s *_media = (media_info_s*)media;
if (_media != NULL && STRING_VALID(_media->media_id) && STRING_VALID(_media->file_path)) {
+ memset(repl_path, 0, sizeof(repl_path));
+ ret = _media_content_replace_path(_media->file_path, repl_path);
+ media_content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
+
media_thumbnail_cb_s *_thumb_cb = (media_thumbnail_cb_s*)calloc(1, sizeof(media_thumbnail_cb_s));
media_content_retvm_if(_thumb_cb == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
req_id++;
_thumb_cb->user_data = user_data;
_thumb_cb->thumbnail_completed_cb = callback;
- ret = thumbnail_request_from_db_async(_media->request_id, _media->file_path, (ThumbFunc)__media_info_thumbnail_completed_cb, (void *)_thumb_cb, tzplatform_getuid(TZ_USER_NAME));
+ ret = thumbnail_request_from_db_async(_media->request_id, repl_path, (ThumbFunc)__media_info_thumbnail_completed_cb, (void *)_thumb_cb, tzplatform_getuid(TZ_USER_NAME));
ret = _content_error_capi(MEDIA_THUMBNAIL_TYPE, ret);
} else {
media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
{
int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
+ char repl_path[MAX_QUERY_SIZE] = {0, };
if (_media != NULL && STRING_VALID(_media->media_id) && STRING_VALID(_media->file_path) && _media->request_id > 0) {
- ret = thumbnail_request_cancel_media(_media->request_id, _media->file_path);
+ memset(repl_path, 0, sizeof(repl_path));
+ ret = _media_content_replace_path(_media->file_path, repl_path);
+ media_content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
+
+ ret = thumbnail_request_cancel_media(_media->request_id, repl_path);
ret = _content_error_capi(MEDIA_THUMBNAIL_TYPE, ret);
} else {
media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
int ret = MEDIA_CONTENT_ERROR_NONE;
static unsigned int req_id = 0;
media_info_s *_media = (media_info_s*)media;
+ char repl_path[MAX_QUERY_SIZE] = {0, };
if (!__media_info_isFaceRecognition_feature_supported()) {
media_content_error("NOT_SUPPORTED(0x%08x)", MEDIA_CONTENT_ERROR_NOT_SUPPORTED);
}
if (_media != NULL && STRING_VALID(_media->media_id) && STRING_VALID(_media->file_path)) {
+ memset(repl_path, 0, sizeof(repl_path));
+ ret = _media_content_replace_path(_media->file_path, repl_path);
+ media_content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
media_face_cb_s *_face_cb = (media_face_cb_s*)calloc(1, sizeof(media_face_cb_s));
media_content_retvm_if(_face_cb == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
req_id++;
_face_cb->user_data = user_data;
_face_cb->face_completed_cb = callback;
- ret = dcm_request_extract_face_async(_media->face_request_id, _media->file_path, (FaceFunc)__media_info_face_completed_cb, (void *)_face_cb, tzplatform_getuid(TZ_USER_NAME));
+ ret = dcm_request_extract_face_async(_media->face_request_id, repl_path, (FaceFunc)__media_info_face_completed_cb, (void *)_face_cb, tzplatform_getuid(TZ_USER_NAME));
ret = _content_error_capi(MEDIA_THUMBNAIL_TYPE, ret);
} else {
media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
{
int ret = MEDIA_CONTENT_ERROR_NONE;
media_info_s *_media = (media_info_s*)media;
+ char repl_path[MAX_QUERY_SIZE] = {0, };
if (!__media_info_isFaceRecognition_feature_supported()) {
media_content_error("NOT_SUPPORTED(0x%08x)", MEDIA_CONTENT_ERROR_NOT_SUPPORTED);
}
if (_media != NULL && STRING_VALID(_media->media_id) && STRING_VALID(_media->file_path) && _media->face_request_id > 0) {
- ret = dcm_request_cancel_face(_media->face_request_id, _media->file_path);
+ memset(repl_path, 0, sizeof(repl_path));
+ ret = _media_content_replace_path(_media->file_path, repl_path);
+ media_content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
+ ret = dcm_request_cancel_face(_media->face_request_id, repl_path);
ret = _content_error_capi(MEDIA_THUMBNAIL_TYPE, ret);
} else {
media_content_error("INVALID_PARAMETER(0x%08x)", MEDIA_CONTENT_ERROR_INVALID_PARAMETER);
static int __media_info_map_data_usr_to_svc(media_info_s *media, media_svc_content_info_s **service_content, media_content_storage_e storage_type)
{
media_content_retvm_if(media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid handle");
+#ifndef _USE_TV_PROFILE
+ char repl_path[MAX_QUERY_SIZE] = {0, };
+ char *tmp_path = NULL;
+#endif
media_svc_content_info_s *svc_content_info = calloc(1, sizeof(media_svc_content_info_s));
media_content_retvm_if(svc_content_info == NULL, MEDIA_CONTENT_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+#ifdef _USE_TV_PROFILE
svc_content_info->path = g_strdup(media->file_path);
+#else
+ memset(repl_path, 0, sizeof(repl_path));
+ tmp_path = g_strdup(media->file_path);
+ _media_content_replace_path(tmp_path, repl_path);
+ svc_content_info->path = g_strdup(repl_path);
+ SAFE_FREE(tmp_path);
+#endif
svc_content_info->file_name = g_strdup(media->display_name);
svc_content_info->media_type = media->media_type;
svc_content_info->mime_type = g_strdup(media->mime_type);
svc_content_info->played_count = media->played_count;
svc_content_info->favourate = media->favourite;
+#ifdef _USE_SENIOR_MODE
+ if (_media_content_is_support_senior_mode()) {
+ svc_content_info->contact = g_strdup(media->contact);
+ svc_content_info->app_data = g_strdup(media->app_data);
+ }
+#endif
+
svc_content_info->media_meta.title = g_strdup(media->title);
svc_content_info->media_meta.rating = media->rating;
svc_content_info->media_meta.description = g_strdup(media->description);
int media_info_insert_to_db_with_data(media_info_h media)
{
int ret = MEDIA_CONTENT_ERROR_NONE;
+ char repl_path[MAX_QUERY_SIZE] = {0, };
media_info_s *_media = (media_info_s*)media;
SAFE_FREE(svc_content_info);
/*Fill out the handle*/
- char *media_file_path = g_strdup(_media->file_path);
+ memset(repl_path, 0, sizeof(repl_path));
+ ret = _media_content_replace_path(_media->file_path, repl_path);
+ char *media_file_path = g_strdup(repl_path);
+
char *media_string_uuid = g_strdup(_media->storage_uuid);
__media_info_destroy(media);
char storage_id[MEDIA_CONTENT_UUID_SIZE+1] = {0, };
media_svc_storage_type_e storage_type = 0;
bool ignore_file = FALSE;
+ char repl_path[MAX_QUERY_SIZE] = {0, };
media_content_retvm_if(!STRING_VALID(path), MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
media_content_retvm_if(media == NULL, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid media");
+ memset(repl_path, 0, sizeof(repl_path));
+ ret = _media_content_replace_path(path, repl_path);
+ media_content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
- ret = _media_util_check_ignore_file(path, &ignore_file);
+ ret = _media_util_check_ignore_file(repl_path, &ignore_file);
media_content_retvm_if(ignore_file == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid path");
memset(storage_id, 0x00, sizeof(storage_id));
- if (STRING_VALID(MEDIA_ROOT_PATH_CLOUD) && (strstr(path, MEDIA_ROOT_PATH_CLOUD) == NULL)) {
+ if (STRING_VALID(MEDIA_ROOT_PATH_CLOUD) && (strstr(repl_path, MEDIA_ROOT_PATH_CLOUD) == NULL)) {
bool ignore_dir = FALSE;
char *folder_path = NULL;
- ret = _media_util_check_file_exist(path);
+ ret = _media_util_check_file_exist(repl_path);
media_content_retv_if(ret != MEDIA_CONTENT_ERROR_NONE, ret);
- folder_path = g_path_get_dirname(path);
+ folder_path = g_path_get_dirname(repl_path);
ret = _media_util_check_ignore_dir(folder_path, &ignore_dir);
SAFE_FREE(folder_path);
media_content_retvm_if(ignore_dir == TRUE, MEDIA_CONTENT_ERROR_INVALID_PARAMETER, "Invalid folder path");
- ret = media_svc_get_storage_id(_content_get_db_handle(), path, storage_id);
+ ret = media_svc_get_storage_id(_content_get_db_handle(), repl_path, storage_id);
if (ret != MS_MEDIA_ERR_NONE) {
media_content_error("media_svc_get_storage_id failed : %d", ret);
return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
}
- ret = media_svc_get_storage_type(path, &storage_type, tzplatform_getuid(TZ_USER_NAME));
+ ret = media_svc_get_storage_type(repl_path, &storage_type, tzplatform_getuid(TZ_USER_NAME));
if (ret != MS_MEDIA_ERR_NONE) {
media_content_sec_error("media_svc_get_storage_type failed : %d", ret);
return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
return MEDIA_CONTENT_ERROR_NONE;
}
+
+#ifdef _USE_SENIOR_MODE
+int media_info_set_contact(media_info_h media, const char *contact)
+{
+ return __media_info_set_str_data(media, MEDIA_INFO_CONTACT, contact);
+}
+
+int media_info_set_app_data(media_info_h media, const char *app_data)
+{
+ return __media_info_set_str_data(media, MEDIA_INFO_APP_DATA, app_data);
+}
+#endif
+