Add other type checker 13/319713/1 accepted/tizen/unified/20250218.161758 accepted/tizen/unified/x/20250221.042159
authorMinje Ahn <minje.ahn@samsung.com>
Mon, 17 Feb 2025 01:29:05 +0000 (10:29 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Mon, 17 Feb 2025 01:29:05 +0000 (10:29 +0900)
Change to check 'content.scanning.others' feature if media type is other.

Change-Id: Ie06e7ee6d3ef38549f2b28af728793d51e8308a2
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
CMakeLists.txt
include/media-svc-util.h
include/media-svc.h
packaging/libmedia-service.spec
plugin/media-content-plugin.c
src/media-svc-util.c
src/media-svc.c

index 3beecf2cb96d0d32b9725ec95fd733af9d9b7476..78d53b0eb063c6f8bf583156af3699d8329188b5 100644 (file)
@@ -50,7 +50,7 @@ EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
 
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED glib-2.0 dlog sqlite3 libexif mm-fileinfo libmedia-utils aul uuid libxml-2.0 libzip media-thumbnail libpodofo iniparser)
+pkg_check_modules(pkgs REQUIRED glib-2.0 dlog sqlite3 libexif mm-fileinfo libmedia-utils aul uuid libxml-2.0 libzip media-thumbnail libpodofo iniparser capi-system-info)
 
 FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index a3cc97086e1934ff8fff3d1e2170f4935e4b4c95..1ab4497bb04bb3d2c88fa78125a5c5625841fd4e 100644 (file)
@@ -99,7 +99,6 @@ void _media_svc_extract_video_metadata(media_svc_content_info_s *content_info);
 int _media_svc_extract_book_metadata(media_svc_content_info_s *content_info);
 void _media_svc_destroy_content_info(media_svc_content_info_s *content_info);
 int _media_svc_create_thumbnail(const char *path, char *thumb_path, media_svc_media_type_e media_type, uid_t uid);
-int _media_svc_get_media_type(const char *path, int *mediatype);
 bool _media_svc_is_keyword_included(const char *path, const char *keyword);
 void _media_svc_update_wordbook(const char *path, uid_t uid);
 void _media_svc_clean_wordbook(uid_t uid);
index 603ae15004d3982d890027d749d1402b55d3d2de..0d58a4c595d7752de2ae42199c657f774316b2ea 100644 (file)
@@ -67,7 +67,6 @@ int media_svc_check_folder_exist_by_path(sqlite3 *handle, const char *folder_pat
 int media_svc_append_query(const char *query, uid_t uid);
 int media_svc_send_query(uid_t uid);
 
-int media_svc_get_media_type(const char *path, int *mediatype);
 int media_svc_create_thumbnail(const char *file_path, int media_type, uid_t uid, char **thumbnail_path);
 
 int media_svc_get_book_by_keyword(sqlite3 *handle, const char *keyword, uid_t uid, GList **result);
index 66bd55140cd6e00c9776d8e20536cc8bc9eb61de..99c9f646ae76b76e963fa86b90abf28323b32efa 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmedia-service
 Summary:    Media information service library for multimedia applications
-Version:    0.7.1
+Version:    0.7.2
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
@@ -24,6 +24,7 @@ BuildRequires:  pkgconfig(uuid)
 BuildRequires:  pkgconfig(media-thumbnail)
 BuildRequires:  pkgconfig(libpodofo)
 BuildRequires:  pkgconfig(iniparser)
+BuildRequires:  pkgconfig(capi-system-info)
 
 %description
 This package is a library that provides the media information service for the multimedia applications.
index fc9f155751ab34773b430e67595484772fc3f051..bfa8e846d2d08b7cd317a5afd138f1cd351c9591 100644 (file)
@@ -95,11 +95,6 @@ int check_folder_exist(sqlite3 *handle, const char *folder_path)
        return media_svc_check_folder_exist_by_path(handle, folder_path);
 }
 
-int get_media_type(const char *path, int *mediatype)
-{
-       return media_svc_get_media_type(path, mediatype);
-}
-
 int refresh_item(sqlite3 *handle, const char *path, uid_t uid)
 {
        return media_svc_refresh_item(handle, true, path, uid);
index d2faaa4e5be0851219e9ad8c750afd25485becf8..e7d59016d5a6d36de721f93c5fef47c7e05c0dd0 100644 (file)
@@ -998,25 +998,6 @@ int _media_svc_create_thumbnail(const char *path, char *thumb_path, media_svc_me
        return (ret == THUMB_OK) ? MS_MEDIA_ERR_NONE : MS_MEDIA_ERR_INTERNAL;
 }
 
-int _media_svc_get_media_type(const char *path, int *mediatype)
-{
-       int ret = MS_MEDIA_ERR_NONE;
-       char mime_type[256] = {0};
-       media_svc_media_type_e media_type = MEDIA_SVC_MEDIA_TYPE_OTHER;
-
-       media_svc_retvm_if(mediatype == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "mediatype is NULL");
-
-       ret = __media_svc_get_mime_type(path, mime_type);
-       if (ret == MS_MEDIA_ERR_NONE)
-               __media_svc_get_media_type(path, mime_type, &media_type);
-       else
-               media_svc_error("__media_svc_get_mime_type failed");
-
-       *mediatype = media_type;
-
-       return ret;
-}
-
 bool _media_svc_is_keyword_included(const char *path, const char *keyword)
 {
        bool ret = false;
index 1dccf4df36b46dee41aaf840d9d47b9bf2507f31..74a312fc1b242491c2b36e8745f308134b1957be 100644 (file)
 #include "media-svc-storage.h"
 
 #include <iniparser.h>
+#include <system_info.h>
 
 #define CONTENT_INI_DEFAULT_PATH SYSCONFDIR"/multimedia/media_content_config.ini"
 
 static __thread int g_media_svc_cur_data_cnt = 0;
+static int g_media_svc_other_support = -1;
 
 /* Flag for items to be published by notification */
 static __thread bool g_insert_with_noti = false;
@@ -94,6 +96,21 @@ int media_svc_insert_item_end(uid_t uid)
        return ret;
 }
 
+static bool __media_svc_check_support_media_type(void)
+{
+       int ret = SYSTEM_INFO_ERROR_NONE;
+       bool is_supported = false;
+
+       if (g_media_svc_other_support == -1) {
+               ret = system_info_get_platform_bool("http://tizen.org/feature/content.scanning.others", &is_supported);
+               media_svc_retvm_if(ret != SYSTEM_INFO_ERROR_NONE, false, "SYSTEM_INFO_ERROR: content.scanning.others [%d]", ret);
+
+               g_media_svc_other_support = is_supported;
+       }
+
+       return (g_media_svc_other_support);
+}
+
 static int __media_svc_set_info(sqlite3 *handle,
                                                        const char *storage_id,
                                                        const char *path,
@@ -124,6 +141,9 @@ static int __media_svc_set_info(sqlite3 *handle,
                ret = _media_svc_extract_book_metadata(info);
                break;
        default:
+               /* Check other feature */
+               media_svc_retv_del_if(!__media_svc_check_support_media_type(), MS_MEDIA_ERR_UNSUPPORTED_CONTENT, info);
+
                /* The 'TITLE' should always be filled in */
                info->media_meta.title = _media_svc_get_title_from_filename(info->file_name);
                break;
@@ -482,11 +502,6 @@ int media_svc_send_query(uid_t uid)
        return _media_svc_list_query_do(MEDIA_SVC_QUERY_UPDATE_COMMON, uid);
 }
 
-int media_svc_get_media_type(const char *path, int *mediatype)
-{
-       return _media_svc_get_media_type(path, mediatype);
-}
-
 int media_svc_create_thumbnail(const char *file_path, int media_type, uid_t uid, char **thumbnail_path)
 {
        int ret = MS_MEDIA_ERR_NONE;