#define _MEDIA_COMMON_DB_SVC_H_
#include <glib.h>
-#include <system_info.h>
#include "media-common-types.h"
int ms_set_all_storage_validity(int validity, uid_t uid);
int ms_check_folder_exist(sqlite3 *handle, const char *folder_path);
int ms_get_folder_id(sqlite3 *handle, const char *storage_id, const char *path, char **folder_id);
-int ms_get_media_type(const char *path, int *media_type);
-bool ms_check_support_media_type(const char *path);
void ms_register_start(bool noti_status, int pid);
void ms_register_end(uid_t uid);
static GMutex db_mutex;
static void **func_array;
static void *func_handle = NULL;
-static int scan_other_type = -1;
typedef int (*INSERT_ITEM_BEGIN)(bool, int);
typedef int (*INSERT_ITEM_END)(uid_t);
typedef int (*SET_STORAGE_VALIDITY)(const char *, int, uid_t uid);
typedef int (*SET_ALL_STORAGE_VALIDITY)(int, uid_t);
typedef int (*CHECK_FOLDER_EXIST)(sqlite3 *, const char *);
-typedef int (*GET_MEDIA_TYPE)(const char *, int *);
typedef int (*REFRESH_ITEM)(sqlite3 *, const char *, uid_t);
#ifdef _USE_TVPD_MODE
eSET_STORAGE_VALIDITY,
eSET_ALL_STORAGE_VALIDITY,
eCHECK_FOLDER_EXIST,
- eGET_MEDIA_TYPE,
eREFRESH_ITEM,
#ifdef _USE_TVPD_MODE
eUPDATE_FOLDER_TIME,
"set_storage_validity",
"set_all_storage_validity",
"check_folder_exist",
- "get_media_type",
"refresh_item",
#ifdef _USE_TVPD_MODE
"update_folder_time",
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_set_subfolder_validity(sqlite3 *handle, const char *path, int validity, uid_t uid)
{
}
if (dir_entry->d_type == DT_REG) {
- if (!ms_check_support_media_type(path))
- continue;
-
ret = ms_validate_item(handle, storage_id, path, uid);
if (ret != MS_MEDIA_ERR_NONE) {
MS_DBG_ERR("failed to update db : %d", ret);
}
if (dir_entry->d_type == DT_REG) {
- if (!ms_check_support_media_type(path))
- continue;
-
ret = scan_function(handle, storage_id, path, uid);
if (ret != MS_MEDIA_ERR_NONE) {
MS_DBG_ERR("failed to update db : %d", msg_type);