Remove folder_modified_time field 11/310211/2 accepted/tizen_unified_toolchain accepted/tizen/unified/20240425.114254 accepted/tizen/unified/toolchain/20240427.045647 accepted/tizen/unified/x/20240426.050426
authorMinje Ahn <minje.ahn@samsung.com>
Wed, 24 Apr 2024 06:11:25 +0000 (15:11 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Wed, 24 Apr 2024 06:14:23 +0000 (15:14 +0900)
'folder_modified_time' in folder table is no longer used.
Deleted the relevant code.

Change-Id: I9c423296619e8cf6dcd5807faf7dc30fc490df5e
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
include/media-svc-media-folder.h
include/media-svc-util.h
packaging/libmedia-service.spec
src/media-svc-db-utils.c
src/media-svc-media-folder.c
src/media-svc-util.c
src/media-svc.c

index ff7f388..d1fe2de 100755 (executable)
@@ -23,7 +23,6 @@
 #include <sqlite3.h>
 #include <stdbool.h>
 
-int _media_svc_update_folder_modified_time(const char *folder_path, uid_t uid);
 int _media_svc_get_and_append_folder_id_by_path(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, long long int *folder_id, uid_t uid);
 int _media_svc_append_by_folder_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
 int _media_svc_set_folder_validity(bool is_direct, const char *start_path, int validity, bool is_recursive, uid_t uid);
index a907e9f..a3cc970 100755 (executable)
@@ -65,8 +65,8 @@ typedef struct {
        char *mime_type;                /**< Full path and file name of media file */
        unsigned long long size;        /**< size */
        time_t modified_time;           /**< modified time, time_t */
-       long long int folder_id;        /**< Unique ID of folder */
-       int album_id;                   /**< Unique ID of album */
+       long long int folder_id;        /**< Folder ID */
+       int album_id;                   /**< Album ID */
        char *thumbnail_path;   /**< Thumbnail image file path */
        char *storage_uuid;             /**< Unique ID of storage */
        media_svc_content_meta_s media_meta;    /**< meta data structure */
index 6376483..95598f6 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmedia-service
 Summary:    Media information service library for multimedia applications
-Version:    0.6.2
+Version:    0.6.3
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index ac1fb12..51153b3 100755 (executable)
@@ -406,7 +406,6 @@ int _media_svc_init_table_query(void)
        __add_column_info(&column_list[DB_LIST_FOLDER], "folder_id", DB_TYPE_INT, "PRIMARY KEY AUTOINCREMENT", false, false, false);
        __add_column_info(&column_list[DB_LIST_FOLDER], "folder_path", DB_TYPE_TEXT, "NOT NULL", true, false, false);
        __add_column_info(&column_list[DB_LIST_FOLDER], "folder_name", DB_TYPE_TEXT, "NOT NULL", false, false, false);
-       __add_column_info(&column_list[DB_LIST_FOLDER], "folder_modified_time", DB_TYPE_INT, "DEFAULT 0", false, false, false);
        __add_column_info(&column_list[DB_LIST_FOLDER], "storage_uuid", DB_TYPE_TEXT, NULL, true, false, false);
        __add_column_info(&column_list[DB_LIST_FOLDER], "validity", DB_TYPE_INT, "DEFAULT 1", false, false, false);
 
index 3da2c48..6d6513c 100755 (executable)
@@ -34,7 +34,7 @@ static int __media_svc_get_folder_id(sqlite3 *handle, const char *path, long lon
 
        ret = _media_svc_get_result_with_check_record(handle, sql, &sql_stmt);
        SQLITE3_SAFE_FREE(sql);
-       media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "_media_svc_get_result_with_check_record failed [%d]", ret);
+       media_svc_retvm_if(ret != MS_MEDIA_ERR_NONE, ret, "failed to get folder id[%d]", ret);
 
        *folder_id = sqlite3_column_int64(sql_stmt, 0);
 
@@ -47,14 +47,12 @@ static int __media_svc_append_folder(bool is_direct, const char *storage_id, con
 {
        int ret = MS_MEDIA_ERR_NONE;
        char *folder_name = NULL;
-       int folder_modified_date = 0;
 
        folder_name = g_path_get_basename(folder_path);
-       folder_modified_date = _media_svc_get_file_time(folder_path);
 
        /* Sometime SQLITE3 returns NO_RECORD, so need to consider conflict case.. */
-       char *sql = sqlite3_mprintf("INSERT OR IGNORE INTO %q(folder_path, folder_name, storage_uuid, folder_modified_time) VALUES (%Q, %Q, %Q, %d);",
-                               DB_TABLE_FOLDER, folder_path, folder_name, storage_id, folder_modified_date);
+       char *sql = sqlite3_mprintf("INSERT OR IGNORE INTO %q(folder_path, folder_name, storage_uuid) VALUES (%Q, %Q, %Q);",
+                               DB_TABLE_FOLDER, folder_path, folder_name, storage_id);
 
        if (is_direct)
                ret = _media_svc_sql_query_direct(sql, uid);
@@ -68,21 +66,6 @@ static int __media_svc_append_folder(bool is_direct, const char *storage_id, con
        return ret;
 }
 
-int _media_svc_update_folder_modified_time(const char *folder_path, uid_t uid)
-{
-       int ret = MS_MEDIA_ERR_NONE;
-       int time = 0;
-       char *query = NULL;
-
-       time = _media_svc_get_file_time(folder_path);
-       query = sqlite3_mprintf("UPDATE %q SET folder_modified_time=%d WHERE folder_path=%Q", DB_TABLE_FOLDER, time, folder_path);
-
-       ret = _media_svc_sql_query(query, uid);
-       SQLITE3_SAFE_FREE(query);
-
-       return ret;
-}
-
 static int __media_svc_append_parent_folder(sqlite3 *handle, bool is_direct, const char *storage_id, const char *path, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
index 60dc92c..cc71a7e 100644 (file)
@@ -128,44 +128,6 @@ RETRY_GEN:
        return g_strdup(uuid_unparsed);
 }
 
-static char * __media_svc_get_exif_datetaken(ExifData *ed)
-{
-       ExifEntry *entry;
-       char tmp[MEDIA_SVC_METADATA_LEN_MAX + 1] = { 0, };
-
-       media_svc_retv_if(!ed, NULL);
-
-       entry = exif_data_get_entry(ed, EXIF_TAG_DATE_TIME_ORIGINAL);
-       if (entry) {
-               exif_entry_get_value(entry, tmp, MEDIA_SVC_METADATA_LEN_MAX);
-               if (strlen(tmp) > 0)
-                       return g_strdup(tmp);
-       }
-
-       entry = exif_data_get_entry(ed, EXIF_TAG_DATE_TIME);
-       if (entry) {
-               exif_entry_get_value(entry, tmp, MEDIA_SVC_METADATA_LEN_MAX);
-               if (strlen(tmp) > 0)
-                       return g_strdup(tmp);
-       }
-
-       return NULL;
-}
-
-static bool __media_svc_get_exif_short(ExifData *ed, ExifTag tagtype, unsigned short *value)
-{
-       ExifEntry *entry;
-
-       media_svc_retv_if(!ed, false);
-       media_svc_retvm_if(!value, false, "value is NULL");
-
-       entry = exif_data_get_entry(ed, tagtype);
-       media_svc_retv_if(!entry, false);
-       *value = exif_get_short(entry->data, exif_data_get_byte_order(ed));
-
-       return true;
-}
-
 static int __media_svc_get_media_type(const char *path, const char *mime_type, media_svc_media_type_e *media_type)
 {
        int idx = 0;
@@ -451,6 +413,44 @@ char * _media_svc_get_title_from_filename(const char *filename)
        return __media_svc_get_title_from_filename(filename);
 }
 
+static char * __media_svc_get_exif_datetaken(ExifData *ed)
+{
+       ExifEntry *entry;
+       char tmp[MEDIA_SVC_METADATA_LEN_MAX + 1] = { 0, };
+
+       media_svc_retv_if(!ed, NULL);
+
+       entry = exif_data_get_entry(ed, EXIF_TAG_DATE_TIME_ORIGINAL);
+       if (entry) {
+               exif_entry_get_value(entry, tmp, MEDIA_SVC_METADATA_LEN_MAX);
+               if (strlen(tmp) > 0)
+                       return g_strdup(tmp);
+       }
+
+       entry = exif_data_get_entry(ed, EXIF_TAG_DATE_TIME);
+       if (entry) {
+               exif_entry_get_value(entry, tmp, MEDIA_SVC_METADATA_LEN_MAX);
+               if (strlen(tmp) > 0)
+                       return g_strdup(tmp);
+       }
+
+       return NULL;
+}
+
+static bool __media_svc_get_exif_short(ExifData *ed, ExifTag tagtype, unsigned short *value)
+{
+       ExifEntry *entry;
+
+       media_svc_retv_if(!ed, false);
+       media_svc_retvm_if(!value, false, "value is NULL");
+
+       entry = exif_data_get_entry(ed, tagtype);
+       media_svc_retv_if(!entry, false);
+       *value = exif_get_short(entry->data, exif_data_get_byte_order(ed));
+
+       return true;
+}
+
 int _media_svc_extract_image_metadata(media_svc_content_info_s *content_info)
 {
        unsigned short orient_value = 0;
index 61eb839..00c1916 100755 (executable)
@@ -328,7 +328,6 @@ int media_svc_move_item(sqlite3 *handle,
 {
        int ret = MS_MEDIA_ERR_NONE;
        char *file_name = NULL;
-       char *folder_path = NULL;
        int modified_time = 0;
        long long int folder_id = 0;
        char old_thumb_path[MEDIA_SVC_PATHNAME_SIZE] = {0, };
@@ -374,12 +373,6 @@ int media_svc_move_item(sqlite3 *handle,
        media_svc_debug("Move is successful. Sending noti for this");
        _media_svc_publish_noti(MS_MEDIA_ITEM_UPDATE, src_path, media_type, media_id, mime_type);
 
-       /*update folder modified_time*/
-       folder_path = g_path_get_dirname(dest_path);
-       ret = _media_svc_update_folder_modified_time(folder_path, uid);
-       g_free(folder_path);
-       media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
-
        return MS_MEDIA_ERR_NONE;
 }