Add channel history 31/44331/1
authorjinwoo.shin <jw0227.shin@samsung.com>
Tue, 21 Jul 2015 04:22:26 +0000 (13:22 +0900)
committerjinwoo.shin <jw0227.shin@samsung.com>
Tue, 21 Jul 2015 04:22:26 +0000 (13:22 +0900)
Change-Id: I06f86572c3df25fb6c48f844689f6494ea565e47
Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
src/tv.c

index fff8b6d..b0da082 100644 (file)
--- a/src/tv.c
+++ b/src/tv.c
@@ -19,6 +19,7 @@
 #include <iconv.h>
 #include <math.h>
 #include <app_debug.h>
+#include <app_contents.h>
 
 #include <glib.h>
 #include <glib-object.h>
@@ -612,6 +613,14 @@ void tv_channel_del_list(Eina_List *channel_list)
                free(data);
 }
 
+void _tv_channel_add_history(int service_id)
+{
+       char buf[128];
+
+       snprintf(buf, sizeof(buf), "%d", service_id);
+       app_contents_recent_add(CONTENTS_CHANNEL, buf);
+}
+
 /**
  * Tunes to specific channel with service id.
  *
@@ -633,6 +642,8 @@ int tv_channel_tune_with_service_id(int service_id)
                return -1;
        }
 
+       _tv_channel_add_history(service_id);
+
        g_tv_info.viewing_locked_channel = -1;
 
        return 0;
@@ -665,6 +676,8 @@ int tv_channel_tune(void)
                return -1;
        }
 
+       _tv_channel_add_history(service_id);
+
        g_tv_info.viewing_locked_channel = -1;
 
        return 0;
@@ -754,6 +767,8 @@ int tv_channel_tune_locked_channel(int service_id, char *password)
                return -1;
        }
 
+       _tv_channel_add_history(service_id);
+
        g_tv_info.viewing_locked_channel = service_id;
 
        return 0;
@@ -769,7 +784,7 @@ int tv_channel_tune_locked_channel(int service_id, char *password)
 int tv_channel_next(void)
 {
        TvServiceAntenna antenna_type;
-       int r;
+       int service_id, r;
 
        if (!g_tv_info.live_svc) {
                _ERR("failed to get live service");
@@ -791,6 +806,14 @@ int tv_channel_next(void)
 
        g_tv_info.viewing_locked_channel = -1;
 
+       r = tv_service_live_get_service_id(g_tv_info.live_svc, &service_id);
+       if (r < 0) {
+               _ERR("failed to get service id");
+               return -1;
+       }
+
+       _tv_channel_add_history(service_id);
+
        return 0;
 }
 
@@ -804,7 +827,7 @@ int tv_channel_next(void)
 int tv_channel_prev(void)
 {
        TvServiceAntenna antenna_type;
-       int r;
+       int service_id, r;
 
        if (!g_tv_info.live_svc) {
                _ERR("failed to get live service");
@@ -826,6 +849,14 @@ int tv_channel_prev(void)
 
        g_tv_info.viewing_locked_channel = -1;
 
+       r = tv_service_live_get_service_id(g_tv_info.live_svc, &service_id);
+       if (r < 0) {
+               _ERR("failed to get service id");
+               return -1;
+       }
+
+       _tv_channel_add_history(service_id);
+
        return 0;
 }