check folder id between media and folder table,if not same, rescan the file 60/216860/1 accepted/tizen/5.5/unified/20191105.020101 submit/tizen_5.5/20191104.082313
authorchengyj1985 <yujie.cheng@samsung.com>
Wed, 23 Oct 2019 09:10:39 +0000 (17:10 +0800)
committerJiyong Min <jiyong.min@samsung.com>
Mon, 4 Nov 2019 07:15:23 +0000 (07:15 +0000)
Change-Id: I975b480a27108710c0f99d7375745f7a2681fff8
(cherry picked from commit 4c2cabf9a3c449caa5510d83ecbdc3fbd3f433c8)

src/common/media-common-db-svc.c

index b6a50c8..ae93649 100644 (file)
@@ -197,11 +197,13 @@ int __ms_check_item_exist(sqlite3 *handle, const char *storage_id, const char *p
        sqlite3_stmt *sql_stmt = NULL;
        char *sql = NULL;
 
+       *modified = true;
+
        MS_DBG_RETVM_IF(!MS_STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
        MS_DBG_RETVM_IF(!MS_STRING_VALID(path), MS_MEDIA_ERR_INVALID_PARAMETER, "path is NULL");
 
 #ifdef _USE_TVPD_MODE
-       sql = sqlite3_mprintf("SELECT media_modified_time, media_size, media_type, media_timeline FROM '%q' WHERE media_path='%q'", storage_id, path);
+       sql = sqlite3_mprintf("SELECT media_modified_time, media_size, media_type, media_timeline,folder_id FROM '%q' WHERE media_path='%q'", storage_id, path);
 #else
        sql = sqlite3_mprintf("SELECT media_modified_time, media_size FROM '%q' WHERE media_path='%q'", storage_id, path);
 #endif
@@ -227,8 +229,25 @@ int __ms_check_item_exist(sqlite3 *handle, const char *storage_id, const char *p
                if (stat(path, &st) == 0) {
                        if ((st.st_mtime != modified_time) || (st.st_size != file_size))
                                *modified = true;
-                       else
+                       else {
                                *modified = false;
+#ifdef _USE_TVPD_MODE
+                               char* folder_id_media = NULL;
+                               char* folder_id_folder = NULL;
+
+                               folder_id_media = (char *)sqlite3_column_text(sql_stmt, 4);
+                               ret = ms_get_folder_id(handle, storage_id, path, &folder_id_folder);
+                               if(ret == MS_MEDIA_ERR_NONE) {
+                                       if (g_strcmp0(folder_id_media, folder_id_folder) == 0)
+                                               *modified = false;
+                                       else
+                                               *modified = true;
+                               } else
+                                       *modified = true;
+
+                               MS_SAFE_FREE(folder_id_folder);
+#endif
+                       }
                }
        }