#define _MEDIA_COMMON_DB_SVC_H_
#include <glib.h>
+#include <system_info.h>
#include "media-common-types.h"
int ms_check_folder_exist(void **handle, const char *storage_id, const char *folder_path);
int ms_get_folder_id(void **handle, const char *storage_id, const char *path, char **folder_id);
int ms_get_media_type(void **handle, const char *path, int *media_type);
+bool ms_check_support_media_type(void **handle, const char *path);
/* FOR BULK COMMIT */
void ms_register_start(void **handle, ms_noti_switch_e noti_status, int pid);
static void **func_handle = NULL; /*dlopen handel*/
int insert_count_for_partial = 0;
int set_count_for_partial = 0;
+static int scan_other_type = -1;
enum func_list {
eCONNECT,
return res;
}
+bool ms_check_support_media_type(void **handle, 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 not, check media type */
+ if (!scan_other_type) {
+ ret = ms_get_media_type(handle, 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;
+}
+
void ms_bacth_commit_enable(void* handle, bool ins_status, bool valid_status, bool noti_enable, int pid)
{
/*call for bundle commit*/
close(id);
return MS_MEDIA_ERR_NONE;
}
-#endif
+#endif
\ No newline at end of file
char path[MS_FILE_PATH_LEN_MAX] = {0, };
bool is_recursive = true;
char *new_start_path = NULL;
- int media_type = MS_MEDIA_TYPE_OTHER;
int fd = -1;
int nread = 0;
}
if (d->d_type == DT_REG) {
- ms_get_media_type(handle, path, &media_type);
- if (media_type == MS_MEDIA_TYPE_OTHER) {
+ if (!ms_check_support_media_type(handle, path)) {
bpos += d->d_reclen;
continue;
}
char path[MS_FILE_PATH_LEN_MAX] = { 0 };
int (*scan_function)(void **, const char*, const char*, uid_t) = NULL;
char *new_start_path = NULL;
- int media_type = MS_MEDIA_TYPE_OTHER;
int fd = -1;
int nread = 0;
if (d->d_type == DT_REG) {
/* check media type */
- ms_get_media_type(handle, path, &media_type);
- if (media_type == MS_MEDIA_TYPE_OTHER) {
+ if (!ms_check_support_media_type(handle, path)) {
bpos += d->d_reclen;
continue;
}
+
/* insert into media DB */
ret = scan_function(handle, storage_id, path, uid);
if (ret != MS_MEDIA_ERR_NONE) {
}
if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) {
+ /* Check content.scanning.others feature */
+ if (!ms_check_support_media_type(handle, path)) {
+ MS_DBG("Unsupported media type");
+ continue;
+ }
+
if (scan_function(handle, storage_id, path, uid) != MS_MEDIA_ERR_NONE) {
MS_DBG_ERR("failed to update db");
continue;