static void *func_handle = NULL;
static int scan_other_type = -1;
-typedef int (*CLEANUP_DB)(sqlite3*, uid_t);
typedef int (*INSERT_ITEM_BEGIN)(bool, int);
typedef int (*INSERT_ITEM_END)(uid_t);
typedef int (*SEND_DIR_UPDATE_NOTI)(const char *, const char *, int, int);
typedef int (*INSERT_ITEM)(sqlite3 *, const char *, const char *, int, uid_t);
typedef int (*SET_ITEM_VALIDITY)(const char *, const char *, int, int, uid_t);
-typedef int (*DELETE_ALL_INVALID_ITEMS_IN_FOLDER)(sqlite3 *, const char *, const char *, bool, uid_t);
-typedef int (*UPDATE_FOLDER_TIME)(sqlite3 *, const char *, const char *, uid_t);
typedef int (*GET_STORAGE_ID)(sqlite3 *, const char *, char *, uid_t uid);
-typedef int (*SET_STORAGE_SCAN_STATUS)(sqlite3 *, const char *, int, uid_t);
typedef int (*INSERT_FOLDER)(sqlite3 *, const char *, const char *, int, uid_t);
typedef int (*SET_FOLDER_VALIDITY)(sqlite3 *, const char *, const char *, int, bool, uid_t);
-typedef int (*INSERT_ITEM_SCAN)(sqlite3 *, const char *, const char *, int, uid_t);
-typedef int (*GET_FOLDER_SCAN_STATUS)(sqlite3 *, const char *, const char *, int *);
-typedef int (*SET_FOLDER_SCAN_STATUS)(sqlite3 *, const char *, const char *, int, uid_t);
-typedef int (*CHECK_FOLDER_MODIFIED)(sqlite3 *, const char *, const char *, bool *);
-typedef int (*GET_NULL_SCAN_FOLDER_LIST)(sqlite3 *, const char *, const char *, GPtrArray **);
-typedef int (*CHANGE_VALIDITY_ITEM_BATCH)(sqlite3 *, const char *, const char *, int, int, uid_t);
typedef int (*CHECK_DB)(sqlite3*, uid_t);
-typedef int (*GET_UUID)(char **);
typedef int (*CHECK_STORAGE)(sqlite3 *, const char *, char **, int *, uid_t);
typedef int (*INSERT_STORAGE)(sqlite3 *, const char *, int, const char *, uid_t);
typedef int (*UPDATE_STORAGE)(sqlite3 *, const char *, const char *, uid_t);
typedef int (*SET_STORAGE_VALIDITY)(sqlite3 *, const char *, int, uid_t uid);
typedef int (*SET_ALL_STORAGE_VALIDITY)(sqlite3 *, int, uid_t);
-
-typedef int (*DELETE_INVALID_FOLDER_BY_PATH)(sqlite3 *, const char *, const char *, uid_t);
typedef int (*CHECK_FOLDER_EXIST)(sqlite3*, const char*, const char*);
-typedef int (*GET_EXTRACT_LIST)(sqlite3*, const char*, int, const char*, int, void*);
-typedef int (*UPDATE_ONE_EXTRACT_ITEM)(sqlite3*, const char*, int, void *);
typedef int (*GET_MEDIA_TYPE)(const char *, int *);
typedef int (*REFRESH_ITEM)(sqlite3 *, const char *, const char *, uid_t);
+#ifdef _USE_TVPD_MODE
+typedef int (*CLEANUP_DB)(sqlite3*, uid_t);
+typedef int (*UPDATE_FOLDER_TIME)(sqlite3 *, const char *, const char *, uid_t);
+typedef int (*GET_UUID)(char **);
+typedef int (*SET_STORAGE_SCAN_STATUS)(sqlite3 *, const char *, int, uid_t);
+typedef int (*INSERT_ITEM_SCAN)(sqlite3 *, const char *, const char *, int, uid_t);
+typedef int (*GET_EXTRACT_LIST)(sqlite3*, const char*, int, const char*, int, void*);
+typedef int (*UPDATE_ONE_EXTRACT_ITEM)(sqlite3*, const char*, int, void *);
+typedef int (*DELETE_ALL_INVALID_ITEMS_IN_FOLDER)(sqlite3 *, const char *, const char *, bool, uid_t);
+typedef int (*DELETE_INVALID_FOLDER_BY_PATH)(sqlite3 *, const char *, const char *, uid_t);
+typedef int (*GET_FOLDER_SCAN_STATUS)(sqlite3 *, const char *, const char *, int *);
+typedef int (*SET_FOLDER_SCAN_STATUS)(sqlite3 *, const char *, const char *, int, uid_t);
+typedef int (*CHECK_FOLDER_MODIFIED)(sqlite3 *, const char *, const char *, bool *);
+typedef int (*GET_NULL_SCAN_FOLDER_LIST)(sqlite3 *, const char *, const char *, GPtrArray **);
+typedef int (*CHANGE_VALIDITY_ITEM_BATCH)(sqlite3 *, const char *, const char *, int, int, uid_t);
+#endif
+
enum func_list {
- eCLEANUP_DB,
eINSERT_BEGIN,
eINSERT_END,
eINSERT_BATCH,
- eINSERT_SCAN,
eSET_VALIDITY,
- eDELETE_FOLDER,
eSEND_DIR_UPDATE_NOTI,
- eUPDATE_FOLDER_TIME,
eGET_STORAGE_ID,
- eSET_STORAGE_SCAN_STATUS,
eINSERT_FOLDER,
eSET_FOLDER_VALIDITY,
- eGET_FOLDER_SCAN_STATUS,
- eSET_FOLDER_SCAN_STATUS,
- eCHECK_FOLDER_MODIFIED,
- eGET_NULL_SCAN_FOLDER_LIST,
- eCHANGE_VALIDITY_ITEM_BATCH,
eCHECK_DB,
- eGET_UUID,
eCHECK_STORAGE,
eINSERT_STORAGE,
eUPDATE_STORAGE,
eSET_STORAGE_VALIDITY,
eSET_ALL_STORAGE_VALIDITY,
- eDELETE_INVALID_FOLDER_BY_PATH,
eCHECK_FOLDER_EXIST,
eGET_MEDIA_TYPE,
+ eREFRESH_ITEM,
+#ifdef _USE_TVPD_MODE
+ eCLEANUP_DB,
+ eUPDATE_FOLDER_TIME,
+ eGET_UUID,
+ eSET_STORAGE_SCAN_STATUS,
+ eINSERT_SCAN,
eGET_EXTRACT_LIST,
eUPDATE_ONE_EXTRACT_ITEM,
- eREFRESH_ITEM,
+ eDELETE_FOLDER,
+ eDELETE_INVALID_FOLDER_BY_PATH,
+ eGET_FOLDER_SCAN_STATUS,
+ eSET_FOLDER_SCAN_STATUS,
+ eCHECK_FOLDER_MODIFIED,
+ eGET_NULL_SCAN_FOLDER_LIST,
+ eCHANGE_VALIDITY_ITEM_BATCH,
+#endif
eFUNC_MAX
};
{
int func_index;
char func_list[eFUNC_MAX][40] = {
- "cleanup_db",
"insert_item_begin",
"insert_item_end",
"insert_item",
- "insert_item_scan",
"set_item_validity",
- "delete_all_invalid_items_in_folder",
"send_dir_update_noti",
- "update_folder_time",
"get_storage_id",
- "set_storage_scan_status",
"insert_folder",
"set_folder_validity",
- "get_folder_scan_status",
- "set_folder_scan_status",
- "check_folder_modified",
- "get_null_scan_folder_list",
- "change_validity_item_batch",
"check_db",
- "get_uuid",
"check_storage",
"insert_storage",
"update_storage",
"set_storage_validity",
"set_all_storage_validity",
- "delete_invalid_folder_by_path",
"check_folder_exist",
"get_media_type",
+ "refresh_item",
+#ifdef _USE_TVPD_MODE
+ "cleanup_db",
+ "update_folder_time",
+ "get_uuid",
+ "set_storage_scan_status",
+ "insert_item_scan",
"get_extract_list",
"update_one_extract_item",
- "refresh_item",
+ "delete_all_invalid_items_in_folder",
+ "delete_invalid_folder_by_path",
+ "get_folder_scan_status",
+ "set_folder_scan_status",
+ "check_folder_modified",
+ "get_null_scan_folder_list",
+ "change_validity_item_batch",
+#endif
};
func_handle = dlopen(CONFIG_PATH, RTLD_LAZY);
media_db_disconnect(handle);
}
-int ms_cleanup_db(sqlite3 *handle, uid_t uid)
-{
- int ret = MS_MEDIA_ERR_NONE;
-
- ret = ((CLEANUP_DB)func_array[eCLEANUP_DB])(handle, uid);
- MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "CLEANUP_DB failed [%d]", ret);
-
- MS_DBG_INFO("Cleanup Media DB");
-
- return ret;
-}
-
static int __ms_check_item_exist(sqlite3 *handle, const char *storage_id, const char *path, bool *modified)
{
int ret = MS_MEDIA_ERR_NONE;
return ret;
}
-int ms_scan_item_batch(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
-{
- int ret = MS_MEDIA_ERR_NONE;
- ms_user_storage_type_e storage_type;
-
- MS_DBG_FENTER();
-
- ret = ms_user_get_storage_type(uid, path, &storage_type);
- MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "Fail to get storage type");
-
- ret = ((INSERT_ITEM_SCAN)func_array[eINSERT_SCAN])(handle, storage_id, path, storage_type, uid);
- MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "INSERT_ITEM_SCAN failed [%d]", ret);
-
- return ret;
-}
-
-int ms_get_extract_list(sqlite3 *handle, const char* storage_id, int scan_type, const char* path, int is_end, void *array)
-{
- int ret = MS_MEDIA_ERR_NONE;
-
- ret = ((GET_EXTRACT_LIST)func_array[eGET_EXTRACT_LIST])(handle, storage_id, scan_type, path, is_end, array);
- MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "GET_EXTRACT_LIST failed [%d]", ret);
-
- return ret;
-}
-
-int ms_update_one_extract_item(sqlite3 *handle, const char* storage_id, int storage_type, void *data)
-{
- int ret = MS_MEDIA_ERR_NONE;
-
- ret = ((UPDATE_ONE_EXTRACT_ITEM)func_array[eUPDATE_ONE_EXTRACT_ITEM])(handle, storage_id, storage_type, data);
- MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "UPDATE_ONE_EXTRACT_ITEM failed [%d]", ret);
-
- return ret;
-}
-
int ms_delete_invalid_items(sqlite3 *handle, const char *storage_id, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
return ret;
}
-int ms_delete_invalid_items_in_folder(sqlite3 *handle, const char *storage_id, const char *path, bool is_recursive, uid_t uid)
-{
- int ret = MS_MEDIA_ERR_NONE;
-
- ret = ((DELETE_ALL_INVALID_ITEMS_IN_FOLDER)func_array[eDELETE_FOLDER])(handle, storage_id, path, is_recursive, uid);
- MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "DELETE_ALL_INVALID_ITEMS_IN_FOLDER failed [%d]", ret);
-
- return ret;
-}
-
int ms_send_dir_update_noti(const char*path, const char*folder_id, ms_noti_type_e noti_type, int pid)
{
int ret = MS_MEDIA_ERR_NONE;
return ret;
}
-int ms_update_folder_time(sqlite3 *handle, const char *storage_id, char *folder_path, uid_t uid)
-{
- int ret = MS_MEDIA_ERR_NONE;
-
- ret = ((UPDATE_FOLDER_TIME)func_array[eUPDATE_FOLDER_TIME])(handle, storage_id, folder_path, uid);
- MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "UPDATE_FOLDER_TIME failed [%d]", ret);
-
- return ret;
-}
-
int ms_get_storage_id(sqlite3 *handle, const char *path, char *storage_id, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
return ret;
}
-int ms_set_storage_scan_status(sqlite3 *handle, char *storage_id, media_scan_status_e scan_status, uid_t uid)
-{
- int ret = MS_MEDIA_ERR_NONE;
- int status = scan_status;
-
- MS_DBG_FENTER();
-
- ret = ((SET_STORAGE_SCAN_STATUS)func_array[eSET_STORAGE_SCAN_STATUS])(handle, storage_id, status, uid);
- MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "SET_STORAGE_SCAN_STATUS failed [%d]", ret);
-
- MS_DBG("storage_id [%s], scan_status [%d]", storage_id, scan_status);
-
- return ret;
-}
-
int ms_insert_folder(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
return ret;
}
-int ms_genarate_uuid(char **uuid)
-{
- int ret = MS_MEDIA_ERR_NONE;
-
- ret = ((GET_UUID)func_array[eGET_UUID])(uuid);
- MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "GET_UUID failed [%d]", ret);
-
- return ret;
-}
-
int ms_check_storage(sqlite3 *handle, const char *storage_id, char **storage_path, int *validity, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
return ret;
}
-int ms_delete_invalid_folder_by_path(sqlite3 *handle, const char *storage_id, const char *folder_path, uid_t uid)
-{
- int ret = MS_MEDIA_ERR_NONE;
-
- ret = ((DELETE_INVALID_FOLDER_BY_PATH)func_array[eDELETE_INVALID_FOLDER_BY_PATH])(handle, storage_id, folder_path, uid);
- MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "DELETE_INVALID_FOLDER_BY_PATH failed [%d]", ret);
-
- return ret;
-}
-
int ms_check_folder_exist(sqlite3 *handle, const char *storage_id, const char *folder_path)
{
int ret = MS_MEDIA_ERR_NONE;
MS_DBG_ERR("INSERT_ITEM_END failed [%d]", ret);
}
+int ms_get_media_type(const char *path, int *media_type)
+{
+ int ret = MS_MEDIA_ERR_NONE;
+
+ ret = ((GET_MEDIA_TYPE)func_array[eGET_MEDIA_TYPE])(path, media_type);
+ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "GET_MEDIA_TYPE failed [%d]", ret);
+
+ return ret;
+}
+
+bool ms_check_support_media_type(const char *path)
+{
+ int ret = SYSTEM_INFO_ERROR_NONE;
+ int media_type = -1;
+ bool is_supported = false;
+
+ MS_DBG_RETVM_IF(!MS_STRING_VALID(path), false, "path is empty");
+
+ if (scan_other_type == -1) {
+ ret = system_info_get_platform_bool("http://tizen.org/feature/content.scanning.others", &is_supported);
+ if (ret != SYSTEM_INFO_ERROR_NONE) {
+ MS_DBG_ERR("SYSTEM_INFO_ERROR: content.scanning.others [%d]", ret);
+ return false;
+ }
+
+ scan_other_type = is_supported;
+ }
+
+ if (!scan_other_type) {
+ ret = ms_get_media_type(path, &media_type);
+ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, false, "Failed to get media type");
+
+ if (media_type == MS_MEDIA_TYPE_OTHER)
+ return false;
+ }
+
+ return true;
+}
+
+#ifdef _USE_TVPD_MODE
+int ms_cleanup_db(sqlite3 *handle, uid_t uid)
+{
+ int ret = MS_MEDIA_ERR_NONE;
+
+ ret = ((CLEANUP_DB)func_array[eCLEANUP_DB])(handle, uid);
+ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "CLEANUP_DB failed [%d]", ret);
+
+ MS_DBG_INFO("Cleanup Media DB");
+
+ return ret;
+}
+
+int ms_update_folder_time(sqlite3 *handle, const char *storage_id, char *folder_path, uid_t uid)
+{
+ int ret = MS_MEDIA_ERR_NONE;
+
+ ret = ((UPDATE_FOLDER_TIME)func_array[eUPDATE_FOLDER_TIME])(handle, storage_id, folder_path, uid);
+ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "UPDATE_FOLDER_TIME failed [%d]", ret);
+
+ return ret;
+}
+
+int ms_set_storage_scan_status(sqlite3 *handle, char *storage_id, media_scan_status_e scan_status, uid_t uid)
+{
+ int ret = MS_MEDIA_ERR_NONE;
+ int status = scan_status;
+
+ MS_DBG_FENTER();
+
+ ret = ((SET_STORAGE_SCAN_STATUS)func_array[eSET_STORAGE_SCAN_STATUS])(handle, storage_id, status, uid);
+ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "SET_STORAGE_SCAN_STATUS failed [%d]", ret);
+
+ MS_DBG("storage_id [%s], scan_status [%d]", storage_id, scan_status);
+
+ return ret;
+}
+
+int ms_genarate_uuid(char **uuid)
+{
+ int ret = MS_MEDIA_ERR_NONE;
+
+ ret = ((GET_UUID)func_array[eGET_UUID])(uuid);
+ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "GET_UUID failed [%d]", ret);
+
+ return ret;
+}
+
+int ms_scan_item_batch(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
+{
+ int ret = MS_MEDIA_ERR_NONE;
+ ms_user_storage_type_e storage_type;
+
+ MS_DBG_FENTER();
+
+ ret = ms_user_get_storage_type(uid, path, &storage_type);
+ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "Fail to get storage type");
+
+ ret = ((INSERT_ITEM_SCAN)func_array[eINSERT_SCAN])(handle, storage_id, path, storage_type, uid);
+ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "INSERT_ITEM_SCAN failed [%d]", ret);
+
+ return ret;
+}
+
+int ms_get_extract_list(sqlite3 *handle, const char* storage_id, int scan_type, const char* path, int is_end, void *array)
+{
+ int ret = MS_MEDIA_ERR_NONE;
+
+ ret = ((GET_EXTRACT_LIST)func_array[eGET_EXTRACT_LIST])(handle, storage_id, scan_type, path, is_end, array);
+ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "GET_EXTRACT_LIST failed [%d]", ret);
+
+ return ret;
+}
+
+int ms_update_one_extract_item(sqlite3 *handle, const char* storage_id, int storage_type, void *data)
+{
+ int ret = MS_MEDIA_ERR_NONE;
+
+ ret = ((UPDATE_ONE_EXTRACT_ITEM)func_array[eUPDATE_ONE_EXTRACT_ITEM])(handle, storage_id, storage_type, data);
+ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "UPDATE_ONE_EXTRACT_ITEM failed [%d]", ret);
+
+ return ret;
+}
+
+int ms_delete_invalid_items_in_folder(sqlite3 *handle, const char *storage_id, const char *path, bool is_recursive, uid_t uid)
+{
+ int ret = MS_MEDIA_ERR_NONE;
+
+ ret = ((DELETE_ALL_INVALID_ITEMS_IN_FOLDER)func_array[eDELETE_FOLDER])(handle, storage_id, path, is_recursive, uid);
+ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "DELETE_ALL_INVALID_ITEMS_IN_FOLDER failed [%d]", ret);
+
+ return ret;
+}
+
+int ms_delete_invalid_folder_by_path(sqlite3 *handle, const char *storage_id, const char *folder_path, uid_t uid)
+{
+ int ret = MS_MEDIA_ERR_NONE;
+
+ ret = ((DELETE_INVALID_FOLDER_BY_PATH)func_array[eDELETE_INVALID_FOLDER_BY_PATH])(handle, storage_id, folder_path, uid);
+ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "DELETE_INVALID_FOLDER_BY_PATH failed [%d]", ret);
+
+ return ret;
+}
+
int ms_get_folder_scan_status(sqlite3 *handle, const char *storage_id, const char *path, int *scan_status)
{
int ret = MS_MEDIA_ERR_NONE;
return ret;
}
-
-int ms_get_media_type(const char *path, int *media_type)
-{
- int ret = MS_MEDIA_ERR_NONE;
-
- ret = ((GET_MEDIA_TYPE)func_array[eGET_MEDIA_TYPE])(path, media_type);
- MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "GET_MEDIA_TYPE failed [%d]", ret);
-
- return ret;
-}
-
-bool ms_check_support_media_type(const char *path)
-{
- int ret = SYSTEM_INFO_ERROR_NONE;
- int media_type = -1;
- bool is_supported = false;
-
- MS_DBG_RETVM_IF(!MS_STRING_VALID(path), false, "path is empty");
-
- if (scan_other_type == -1) {
- ret = system_info_get_platform_bool("http://tizen.org/feature/content.scanning.others", &is_supported);
- if (ret != SYSTEM_INFO_ERROR_NONE) {
- MS_DBG_ERR("SYSTEM_INFO_ERROR: content.scanning.others [%d]", ret);
- return false;
- }
-
- scan_other_type = is_supported;
- }
-
- if (!scan_other_type) {
- ret = ms_get_media_type(path, &media_type);
- MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, false, "Failed to get media type");
-
- if (media_type == MS_MEDIA_TYPE_OTHER)
- return false;
- }
-
- return true;
-}
+#endif