Support noti for old path 79/87679/1 accepted/tizen/common/20160919.070505 accepted/tizen/ivi/20160920.051302 accepted/tizen/mobile/20160920.051149 accepted/tizen/tv/20160920.051214 accepted/tizen/wearable/20160920.051239 submit/tizen/20160919.012004
authorMinje Ahn <minje.ahn@samsung.com>
Fri, 9 Sep 2016 05:59:18 +0000 (14:59 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Fri, 9 Sep 2016 05:59:18 +0000 (14:59 +0900)
Change-Id: I0d75913983fc109124c1c5d8240dca87c4b20f19
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
lib/media-util-noti-internal.c
lib/media-util-noti.c
packaging/media-server.spec

index 59deb24..7465740 100755 (executable)
@@ -64,7 +64,11 @@ int media_db_update_send_internal(int pid, /* mandatory */
        GVariant *message = NULL;
        GDBusConnection *bus = NULL;
        GError *error = NULL;
-
+       char repl_path[MAX_FILEPATH_LEN] = {0, };
+#ifndef _USE_SENIOR_MODE
+       char *tmp_path = NULL;
+       const char *old_path = "/opt/usr/media";
+#endif
        bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
        if (!bus) {
                MSAPI_DBG("Failed to get gdbus connection: %s", error->message);
@@ -72,11 +76,26 @@ int media_db_update_send_internal(int pid, /* mandatory */
                return MS_MEDIA_ERR_INTERNAL;
        }
 
+       memset(repl_path, 0, sizeof(repl_path));
+#ifndef _USE_SENIOR_MODE
+       /* Need uid to change path */
+       if (strncmp(path, "/opt/usr/home", strlen("/opt/usr/home")) == 0) {
+               tmp_path = strstr(path, "content");
+               snprintf(repl_path, sizeof(repl_path), "%s%s", old_path, tmp_path + strlen("content"));
+       } else {
+               snprintf(repl_path, sizeof(repl_path), "%s", path);
+       }
+
+       MSAPI_DBG("New path: [%s]", repl_path);
+#else
+       snprintf(repl_path, sizeof(repl_path), "%s", path);
+#endif
+
        if (item == MS_MEDIA_ITEM_FILE) {
                MSAPI_DBG("FILE CHANGED");
                if (uuid != NULL && mime_type != NULL) {
                        /* fill all datas */
-                       message = g_variant_new("(iiissis)", item, pid, update_type, path, uuid, media_type, mime_type);
+                       message = g_variant_new("(iiissis)", item, pid, update_type, repl_path, uuid, media_type, mime_type);
                } else {
                        MSAPI_DBG_ERR("uuid or mime_type is NULL");
                        return MS_MEDIA_ERR_INVALID_PARAMETER;
@@ -85,9 +104,9 @@ int media_db_update_send_internal(int pid, /* mandatory */
                MSAPI_DBG("DIRECTORY CHANGED");
                /* fill all datas */
                if (uuid != NULL) {
-                       message = g_variant_new("(iiiss)", item, pid, update_type, path, uuid);
+                       message = g_variant_new("(iiiss)", item, pid, update_type, repl_path, uuid);
                } else {
-                       message = g_variant_new("(iiis)", item, pid, update_type, path);
+                       message = g_variant_new("(iiis)", item, pid, update_type, repl_path);
                }
        } else {
                MSAPI_DBG("this request is wrong");
index 62a4a87..e74eb75 100755 (executable)
@@ -203,6 +203,11 @@ int media_db_update_send(int pid, /* mandatory */
        GVariant *message = NULL;
        GDBusConnection *bus = NULL;
        GError *error = NULL;
+       char repl_path[MAX_FILEPATH_LEN] = {0, };
+#ifndef _USE_SENIOR_MODE
+       char *tmp_path = NULL;
+       const char *old_path = "/opt/usr/media";
+#endif
 
        bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
        if (!bus) {
@@ -211,11 +216,26 @@ int media_db_update_send(int pid, /* mandatory */
                return MS_MEDIA_ERR_INTERNAL;
        }
 
+       memset(repl_path, 0, sizeof(repl_path));
+#ifndef _USE_SENIOR_MODE
+       /* Need uid to change path */
+       if (strncmp(path, "/opt/usr/home", strlen("/opt/usr/home")) == 0) {
+               tmp_path = strstr(path, "content");
+               snprintf(repl_path, sizeof(repl_path), "%s%s", old_path, tmp_path + strlen("content"));
+       } else {
+               snprintf(repl_path, sizeof(repl_path), "%s", path);
+       }
+
+       MSAPI_DBG("New path: [%s]", repl_path);
+#else
+       snprintf(repl_path, sizeof(repl_path), "%s", path);
+#endif
+
        if (item == MS_MEDIA_ITEM_FILE) {
                MSAPI_DBG("FILE CHANGED");
                if (uuid != NULL && mime_type != NULL) {
                        /* fill all datas */
-                       message = g_variant_new("(iiissis)", item, pid, update_type, path, uuid, media_type, mime_type);
+                       message = g_variant_new("(iiissis)", item, pid, update_type, repl_path, uuid, media_type, mime_type);
                } else {
                        MSAPI_DBG_ERR("uuid or mime_type is NULL");
                        return MS_MEDIA_ERR_INVALID_PARAMETER;
@@ -224,9 +244,9 @@ int media_db_update_send(int pid, /* mandatory */
                MSAPI_DBG("DIRECTORY CHANGED");
                /* fill all datas */
                if (uuid != NULL) {
-                       message = g_variant_new("(iiiss)", item, pid, update_type, path, uuid);
+                       message = g_variant_new("(iiiss)", item, pid, update_type, repl_path, uuid);
                } else {
-                       message = g_variant_new("(iiis)", item, pid, update_type, path);
+                       message = g_variant_new("(iiis)", item, pid, update_type, repl_path);
                }
        } else {
                MSAPI_DBG("this request is wrong");
index f7f48e3..d3759a1 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       media-server
 Summary:    A server for media content management
-Version:    0.2.114
+Version:    0.2.115
 Release:    0
 Group:      Multimedia/Service
 License:    Apache-2.0