char *datetaken; /**< datetaken*/
int orientation; /**< orientation*/
int rating; /**< user defined rating */
- char *weather; /**< weather of image */
int bitpersample; /**< bitrate*/
- char *category; /**< category*/
- char *keyword; /**< keyword*/
- char *location_tag; /**< location_tag*/
- char *content_name; /**< content_name*/
- char *age_rating; /**< age_rating*/
- char *author; /**< author*/
- char *provider; /**< provider*/
char *file_name_pinyin; /**< pinyin for file_name*/
char *title_pinyin; /**< pinyin for title*/
char *folder_uuid; /**< Unique ID of folder */
int album_id; /**< Unique ID of album */
char *thumbnail_path; /**< Thumbnail image file path */
- int played_count; /**< played count */
- int last_played_time; /**< last played time */
- int last_played_position; /**< last played position */
time_t favourate; /**< time favourate set */
int is_drm; /**< is_drm. o or 1 */
int sync_status; /**< sync_status */
int media_svc_insert_folder(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, const char *path, uid_t uid);
int media_svc_insert_item_begin(int with_noti, int data_cnt, int from_pid);
int media_svc_insert_item_end(uid_t uid);
-int media_svc_insert_item_bulk(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, const char *path, int is_burst, uid_t uid);
+int media_svc_insert_item_bulk(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, const char *path, uid_t uid);
int media_svc_insert_item_immediately(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, const char *path, uid_t uid);
int media_svc_move_item(MediaSvcHandle *handle, const char *src_path, const char *dest_path, uid_t uid);
int media_svc_set_item_validity_begin(int data_cnt);
int media_svc_set_all_storage_items_validity(const char *storage_id, media_svc_storage_type_e storage_type, int validity, uid_t uid);
int media_svc_set_folder_items_validity(MediaSvcHandle *handle, const char *storage_id, const char *folder_path, int validity, int recursive, uid_t uid);
int media_svc_refresh_item(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, const char *path, uid_t uid);
-int media_svc_rename_folder(MediaSvcHandle *handle, const char *storage_id, const char *src_path, const char *dst_path, uid_t uid);
int media_svc_request_update_db(const char *db_query, uid_t uid);
int media_svc_get_storage_type(const char *path, media_svc_storage_type_e *storage_type, uid_t uid);
int media_svc_get_file_info(MediaSvcHandle *handle, const char *storage_id, const char *path, time_t *modified_time, unsigned long long *size);
int media_svc_update_item_begin(int data_cnt);
int media_svc_update_item_end(uid_t uid);
int media_svc_update_item_meta(MediaSvcHandle *handle, const char *file_path, const char *storage_id, int storage_type, uid_t uid);
-int media_svc_insert_item_immediately_with_data(MediaSvcHandle *handle, media_svc_content_info_s *content_info, uid_t uid);
-void media_svc_destroy_content_info(media_svc_content_info_s *content_info);
int media_svc_generate_uuid(char **uuid);
int media_svc_check_storage(MediaSvcHandle *handle, const char *storage_id, char **storage_path, int *validity, uid_t uid);
int media_svc_update_storage(MediaSvcHandle *handle, const char *storage_id, const char *storage_path, uid_t uid);
int media_svc_set_storage_validity(MediaSvcHandle *handle, const char *storage_id, int validity, uid_t uid);
int media_svc_get_storage_id(MediaSvcHandle *handle, const char *path, char *storage_id, uid_t uid);
-int media_svc_get_storage_path(MediaSvcHandle *handle, const char *storage_uuid, char **storage_path);
int media_svc_get_storage_list(MediaSvcHandle *handle, char ***storage_list, char ***storage_id_list, int *count);
int media_svc_delete_invalid_folder(const char *storage_id, int storage_type, uid_t uid);
int media_svc_set_folder_validity(MediaSvcHandle *handle, const char *storage_id, const char *start_path, int validity, bool is_recursive, uid_t uid);
return MEDIA_SVC_PLUGIN_ERROR;
}
- ret = media_svc_insert_item_bulk(handle, storage_id, storage_type, file_path, FALSE, uid);
- if (ret < 0) {
- __set_error_message(ret, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
- return MEDIA_SVC_PLUGIN_ERROR_NONE;
-}
-
-int insert_burst_item(void *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid, char **err_msg)
-{
- int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
-
- if (handle == NULL) {
- __set_error_message(ERR_HANDLE, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
- if (!STRING_VALID(file_path)) {
- __set_error_message(ERR_FILE_PATH, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
- if (!STORAGE_VALID(storage_type)) {
- __set_error_message(ERR_STORAGE_TYPE, err_msg);
- return MEDIA_SVC_PLUGIN_ERROR;
- }
-
- ret = media_svc_insert_item_bulk(handle, storage_id, storage_type, file_path, TRUE, uid);
+ ret = media_svc_insert_item_bulk(handle, storage_id, storage_type, file_path, uid);
if (ret < 0) {
__set_error_message(ret, err_msg);
return MEDIA_SVC_PLUGIN_ERROR;
return MEDIA_SVC_PLUGIN_ERROR_NONE;
}
-int get_extract_list(void* handle, const char* storage_id, int storage_type, int scan_type, const char* path, int burst, uid_t uid, void* array, char** err_msg)
+int get_extract_list(void* handle, const char* storage_id, int storage_type, int scan_type, const char* path, uid_t uid, void* array, char** err_msg)
{
/* For scanner V2 */
return MEDIA_SVC_PLUGIN_ERROR_NONE;
}
-int update_one_extract_item(void* handle, const char* storage_id, int storage_type, void* data, int burst, char** err_msg)
+int update_one_extract_item(void* handle, const char* storage_id, int storage_type, void* data, char** err_msg)
{
/* For scanner V2 */
return MEDIA_SVC_PLUGIN_ERROR_NONE;
return ret;
}
-int _media_svc_get_album_art_by_album_id(sqlite3 *handle, int album_id, char **album_art)
-{
- int ret = MS_MEDIA_ERR_NONE;
- sqlite3_stmt *sql_stmt = NULL;
- char *value = NULL;
-
- char *sql = sqlite3_mprintf("SELECT album_art FROM %s WHERE album_id=%d", MEDIA_SVC_DB_TABLE_ALBUM, album_id);
-
- ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
-
- if (ret != MS_MEDIA_ERR_NONE) {
- if (ret == MS_MEDIA_ERR_DB_NO_RECORD)
- media_svc_debug("there is no album_id.");
- else
- media_svc_error("error when get album_art. err = [%d]", ret);
-
- return ret;
- }
-
- value = (char *)sqlite3_column_text(sql_stmt, 0);
- if (STRING_VALID(value))
- *album_art = g_strdup(value);
- else
- *album_art = NULL;
-
- SQLITE3_FINALIZE(sql_stmt);
-
- return MS_MEDIA_ERR_NONE;
-}
-
int _media_svc_append_album(sqlite3 *handle, const char *album, const char *artist, const char *album_art, int *album_id, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "orientation", MEDIA_SVC_DB_TYPE_INT, "DEFAULT -1", USER_V2, NULL, false, false, true);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "burst_id", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, true);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "played_count", MEDIA_SVC_DB_TYPE_INT, "DEFAULT 0", USER_V2, NULL, false, false, true);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "last_played_time", MEDIA_SVC_DB_TYPE_INT, "DEFAULT 0", USER_V2, NULL, false, false, true);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "last_played_position", MEDIA_SVC_DB_TYPE_INT, "DEFAULT 0", USER_V2, NULL, false, false, true);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "rating", MEDIA_SVC_DB_TYPE_INT, "DEFAULT 0", USER_V2, NULL, false, false, true);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "favourite", MEDIA_SVC_DB_TYPE_INT, "DEFAULT 0", USER_V2, NULL, false, false, true);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "author", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, true);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "provider", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, true);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "content_name", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, true);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "category", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, true);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "location_tag", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, true);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "age_rating", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, true);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "keyword", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, true);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "is_drm", MEDIA_SVC_DB_TYPE_INT, "DEFAULT 0", USER_V2, NULL, false, false, true);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "storage_type", MEDIA_SVC_DB_TYPE_INT, NULL, USER_V2, NULL, false, false, true);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "timeline", MEDIA_SVC_DB_TYPE_INT, "DEFAULT 0", USER_V2, "media_timeline_idx", false, false, true);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "weather", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, true);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "sync_status", MEDIA_SVC_DB_TYPE_INT, "DEFAULT 0", USER_V2, NULL, false, false, true);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "file_name_pinyin", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, false);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "description_pinyin", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, false);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "author_pinyin", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, false);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "provider_pinyin", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, false);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "content_name_pinyin", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, false);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "category_pinyin", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, false);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "location_tag_pinyin", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, false);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "age_rating_pinyin", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, false);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_MEDIA], "keyword_pinyin", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V2, NULL, false, false, false);
/* storage_uuid column is added in DB v4. When doing DB upgrade to v4, if storage_uuid is NOT NULL, alter table failed. */
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_FOLDER], "storage_uuid", MEDIA_SVC_DB_TYPE_TEXT, NULL, USER_V4, NULL, true, false, false);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
- ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_FOLDER], "folder_order", MEDIA_SVC_DB_TYPE_INT, "DEFAULT 0", USER_V4, NULL, false, false, false);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
ret = __media_svc_add_column_info(&column_list[MEDIA_SVC_DB_LIST_FOLDER], "validity", MEDIA_SVC_DB_TYPE_INT, "DEFAULT 1", USER_V4, NULL, false, false, false);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
return MS_MEDIA_ERR_NONE;
}
-int _media_svc_insert_item_with_data(sqlite3 *handle, const char *storage_id, media_svc_content_info_s *content_info, int is_burst, bool stack_query, uid_t uid)
+int _media_svc_insert_item_with_data(sqlite3 *handle, const char *storage_id, media_svc_content_info_s *content_info, bool stack_query, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- char *burst_id = NULL;
const char *db_fields = "media_uuid, path, file_name, media_type, mime_type, size, added_time, modified_time, folder_uuid, thumbnail_path, \
- title, album_id, album, artist, album_artist, genre, composer, year, recorded_date, copyright, track_num, description, category, keyword, location_tag, \
- content_name, age_rating, author, provider, last_played_time, played_count, favourite, bitrate, bitpersample, samplerate, channel, duration, \
- longitude, latitude, altitude, exposure_time, fnumber, iso, model, width, height, datetaken, orientation, rating, is_drm, storage_type, burst_id, timeline, weather, sync_status, \
+ title, album_id, album, artist, album_artist, genre, composer, year, recorded_date, copyright, track_num, description, \
+ favourite, bitrate, bitpersample, samplerate, channel, duration, \
+ longitude, latitude, altitude, exposure_time, fnumber, iso, model, width, height, datetaken, orientation, rating, is_drm, storage_type, timeline, sync_status, \
file_name_pinyin, title_pinyin, album_pinyin, artist_pinyin, album_artist_pinyin, genre_pinyin, composer_pinyin, copyright_pinyin, description_pinyin, storage_uuid, is_360";
const char *db_fields_basic = "media_uuid, path, file_name, media_type, mime_type, size, added_time, modified_time, folder_uuid, thumbnail_path, \
- album_id, last_played_time, played_count, favourite, is_drm, storage_type, burst_id, timeline, sync_status, file_name_pinyin, storage_uuid, is_360";
+ album_id, favourite, is_drm, storage_type, timeline, sync_status, file_name_pinyin, storage_uuid, is_360";
/* This sql is due to sqlite3_mprintf's wrong operation when using floating point in the text format */
/* This code will be removed when sqlite3_mprintf works clearly */
char *test_sql = sqlite3_mprintf("%f, %f, %f", content_info->media_meta.longitude, content_info->media_meta.latitude, content_info->media_meta.altitude);
SQLITE3_SAFE_FREE(test_sql);
- if (is_burst) {
- int burst_id_int = 0;
- ret = _media_svc_get_burst_id(handle, storage_id, &burst_id_int);
- if (ret != MS_MEDIA_ERR_NONE)
- burst_id = NULL;
-
- if (burst_id_int > 0) {
- media_svc_debug("Burst id : %d", burst_id_int);
- burst_id = sqlite3_mprintf("%d", burst_id_int);
- }
-
- /* Get thumbnail for burst shot */
- char thumb_path[MEDIA_SVC_PATHNAME_SIZE + 1] = {0, };
-
- ret = _media_svc_create_thumbnail(content_info->path, thumb_path, sizeof(thumb_path), content_info->media_type, uid);
- if (ret == MS_MEDIA_ERR_NONE)
- content_info->thumbnail_path = g_strdup(thumb_path);
- }
-
/*Update Pinyin If Support Pinyin*/
if (_media_svc_check_pinyin_support()) {
if (STRING_VALID(content_info->file_name))
}
char *sql = sqlite3_mprintf("INSERT INTO '%q' (%q) VALUES (%Q, %Q, %Q, %d, %Q, %lld, %d, %d, %Q, \
- %Q, %Q, %d, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %d, %d, %d, \
+ %Q, %Q, %d, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %d, \
%d, %d, %d, %d, %d, %.6f, %.6f, %.6f, %Q, %.6f, %d, %Q, %d, %d, %Q, %d, \
- %d, %d, %d, %Q, %d, %Q, %d, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %d);",
+ %d, %d, %d, %d, %d, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %d);",
content_info->storage_uuid, db_fields,
content_info->media_uuid,
content_info->path,
content_info->media_meta.copyright,
content_info->media_meta.track_num,
content_info->media_meta.description,
- content_info->media_meta.category,
- content_info->media_meta.keyword,
- content_info->media_meta.location_tag,
- content_info->media_meta.content_name,
- content_info->media_meta.age_rating,
- content_info->media_meta.author,
- content_info->media_meta.provider,
- content_info->last_played_time,
- content_info->played_count,
content_info->favourate, /* 2nd line */
content_info->media_meta.bitrate,
content_info->media_meta.bitpersample,
content_info->media_meta.rating,
content_info->is_drm,
content_info->storage_type,
- burst_id,
content_info->timeline,
- content_info->media_meta.weather,
content_info->sync_status,
content_info->file_name_pinyin,
content_info->media_meta.title_pinyin,
media_svc_debug("Query length is over %d byte.. So, remake query using only basic information..", MEDIA_SVC_QUERY_LEN_MAX - 1);
SQLITE3_SAFE_FREE(sql);
- sql = sqlite3_mprintf("INSERT INTO '%q' (%q) VALUES (%Q, %Q, %Q, %d, %Q, %lld, %d, %d, %Q, %Q, %d, %d, %d, %d, %d, %d, %Q, %d, %d, %Q, %Q, %d);",
+ sql = sqlite3_mprintf("INSERT INTO '%q' (%q) VALUES (%Q, %Q, %Q, %d, %Q, %lld, %d, %d, %Q, %Q, %d, %d, %d, %d, %d, %d, %d, %d, %Q, %Q, %d);",
content_info->storage_uuid, db_fields_basic,
content_info->media_uuid,
content_info->path,
content_info->folder_uuid,
content_info->thumbnail_path,
content_info->album_id,
- content_info->last_played_time,
- content_info->played_count,
content_info->favourate,
content_info->is_drm,
content_info->storage_type,
- burst_id,
content_info->timeline,
content_info->sync_status,
content_info->file_name_pinyin,
);
}
- SQLITE3_SAFE_FREE(burst_id);
-
if (!stack_query) {
ret = _media_svc_sql_query(sql, uid);
SQLITE3_SAFE_FREE(sql);
int _media_svc_update_item_by_path(const char *org_storage_id, const char *src_path, const char *dst_storage_id, media_svc_storage_type_e dest_storage, const char *dest_path, const char *file_name, int modified_time, const char *folder_uuid, uid_t uid)
{
/* update path, filename, modified_time, folder_uuid, thumbnail_path, */
- /* played_count, last_played_time, last_played_position, favourite, storaget_type*/
/* NOTICE (This operation is abnormal. Modifications should be cautious.)
1. Update source to destination info
3. Remove source info
*/
int ret = MS_MEDIA_ERR_NONE;
- char *update = sqlite3_mprintf("UPDATE '%q' SET path=%Q, file_name=%Q, modified_time=%d, folder_uuid=%Q, storage_type=%d, storage_uuid='%q', played_count=0, last_played_time=0, last_played_position=0 WHERE path=%Q;",
+ char *update = sqlite3_mprintf("UPDATE '%q' SET path=%Q, file_name=%Q, modified_time=%d, folder_uuid=%Q, storage_type=%d, storage_uuid='%q' WHERE path=%Q;",
org_storage_id, dest_path, file_name, modified_time, folder_uuid, dest_storage, dst_storage_id, src_path);
char *insert = sqlite3_mprintf("INSERT OR REPLACE INTO '%q' SELECT * FROM '%q' WHERE path = '%q';", dst_storage_id, org_storage_id, dest_path);
char *remove = sqlite3_mprintf("DELETE FROM '%q' WHERE path = '%q';", org_storage_id, dest_path);
return ret;
}
-int _media_svc_get_burst_id(sqlite3 *handle, const char *storage_id, int *id)
-{
- int ret = MS_MEDIA_ERR_NONE;
- int cur_id = -1;
- sqlite3_stmt *sql_stmt = NULL;
- char *sql = sqlite3_mprintf("SELECT max(CAST(burst_id AS INTEGER)) FROM '%q'", storage_id);
-
- ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
-
- if (ret != MS_MEDIA_ERR_NONE) {
- media_svc_error("error when _media_svc_get_burst_id. err = [%d]", ret);
- return ret;
- }
-
- cur_id = sqlite3_column_int(sql_stmt, 0);
- *id = ++cur_id;
- SQLITE3_FINALIZE(sql_stmt);
-
- return MS_MEDIA_ERR_NONE;
-}
-
int _media_svc_get_noti_info(sqlite3 *handle, const char *storage_id, const char *path, int update_item, media_svc_noti_item **item)
{
int ret = MS_MEDIA_ERR_NONE;
return ret;
}
-int _media_svc_get_storage_path(sqlite3 *handle, const char *storage_id, char **storage_path)
-{
- int ret = MS_MEDIA_ERR_NONE;
- sqlite3_stmt *sql_stmt = NULL;
- char *sql = NULL;
-
- media_svc_retvm_if(!STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_id");
-
- sql = sqlite3_mprintf("SELECT storage_path FROM '%q' WHERE (storage_uuid=%Q AND validity=1)", MEDIA_SVC_DB_TABLE_STORAGE, storage_id);
-
- ret = _media_svc_sql_prepare_to_step(handle, sql, &sql_stmt);
-
- if (ret != MS_MEDIA_ERR_NONE) {
- if (ret == MS_MEDIA_ERR_DB_NO_RECORD)
- media_svc_debug("there is no storage.");
- else
- media_svc_error("error when _media_svc_get_storage_type. err = [%d]", ret);
-
- return ret;
- }
-
- *storage_path = g_strdup((char *)sqlite3_column_text(sql_stmt, 0));
-
- SQLITE3_FINALIZE(sql_stmt);
-
- return ret;
-}
-
static int __media_svc_count_all_storage(sqlite3 *handle, int *count)
{
int ret = MS_MEDIA_ERR_NONE;
return title;
}
-int _media_svc_rename_file(const char *old_name, const char *new_name)
-{
- if ((old_name == NULL) || (new_name == NULL)) {
- media_svc_error("invalid file name");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- if (rename(old_name, new_name) < 0) {
- media_svc_stderror(" ");
- return MS_MEDIA_ERR_INTERNAL;
- }
-
- return MS_MEDIA_ERR_NONE;
-}
-
int _media_svc_remove_file(const char *path)
{
int result = -1;
return MS_MEDIA_ERR_NONE;
}
- content_info->played_count = 0;
- content_info->last_played_time = 0;
- content_info->last_played_position = 0;
content_info->favourate = 0;
content_info->media_meta.rating = 0;
SAFE_FREE(content_info->media_meta.datetaken);
SAFE_FREE(content_info->media_meta.exposure_time);
SAFE_FREE(content_info->media_meta.model);
- SAFE_FREE(content_info->media_meta.weather);
- SAFE_FREE(content_info->media_meta.category);
- SAFE_FREE(content_info->media_meta.keyword);
- SAFE_FREE(content_info->media_meta.location_tag);
- SAFE_FREE(content_info->media_meta.content_name);
- SAFE_FREE(content_info->media_meta.age_rating);
- SAFE_FREE(content_info->media_meta.author);
- SAFE_FREE(content_info->media_meta.provider);
SAFE_FREE(content_info->media_meta.title_pinyin);
SAFE_FREE(content_info->media_meta.album_pinyin);
return ret;
}
-int media_svc_insert_item_bulk(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, const char *path, int is_burst, uid_t uid)
+int media_svc_insert_item_bulk(MediaSvcHandle *handle, const char *storage_id, media_svc_storage_type_e storage_type, const char *path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
sqlite3 *db_handle = (sqlite3 *)handle;
if (g_media_svc_insert_item_data_cnt == 1) {
- ret = _media_svc_insert_item_with_data(db_handle, storage_id, &content_info, is_burst, FALSE, uid);
+ ret = _media_svc_insert_item_with_data(db_handle, storage_id, &content_info, FALSE, uid);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
if (g_insert_with_noti)
} else if (g_media_svc_insert_item_cur_data_cnt < (g_media_svc_insert_item_data_cnt - 1)) {
- ret = _media_svc_insert_item_with_data(db_handle, storage_id, &content_info, is_burst, TRUE, uid);
+ ret = _media_svc_insert_item_with_data(db_handle, storage_id, &content_info, TRUE, uid);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
if (g_insert_with_noti)
} else if (g_media_svc_insert_item_cur_data_cnt == (g_media_svc_insert_item_data_cnt - 1)) {
- ret = _media_svc_insert_item_with_data(db_handle, storage_id, &content_info, is_burst, TRUE, uid);
+ ret = _media_svc_insert_item_with_data(db_handle, storage_id, &content_info, TRUE, uid);
media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &content_info);
if (g_insert_with_noti)
}
}
- ret = _media_svc_insert_item_with_data(db_handle, storage_id, &content_info, FALSE, FALSE, uid);
+ ret = _media_svc_insert_item_with_data(db_handle, storage_id, &content_info, FALSE, uid);
if (ret == MS_MEDIA_ERR_NONE) {
media_svc_debug("Insertion is successful. Sending noti for this");
return ret;
}
-int media_svc_rename_folder(MediaSvcHandle *handle, const char *storage_id, const char *src_path, const char *dst_path, uid_t uid)
-{
- int ret = MS_MEDIA_ERR_NONE;
- sqlite3 *db_handle = (sqlite3 *)handle;
- char *name = NULL;
- char *name_pinyin = NULL;
- bool pinyin_support = FALSE;
- char *sql = NULL;
- int media_type = 0;
- GArray *query_array = NULL;
-
- media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
- media_svc_retvm_if(src_path == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "src_path is NULL");
- media_svc_retvm_if(dst_path == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "dst_path is NULL");
-
- media_svc_debug("Src path : %s, Dst Path : %s", src_path, dst_path);
-
- ret = _media_svc_sql_begin_trans(uid);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
-
- /*1. Rename directory */
- /*Update Pinyin If Support Pinyin*/
- name = g_path_get_basename(dst_path);
- media_svc_check_pinyin_support(&pinyin_support);
- if (pinyin_support) {
- media_svc_get_pinyin(name, &name_pinyin);
- sql = sqlite3_mprintf("UPDATE %Q SET path='%q', name='%q', name_pinyin='%q' WHERE path = %Q",
- MEDIA_SVC_DB_TABLE_FOLDER, dst_path, name, name_pinyin, src_path);
- } else {
- sql = sqlite3_mprintf("UPDATE %Q SET path='%q', name='%q' WHERE path = %Q",
- MEDIA_SVC_DB_TABLE_FOLDER, dst_path, name, src_path);
- }
-
- ret = media_db_request_update_db_batch(sql, uid);
- SQLITE3_SAFE_FREE(sql);
- SAFE_FREE(name);
- SAFE_FREE(name_pinyin);
- media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Failed to batch update request");
-
- /* 2. Update sub-dir, sub-file */
- /* Sub folder */
- sql = sqlite3_mprintf("UPDATE folder SET path = REPLACE( path, '%q/', '%q/');", src_path, dst_path);
- ret = media_db_request_update_db_batch(sql, uid);
- SQLITE3_SAFE_FREE(sql);
- media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Failed to batch update request");
-
- /* Sub files */
- sql = sqlite3_mprintf("UPDATE '%q' SET path = REPLACE( path, '%q/', '%q/');", storage_id, src_path, dst_path);
- ret = media_db_request_update_db_batch(sql, uid);
- SQLITE3_SAFE_FREE(sql);
- media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "Failed to batch update request");
-
- ret = _media_svc_sql_end_trans(uid);
- if (ret != MS_MEDIA_ERR_NONE) {
- media_svc_error("mb_svc_sqlite3_commit_trans failed.. Now start to rollback");
- return ret;
- }
-
- /*3. Get and update thumbnail_path if exists */
- sqlite3_stmt *sql_stmt = NULL;
-
- sql = sqlite3_mprintf("SELECT path, thumbnail_path, media_type from '%q' where path LIKE '%q/%%' AND thumbnail_path is not null", storage_id, dst_path);
- media_svc_debug("[SQL query] : %s", sql);
-
- ret = _media_svc_sql_prepare_to_step_simple(db_handle, sql, &sql_stmt);
- media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "error when media_svc_rename_folder. err = [%d]", ret);
-
-
- query_array = g_array_new(FALSE, FALSE, sizeof(char *));
- media_svc_retvm_if(query_array == NULL, MS_MEDIA_ERR_INTERNAL, "g_array_new failed");
-
- while (sqlite3_step(sql_stmt) == SQLITE_ROW) {
- char media_path[MEDIA_SVC_PATHNAME_SIZE + 1] = {0, };
- char media_thumb_path[MEDIA_SVC_PATHNAME_SIZE + 1] = {0, };
- char media_new_thumb_path[MEDIA_SVC_PATHNAME_SIZE + 1] = {0, };
- char *thumb_query = NULL;
-
- if (STRING_VALID((const char *)sqlite3_column_text(sql_stmt, 0))) {
- SAFE_STRLCPY(media_path, (const char *)sqlite3_column_text(sql_stmt, 0), sizeof(media_path));
- } else {
- media_svc_error("media path is NULL");
- SQLITE3_FINALIZE(sql_stmt);
- return MS_MEDIA_ERR_DB_INTERNAL;
- }
-
- if (STRING_VALID((const char *)sqlite3_column_text(sql_stmt, 1))) {
- SAFE_STRLCPY(media_thumb_path, (const char *)sqlite3_column_text(sql_stmt, 1), sizeof(media_thumb_path));
- } else {
- media_svc_error("thumbnail path is NULL");
- SQLITE3_FINALIZE(sql_stmt);
- return MS_MEDIA_ERR_DB_INTERNAL;
- }
-
- media_type = sqlite3_column_int(sql_stmt, 2);
-
- ret = _media_svc_get_thumbnail_path(media_type, media_new_thumb_path, media_path, THUMB_EXT, uid);
- if (ret != MS_MEDIA_ERR_NONE) {
- media_svc_error("_media_svc_get_thumbnail_path failed : %d", ret);
- SQLITE3_FINALIZE(sql_stmt);
- return ret;
- }
-
- thumb_query = sqlite3_mprintf("UPDATE '%q' SET thumbnail_path='%q' WHERE path='%q'", storage_id, media_new_thumb_path, media_path);
- g_array_append_val(query_array, thumb_query);
-
- ret = _media_svc_rename_file(media_thumb_path, media_new_thumb_path);
- if (ret != MS_MEDIA_ERR_NONE)
- media_svc_error("_media_svc_rename_file failed : %d", ret);
- }
-
- SQLITE3_FINALIZE(sql_stmt);
-
- while (query_array->len != 0) {
- sql = g_array_index(query_array , char*, 0);
- g_array_remove_index(query_array, 0);
- ret = media_db_request_update_db(sql, uid);
- SQLITE3_SAFE_FREE(sql);
- if (ret != MS_MEDIA_ERR_NONE)
- media_svc_error("media_db_request_update_db failed : %d", ret);
- }
-
- g_array_free(query_array, FALSE);
- query_array = NULL;
-
- media_svc_debug("Folder update is successful. Sending noti for this");
- /* Get notification info */
- media_svc_noti_item *noti_item = NULL;
- ret = _media_svc_get_noti_info(db_handle, storage_id, dst_path, MS_MEDIA_ITEM_DIRECTORY, ¬i_item);
- media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
-
- _media_svc_publish_noti(MS_MEDIA_ITEM_DIRECTORY, MS_MEDIA_ITEM_UPDATE, src_path, -1, noti_item->media_uuid, NULL);
- _media_svc_destroy_noti_item(noti_item);
-
- return MS_MEDIA_ERR_NONE;
-}
-
int media_svc_request_update_db(const char *db_query, uid_t uid)
{
media_svc_retvm_if(!STRING_VALID(db_query), MS_MEDIA_ERR_INVALID_PARAMETER, "db_query is NULL");
return ret;
}
-int media_svc_get_storage_path(MediaSvcHandle *handle, const char *storage_uuid, char **storage_path)
-{
- int ret = MS_MEDIA_ERR_NONE;
- sqlite3 * db_handle = (sqlite3 *)handle;
-
- media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
- media_svc_retvm_if(storage_uuid == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "storage_uuid is NULL");
-
- ret = _media_svc_get_storage_path(db_handle, storage_uuid, storage_path);
-
- return ret;
-}
-
int media_svc_get_storage_list(MediaSvcHandle *handle, char ***storage_list, char ***storage_id_list, int *count)
{
sqlite3 * db_handle = (sqlite3 *)handle;
return _media_svc_get_all_storage(db_handle, storage_list, storage_id_list, count);
}
-static int __media_svc_copy_para_to_content(media_svc_content_info_s *content_info, media_svc_content_info_s *new_content_info)
-{
- media_svc_retvm_if(content_info == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
- media_svc_retvm_if(new_content_info == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
-
- if (content_info->added_time > 0)
- new_content_info->added_time = content_info->added_time;
- new_content_info->last_played_time = content_info->last_played_time;
- new_content_info->played_count = content_info->played_count;
- new_content_info->favourate = content_info->favourate;
-
- /* Can be NULL if user not to set display_name using media_info_set_displayname().. */
- if (STRING_VALID(content_info->file_name)) {
- /* Already filled in _media_svc_set_media_info() */
- SAFE_FREE(new_content_info->file_name);
- new_content_info->file_name = g_strdup(content_info->file_name);
- }
- new_content_info->media_meta.title = g_strdup(content_info->media_meta.title);
- new_content_info->media_meta.album = g_strdup(content_info->media_meta.album);
- new_content_info->media_meta.artist = g_strdup(content_info->media_meta.artist);
- new_content_info->media_meta.genre = g_strdup(content_info->media_meta.genre);
- new_content_info->media_meta.composer = g_strdup(content_info->media_meta.composer);
- new_content_info->media_meta.year = g_strdup(content_info->media_meta.year);
- new_content_info->media_meta.recorded_date = g_strdup(content_info->media_meta.recorded_date);
- new_content_info->media_meta.copyright = g_strdup(content_info->media_meta.copyright);
- new_content_info->media_meta.track_num = g_strdup(content_info->media_meta.track_num);
- new_content_info->media_meta.description = g_strdup(content_info->media_meta.description);
- new_content_info->media_meta.weather = g_strdup(content_info->media_meta.weather);
- new_content_info->media_meta.category = g_strdup(content_info->media_meta.category);
- new_content_info->media_meta.keyword = g_strdup(content_info->media_meta.keyword);
- new_content_info->media_meta.location_tag = g_strdup(content_info->media_meta.location_tag);
- new_content_info->media_meta.content_name = g_strdup(content_info->media_meta.content_name);
- new_content_info->media_meta.age_rating = g_strdup(content_info->media_meta.age_rating);
- new_content_info->media_meta.author = g_strdup(content_info->media_meta.author);
- new_content_info->media_meta.provider = g_strdup(content_info->media_meta.provider);
-
- if (STRING_VALID(content_info->media_meta.datetaken)) {
- new_content_info->media_meta.datetaken = g_strdup(content_info->media_meta.datetaken);
-
- new_content_info->timeline = __media_svc_get_timeline_from_str(content_info->media_meta.datetaken);
- if (new_content_info->timeline == 0) {
- media_svc_error("Failed to get timeline : %s", new_content_info->media_meta.datetaken);
- new_content_info->timeline = new_content_info->modified_time;
- } else {
- media_svc_debug("Timeline : %ld", new_content_info->timeline);
- }
- }
-
- new_content_info->media_meta.is_360 = content_info->media_meta.is_360;
- /* new_content_info->media_meta.bitrate = content_info->media_meta.bitrate; */
- /* new_content_info->media_meta.samplerate = content_info->media_meta.samplerate; */
- /* new_content_info->media_meta.channel = content_info->media_meta.channel; */
- /* new_content_info->media_meta.orientation = content_info->media_meta.orientation; */
-
- if (content_info->media_meta.longitude != MEDIA_SVC_DEFAULT_GPS_VALUE)
- new_content_info->media_meta.longitude = content_info->media_meta.longitude;
- if (content_info->media_meta.latitude != MEDIA_SVC_DEFAULT_GPS_VALUE)
- new_content_info->media_meta.latitude = content_info->media_meta.latitude;
- if (content_info->media_meta.altitude != MEDIA_SVC_DEFAULT_GPS_VALUE)
- new_content_info->media_meta.altitude = content_info->media_meta.altitude;
-
- new_content_info->media_meta.rating = content_info->media_meta.rating;
-
- return MS_MEDIA_ERR_NONE;
-}
-
-int media_svc_insert_item_immediately_with_data(MediaSvcHandle *handle, media_svc_content_info_s *content_info, uid_t uid)
-{
- int ret = MS_MEDIA_ERR_NONE;
- sqlite3 *db_handle = (sqlite3 *)handle;
- char folder_uuid[MEDIA_SVC_UUID_SIZE + 1] = {0, };
- bool append_album = FALSE;
-
- /* Checking parameters if they are valid */
- media_svc_retvm_if(db_handle == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Handle is NULL");
- media_svc_retvm_if(content_info == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "content_info is NULL");
- media_svc_retvm_if(!STRING_VALID(content_info->path), MS_MEDIA_ERR_INVALID_PARAMETER, "file_path is NULL");
-
- media_svc_debug("storage[%d], path[%s], media_type[%d]", content_info->storage_type, content_info->path, content_info->media_type);
-
- media_svc_content_info_s _new_content_info;
- memset(&_new_content_info, 0, sizeof(media_svc_content_info_s));
-
- media_svc_media_type_e media_type;
-
- ret = _media_svc_set_media_info(&_new_content_info, content_info->storage_uuid, content_info->storage_type, content_info->path, &media_type, FALSE);
- media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "fail _media_svc_set_media_info");
-
- if (media_type == MEDIA_SVC_MEDIA_TYPE_OTHER)
- media_svc_debug("Do nothing[%d]", media_type);
- else if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE)
- ret = _media_svc_extract_image_metadata(db_handle, &_new_content_info);
- else
- ret = _media_svc_extract_media_metadata(db_handle, &_new_content_info, uid);
-
- media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, content_info);
-
- /* Extracting thumbnail */
- if (_new_content_info.thumbnail_path == NULL) {
- if (media_type == MEDIA_SVC_MEDIA_TYPE_IMAGE || media_type == MEDIA_SVC_MEDIA_TYPE_VIDEO) {
- char thumb_path[MEDIA_SVC_PATHNAME_SIZE + 1] = {0, };
-
- ret = _media_svc_create_thumbnail(_new_content_info.path, thumb_path, sizeof(thumb_path), media_type, uid);
- if (ret == MS_MEDIA_ERR_NONE)
- _new_content_info.thumbnail_path = g_strdup(thumb_path);
- }
- }
-
- /* set othere data to the structure, which is passed as parameters */
- __media_svc_copy_para_to_content(content_info, &_new_content_info);
-
- /* Set or Get folder id */
- ret = _media_svc_get_and_append_folder_id_by_path(handle, _new_content_info.storage_uuid, _new_content_info.path, _new_content_info.storage_type, folder_uuid, uid);
- media_svc_retv_del_if(ret != MS_MEDIA_ERR_NONE, ret, &_new_content_info);
-
- _new_content_info.folder_uuid = g_strdup(folder_uuid);
- media_svc_retv_del_if(_new_content_info.folder_uuid == NULL, MS_MEDIA_ERR_INTERNAL, &_new_content_info);
-
- /* register album table data */
-
- int album_id = 0;
- if (_new_content_info.media_type == MEDIA_SVC_MEDIA_TYPE_SOUND || _new_content_info.media_type == MEDIA_SVC_MEDIA_TYPE_MUSIC) {
- ret = _media_svc_get_album_id(handle, _new_content_info.media_meta.album, _new_content_info.media_meta.artist, &album_id);
-
- if (ret != MS_MEDIA_ERR_NONE) {
- if (ret == MS_MEDIA_ERR_DB_NO_RECORD) {
- media_svc_debug("album does not exist. So start to make album art");
- append_album = TRUE;
- } else {
- media_svc_debug("other error");
- append_album = FALSE;
- }
- } else {
- _new_content_info.album_id = album_id;
- append_album = FALSE;
-
- if ((!g_strcmp0(_new_content_info.media_meta.album, MEDIA_SVC_TAG_UNKNOWN)) ||
- (!g_strcmp0(_new_content_info.media_meta.artist, MEDIA_SVC_TAG_UNKNOWN))) {
- media_svc_debug("Unknown album or artist already exists. Extract thumbnail for Unknown.");
- } else {
-
- media_svc_debug("album already exists. don't need to make album art");
- ret = _media_svc_get_album_art_by_album_id(handle, album_id, &_new_content_info.thumbnail_path);
- media_svc_retv_del_if((ret != MS_MEDIA_ERR_NONE) && (ret != MS_MEDIA_ERR_DB_NO_RECORD), ret, &_new_content_info);
- }
- }
- }
-
- if (append_album == TRUE) {
- if ((g_strcmp0(_new_content_info.media_meta.album, MEDIA_SVC_TAG_UNKNOWN)) &&
- (g_strcmp0(_new_content_info.media_meta.artist, MEDIA_SVC_TAG_UNKNOWN)))
- ret = _media_svc_append_album(handle, _new_content_info.media_meta.album, _new_content_info.media_meta.artist, _new_content_info.thumbnail_path, &album_id, uid);
- else
- ret = _media_svc_append_album(handle, _new_content_info.media_meta.album, _new_content_info.media_meta.artist, NULL, &album_id, uid);
-
- _new_content_info.album_id = album_id;
- }
-
- /* Insert to db - calling _media_svc_insert_item_with_data */
- ret = _media_svc_insert_item_with_data(db_handle, _new_content_info.storage_uuid, &_new_content_info, FALSE, FALSE, uid);
-
- if (ret == MS_MEDIA_ERR_NONE)
- media_svc_debug("Insertion is successful.");
-
- if (ret == MS_MEDIA_ERR_DB_CONSTRAINT_FAIL)
- media_svc_error("This item is already inserted. This may be normal operation because other process already did this");
-
- _media_svc_destroy_content_info(&_new_content_info);
-
- /* handling returned value - important */
- return ret;
-}
-
-void media_svc_destroy_content_info(media_svc_content_info_s *content_info)
-{
- _media_svc_destroy_content_info(content_info);
-}
-
int media_svc_generate_uuid(char **uuid)
{
char *gen_uuid = NULL;
#include <sys/types.h>
int _media_svc_get_album_id(sqlite3 *handle, const char *album, const char *artist, int *album_id);
-int _media_svc_get_album_art_by_album_id(sqlite3 *handle, int album_id, char **album_art);
int _media_svc_append_album(sqlite3 *handle, const char *album, const char *artist, const char *album_art, int *album_id, uid_t uid);
#endif /*_MEDIA_SVC_ALBUM_H_*/
#include "media-svc-noti.h"
int _media_svc_count_record_with_path(sqlite3 *handle, const char *storage_id, const char *path, int *count);
-int _media_svc_insert_item_with_data(sqlite3 *handle, const char *storage_id, media_svc_content_info_s *content_info, int is_burst, bool stack_query, uid_t uid);
+int _media_svc_insert_item_with_data(sqlite3 *handle, const char *storage_id, media_svc_content_info_s *content_info, bool stack_query, uid_t uid);
int _media_svc_update_item_with_data(const char *storage_id, media_svc_content_info_s *content_info, uid_t uid);
int _media_svc_get_thumbnail_path_by_path(sqlite3 *handle, const char *path, char *thumbnail_path);
int _media_svc_get_media_type_by_path(sqlite3 *handle, const char *storage_id, const char *path, int *media_type);
-int _media_svc_get_burst_id(sqlite3 *handle, const char *storage_id, int *id);
int _media_svc_delete_item_by_path(const char *storage_id, const char *path, bool stack_query, uid_t uid);
int _media_svc_delete_invalid_items(sqlite3 *handle, const char *storage_id, media_svc_storage_type_e storage_type, uid_t uid);
int _media_svc_update_storage_item_validity(const char *storage_id, media_svc_storage_type_e storage_type, int validity, uid_t uid);
int _media_svc_delete_invalid_storage(sqlite3 *handle, media_svc_storage_type_e storage_type, uid_t uid);
int _media_svc_update_storage_validity(const char *storage_id, int validity, uid_t uid);
int _media_svc_get_storage_uuid(sqlite3 *handle, const char *path, char *storage_id, uid_t uid);
-int _media_svc_get_storage_path(sqlite3 *handle, const char *storage_id, char **storage_path);
int _media_svc_get_all_storage(sqlite3 *handle, char ***storage_list, char ***storage_id_list, int *count);
#endif /*_MEDIA_SVC_STORAGE_H_*/
#define SAFE_STRLCPY(dst, src, n) g_strlcpy(dst, src, n);
char *_media_info_generate_uuid(void);
-int _media_svc_rename_file(const char *old_name, const char *new_name);
int _media_svc_remove_file(const char *path);
int _media_svc_get_thumbnail_path(media_svc_media_type_e media_type, char *thumb_path, const char *pathname, const char *img_format, uid_t uid);
int _media_svc_get_file_time(const char *full_path);
media_svc_debug("media_svc_insert_item_immediately success");
- /* 2. media_svc_refresh_item */
- ret = media_svc_refresh_item(g_db_handle, storage_type, path);
- if (ret != MS_MEDIA_ERR_NONE) {
- media_svc_error("media_svc_refresh_item failed : %d", ret);
- return FALSE;
- }
- media_svc_debug("media_svc_refresh_item success");
-
/* 2. media_svc_move_item */
const char *dst_path = tzplatform_mkpath(TZ_USER_CONTENT, "test/image11.jpg");
ret = media_svc_move_item(g_db_handle, path, dst_path);
}
media_svc_debug("media_svc_delete_item_by_path success");
- /* Rename folder */
- const char *src_folder_path = tzplatform_mkpath(TZ_USER_CONTENT, "test");
- const char *dst_folder_path = tzplatform_mkpath(TZ_USER_CONTENT, "test_test");
- ret = media_svc_rename_folder(g_db_handle, src_folder_path, dst_folder_path);
- if (ret != MS_MEDIA_ERR_NONE) {
- media_svc_error("media_svc_rename_folder failed : %d", ret);
- return FALSE;
- }
- media_svc_debug("media_svc_rename_folder success");
-
- /* Rename folder again */
- ret = media_svc_rename_folder(g_db_handle, dst_folder_path, src_folder_path);
- if (ret != MS_MEDIA_ERR_NONE) {
- media_svc_error("media_svc_rename_folder failed : %d", ret);
- return FALSE;
- }
- media_svc_debug("media_svc_rename_folder success");
-
return FALSE;
}