From: Minje Ahn Date: Thu, 17 Oct 2024 23:42:26 +0000 (+0900) Subject: Remove metadata-extractor dependency X-Git-Tag: accepted/tizen/unified/20241029.161305^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;p=platform%2Fcore%2Fapi%2Fsystem-settings.git Remove metadata-extractor dependency Ringtone files do not have metadata fields. So removed the dependency and used a file name without an extension. Change-Id: Ia2fabcd38c898dd7dc0844409fe276b3235095c8 Signed-off-by: Minje Ahn --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ba6e2c4..ad4eac4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS} -std=c++14") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") PKG_CHECK_MODULES(pkgs REQUIRED dlog vconf fontconfig libxml-2.0 pkgmgr-info - alarm-service capi-media-metadata-extractor aul json-glib-1.0 capi-appfw-app-manager + alarm-service aul json-glib-1.0 capi-appfw-app-manager capi-appfw-package-manager capi-system-info glib-2.0) INCLUDE_DIRECTORIES(${pkgs_INCLUDE_DIRS}) LINK_DIRECTORIES(${pkgs_LIBRARY_DIRS}) diff --git a/packaging/capi-system-system-settings.spec b/packaging/capi-system-system-settings.spec index 4d9a6dd..f909106 100644 --- a/packaging/capi-system-system-settings.spec +++ b/packaging/capi-system-system-settings.spec @@ -19,7 +19,6 @@ BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(alarm-service) BuildRequires: pkgconfig(uuid) -BuildRequires: pkgconfig(capi-media-metadata-extractor) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(libsystemd) BuildRequires: pkgconfig(json-glib-1.0) diff --git a/src/sst_sound.c b/src/sst_sound.c index c4260c2..fa29b31 100644 --- a/src/sst_sound.c +++ b/src/sst_sound.c @@ -20,7 +20,6 @@ #include #include #include -#include #include "sst.h" #include "sst_json.h" #include "sst_vconf.h" @@ -32,35 +31,17 @@ typedef struct _file_Info { char *media_name; } sst_file_info; -static char* get_media_basename(const char *dir_path, const char *name) +static char* get_media_basename(const char *name) { - RETV_IF(NULL == name, NULL); - RETV_IF(NULL == dir_path, NULL); - - char path[PATH_MAX]; - snprintf(path, sizeof(path), "%s/%s", dir_path, name); - - metadata_extractor_h metadata = NULL; - int ret = metadata_extractor_create(&metadata); - if (ret != METADATA_EXTRACTOR_ERROR_NONE || NULL == metadata) { - ERR("metadata_extractor_create() Fail(%d)", ret); - return strdup(name); - } + char *last_dot = NULL; - ret = metadata_extractor_set_path(metadata, path); - if (METADATA_EXTRACTOR_ERROR_NONE != ret) { - ERR("metadata_extractor_set_path(%s) Fail(%d)", path, ret); - metadata_extractor_destroy(metadata); - return strdup(name); - } + RETV_IF(NULL == name, NULL); - char *title = NULL; - ret = metadata_extractor_get_metadata(metadata, METADATA_TITLE, &title); - metadata_extractor_destroy(metadata); - if (title) - return title; + last_dot = strrchr(name, '.'); + if (last_dot) + return g_strndup(name, last_dot - name); else - return strdup(name); + return g_strdup(name); } static int _get_filelist_in_dir(const char *path, GList **file_list) @@ -93,7 +74,7 @@ static int _get_filelist_in_dir(const char *path, GList **file_list) } info->name = strdup(ent->d_name); - info->media_name = get_media_basename(path, info->name); + info->media_name = get_media_basename(info->name); *file_list = g_list_append(*file_list, info); }