[TIZENIOT-1761] Implemented progress tracker for video files 43/245043/2
authoraman.jeph <aman.jeph@samsung.com>
Tue, 29 Sep 2020 12:21:02 +0000 (17:51 +0530)
committeraman.jeph <aman.jeph@samsung.com>
Tue, 29 Sep 2020 12:39:51 +0000 (18:09 +0530)
Change-Id: Ia30396653e3963e2df8ca7e5cb4cf1d80d4b5abd
Signed-off-by: aman.jeph <aman.jeph@samsung.com>
14 files changed:
common/CMakeLists.txt
common/include/vp-playtime-db.h [new file with mode: 0755]
common/src/vp-playtime-db.c [new file with mode: 0755]
include/common/mp-util-media-service.h
playview/src/view/vp-play-normal-view.c
project_def.prop
src/common/mp-util-media-service.c
src/video-player.c
src/view/mp-video-list-remove-view.c
src/view/mp-video-list-share-via-view.c
src/view/mp-video-list-view-item-of-folder.c
src/view/mp-video-list-view-main.c
src/view/mp-video-list-view-thumbnail.c
vp-main/project_def.prop

index 343ae85b2f25c714660717f3c394f949228a5445..4ebd5d189cf6d01e98c8027c0ca9d328d910b675 100755 (executable)
@@ -13,6 +13,7 @@ SET(SRCS
        src/vp-util.c
        src/vp-file-util.c
        src/vp-pinch-zoom.c
+       src/vp-playtime-db.c
 )
 
 INCLUDE_DIRECTORIES(
diff --git a/common/include/vp-playtime-db.h b/common/include/vp-playtime-db.h
new file mode 100755 (executable)
index 0000000..dd57e12
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __VP_PLAYTIME_DB_H__
+#define __VP_PLAYTIME_DB_H__
+
+#ifdef _cplusplus
+extern "C" {
+#endif
+
+       typedef int (*table_data_cb)(void *user_data ,int count, char **data ,char **colums);
+
+       int vp_playtime_db_create();
+       int vp_playtime_db_insert_row(const char *url, int progress);
+       int vp_playtime_db_select_all(table_data_cb callback, void *data);
+       int vp_playtime_db_get_progress(const char *url, table_data_cb callback,  void *data);
+       int vp_playtime_db_remove_entries(void *data);
+
+#ifdef _cplusplus
+}
+#endif
+
+#endif // __VP_PLAYTIME_DB_H__
diff --git a/common/src/vp-playtime-db.c b/common/src/vp-playtime-db.c
new file mode 100755 (executable)
index 0000000..978c6cd
--- /dev/null
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sqlite3.h>
+#include <eina_list.h>
+
+#include "vp-db-common.h"
+#include "vp-db-util.h"
+#include "vp-file-util.h"
+
+#include "vp-media-content-util.h"
+
+#include "vp-playtime-db.h"
+#include "app_common.h"
+
+
+
+static char *db_path = NULL;
+static char sql_query[4096] = {0, };
+
+const char* _vp_playtime_db_get_path()
+{
+       if(db_path == NULL) {
+               char *path = app_get_data_path();
+               if(path == NULL) {
+                       vp_dbgE("failed to get shared resource path");
+                       return NULL;
+               }
+               int len = strlen(path)+strlen("playtime.db")+5;
+               db_path = calloc(len, sizeof(char));
+               if(db_path == NULL) {
+                       vp_dbgE("failed to allocate memorey for db file path");
+                       return NULL;
+               }
+               snprintf(db_path, len, "%s%s", path, "playtime.db");
+               vp_dbgW("db path: %s", db_path);
+               free(path);
+       }
+       return db_path;
+}
+
+static void _vp_playtime_db_errlog_cb(void *data, int err_code, const char *msg)
+{
+       vp_dbgE("Sqlite Error: [code: %d] [Msg: %s]", err_code, msg);
+}
+
+static int _vp_playtime_db_select_cd(void *user_data, int count, char **data, char **colums)
+{
+       vp_dbgW("There are %d colums in this select set", count);
+
+       for(int i = 0; i<count; ++i)
+       {
+               vp_dbgW("[Colum: %s] :  [%s]", colums[i], data[i]);
+       }
+       return 0;
+}
+
+
+/* external functions */
+
+int vp_playtime_db_remove_entries(void *list_handle) {
+       if(list_handle == NULL)
+       {
+               vp_dbgE("eina list is invalid");
+               return 0;
+       }
+       Eina_List *list = (Eina_List*)list_handle;
+       sqlite3 *db = NULL;
+       char *error_msg = NULL;
+       int ret = sqlite3_open(_vp_playtime_db_get_path(), &db);
+       if(ret != SQLITE_OK) {
+               vp_dbgE("failed to open datebase: %s", sqlite3_errmsg(db));
+                sqlite3_close(db);
+                return 0;
+       }
+       Eina_List *l = NULL;
+       Eina_List *l_next = NULL;
+       char *data = NULL;
+       // use statement for list deletion
+       ret = sqlite3_exec(db, "BEGIN TRANSACTION;", NULL, NULL, &error_msg);
+       if(ret != SQLITE_OK) {
+               vp_dbgE("SQL error : %s", error_msg);
+               sqlite3_free(error_msg);
+               sqlite3_close(db);
+               return 0;
+       }
+       EINA_LIST_FOREACH_SAFE(list, l, l_next, data) {
+                       sqlite3_snprintf(4096, sql_query, "DELETE FROM PlayTimeData WHERE MediaUrl = '%q'", (char*)data);
+                       ret = sqlite3_exec(db, sql_query, NULL, NULL, &error_msg);
+                       if(ret != SQLITE_OK) {
+                               vp_dbgE("SQL Error: %s", error_msg);
+                               sqlite3_free(error_msg);
+                       }
+                       free(data);
+                       list = eina_list_remove_list(list, l);
+       }
+       ret = sqlite3_exec(db, "END TRANSACTION;", NULL, NULL, &error_msg);
+       if(ret != SQLITE_OK) {
+               vp_dbgE("SQL error : %s", error_msg);
+               sqlite3_free(error_msg);
+               sqlite3_close(db);
+               return 0;
+       }
+       sqlite3_close(db);
+       return 1;
+}
+
+int vp_playtime_db_select_all(table_data_cb callback, void *data)
+{
+       sqlite3 *db = NULL;
+       char *error_msg = NULL;
+       int ret = sqlite3_open(_vp_playtime_db_get_path(), &db);
+       if(ret != SQLITE_OK) {
+               vp_dbgE("failed to open datebase: %s", sqlite3_errmsg(db));
+                sqlite3_close(db);
+                return 0;
+       }
+
+       const char *sql = "SELECT MediaUrl FROM PlayTimeData";
+
+       ret = sqlite3_exec(db, sql, callback, data, &error_msg);
+       if (ret != SQLITE_OK ) {
+               vp_dbgE("SQL error : %s", error_msg);
+               sqlite3_free(error_msg);
+               sqlite3_close(db);
+               return 0;
+    }
+
+       sqlite3_close(db);
+
+       return 1;
+}
+
+int vp_playtime_db_get_progress(const char *url, table_data_cb callback,  void *data)
+{
+       if(url == NULL || callback == NULL) {
+               vp_dbgE("url [%p] or callback [%p] may be null", url, callback);
+               return 0;
+       }
+
+       sqlite3 *db = NULL;
+       char *error_msg = NULL;
+       int ret = sqlite3_open(_vp_playtime_db_get_path(), &db);
+       if(ret != SQLITE_OK) {
+               vp_dbgE("failed to open datebase: %s", sqlite3_errmsg(db));
+                sqlite3_close(db);
+                return 0;
+       }
+
+       sqlite3_snprintf(4096, sql_query, "SELECT Progress FROM PlayTimeData WHERE MediaUrl = '%q'", url);
+
+       ret = sqlite3_exec(db, sql_query, callback, data, &error_msg);
+       if (ret != SQLITE_OK ) {
+               vp_dbgE("SQL error : %s", error_msg);
+               sqlite3_free(error_msg);
+               sqlite3_close(db);
+               return 0;
+       }
+
+       sqlite3_close(db);
+
+       return 1;
+}
+
+int vp_playtime_db_insert_row(const char *url, int progress)
+{
+       sqlite3 *db = NULL;
+       char *error_msg = NULL;
+       int ret = sqlite3_open(_vp_playtime_db_get_path(), &db);
+       if(ret != SQLITE_OK) {
+               vp_dbgE("failed to open datebase: %s", sqlite3_errmsg(db));
+                sqlite3_close(db);
+                return 0;
+       }
+
+       sqlite3_snprintf(4096, sql_query, "INSERT OR IGNORE INTO PlayTimeData (MediaUrl, Progress) VALUES('%q', %d);"
+                       "UPDATE PlayTimeData SET Progress = %d WHERE MediaUrl = '%q'",url, progress, progress, url);
+
+       ret = sqlite3_exec(db, sql_query, 0, 0, &error_msg);
+       if (ret != SQLITE_OK ) {
+               vp_dbgE("SQL error : %s", error_msg);
+               sqlite3_free(error_msg);
+               sqlite3_close(db);
+               return 0;
+    }
+
+       sqlite3_close(db);
+
+       return 1;
+}
+
+int vp_playtime_db_create()
+{
+       int ret = sqlite3_config(SQLITE_CONFIG_LOG, _vp_playtime_db_errlog_cb, "Videos");
+       if(ret != SQLITE_OK) {
+               vp_dbgE("Failed to set config: SQLITE_CONFIG_LOG [err code: %d]", ret);
+       }
+
+       ret = sqlite3_initialize();
+       if(ret != SQLITE_OK) {
+               vp_dbgE("failed to initialize sqlite3: %d", ret);
+               return 0;
+       }
+
+       sqlite3 *db = NULL;
+       char *error_msg = NULL;
+       ret = sqlite3_open(_vp_playtime_db_get_path(), &db);
+       if(ret != SQLITE_OK) {
+               vp_dbgE("failed to open datebase: %s", sqlite3_errmsg(db));
+                sqlite3_close(db);
+                return 0;
+       }
+
+       const char *sql = "CREATE TABLE IF NOT EXISTS PlayTimeData(MediaUrl TEXT UNIQUE, Progress INT);";
+
+       ret = sqlite3_exec(db, sql, 0, 0, &error_msg);
+       if (ret != SQLITE_OK ) {
+               vp_dbgE("SQL error : %s", error_msg);
+               sqlite3_free(error_msg);
+               sqlite3_close(db);
+               return 0;
+    }
+       sqlite3_close(db);
+       return 1;
+}
index f962c865100363b9f28b71ecdca971e34dfd92e6..7a7d65cec5c15da0e8620b8e0114ae4cb8e979aa 100755 (executable)
@@ -167,6 +167,7 @@ bool mp_util_svc_check_valid_media_id(char *pMediaId, int style,
 void mp_util_svc_update_video_item(char *mediaUrl, int nVideoItemIndex);
 void mp_util_svc_generate_thumbnai(int nVideoItemIndex);
 
+void mp_util_svc_extract_video_url_by_item_type(void *list);
 
 
 #endif                                                 // _MP_UTIL_DATABASE_
index f0e38e0079a3642e93a6c75705228755fe507ff3..b29f8bb48e280f147517488d4cd7565a7ba422a3 100755 (executable)
@@ -79,6 +79,8 @@
 #include "vp-util.h"
 #include "vp-file-util.h"
 #include "vp-avrcp.h"
+#include "vp-playtime-db.h"
+
 
 
 #define VP_NORMAL_PROGRESS_TIMER_INTERVAL              0.3
 
 #define VP_NORMAL_STREAMING_PROTOCOLS_MAX 2
 #define VP_NORMAL_MAX_STR_LEN 8
+#define ONE_SEC_IN_MILLI_SEC 1000
+
 
 bool stay_pause = false;
 
@@ -9187,6 +9191,17 @@ static void _vp_play_normal_view_set_played_time(NormalView * pNormalView)
                        (pNormalView->pPlayerHandle, &nPosition)) {
                        VideoLogError("vp_mm_player_get_position is fail");
                }
+               int nTotalDuration = pNormalView->nDuration;
+
+               if(nPosition > 0 && nTotalDuration > 0 && nPosition <= nTotalDuration ) {
+                       //in case video is completed we need to push progress as zero because video need to start again.
+                       if((nTotalDuration - nPosition) < ONE_SEC_IN_MILLI_SEC) {
+                               vp_playtime_db_insert_row(pNormalView->szMediaURL, 0);
+                       } else {
+                               vp_playtime_db_insert_row(pNormalView->szMediaURL, nPosition);
+                       }
+               }
+
        } else if (pNormalView->nLaunchingType == VIDEO_PLAY_TYPE_MULTI_PATH) {
                if (!vp_mm_player_get_position
                        (pNormalView->pPlayerHandle, &nPosition)) {
index f50183c5d41e84735bcadaf586d9481e12f9a806..569236261d920b224b52c3f8b56cd4abe72af2ae 100755 (executable)
@@ -9,7 +9,7 @@ type = app
 profile = mobile-3.0
 
 # C Sources
-USER_SRCS = playview/src/widget/vp-play-more.c playview/src/core/vp-avrcp.c playview/src/widget/vp-play-button.c src/common/mp-rotate-ctrl.c src/feature/mp-util-move.c src/common/mp-util-preference.c playview/src/feature/vp-subtitle-size.c src/view/mp-video-list-view-normal.c src/common/mp-video-info-ctrl.c src/viewMgr/videos-view-mgr.c playview/src/feature/vp-subtitle-color.c playview/src/core/vp-hollic.c src/view/mp-video-list-view-thumbnail.c src/view/mp-video-list-folder-share-via-view.c common/src/vp-chapter-db.c playview/src/core/vp-image-util.c playview/src/core/vp-multi-path.c playview/src/feature/vp-subtitle-edge.c src/view/mp-video-list-view-folder.c playview/src/widget/vp-play-volume-popup.c src/common/mp-util-media-service.c playview/src/core/vp-media-contents.c playview/src/feature/vp-play-speed.c src/widget/mp-video-list-sort-ctrl.c src/widget/mp-external-ug.c src/widget/mp-footer-toolbar.c playview/src/feature/vp-repeat.c playview/src/feature/vp-subtitle-bg-color.c common/src/vp-preview-db.c playview/src/core/vp-sensor.c src/widget/mp-video-view-popup-ctrl.c src/view/mp-video-list-view-main.c playview/src/core/vp-device.c src/feature/mp-launching-video-displayer.c playview/src/feature/vp-audio-track.c src/view/mp-video-list-view-item-of-folder.c playview/src/feature/vp-subtitle.c playview/src/feature/vp-share.c common/src/vp-thumb-db.c playview/src/feature/vp-detail.c src/view/mp-video-list-personal-view.c playview/src/feature/vp-capture.c playview/src/core/vp-media-key.c src/common/mp-util.c playview/src/widget/vp-play-loading-ani.c src/common/mp-drm-ctrl.c playview/src/widget/vp-play-progressbar.c src/video-player.c src/view/mp-video-list-share-via-view.c src/common/mp-util-config.c playview/src/view/vp-play-normal-view.c src/view/mp-video-list-remove-view.c src/widget/mp-util-widget-ctrl.c playview/src/widget/vp-play-subtitle.c common/src/vp-util.c src/view/mp-video-list-view-select.c playview/src/feature/vp-setting.c core/src/vp-drm.c video-downloader/src/VppDownload.c src/view/mp-video-list-personal-ctrl.c src/widget/mp-video-list-option-ctrl.c playview/src/common/vp-play-util.c playview/src/widget/vp-play-popup.c playview/src/common/vp-play-ug.c playview/src/vp-play-view.c common/src/vp-file-util.c playview/src/feature/vp-sound-path.c playview/src/common/vp-play-preference.c common/src/vp-pinch-zoom.c src/view/mp-video-list-remove-ctrl.c src/view/mp-library-view-mgr.c common/src/vp-media-content-util.c common/src/vp-db-util.c playview/src/widget/vp-play-bookmark.c playview/src/feature/vp-subtitle-select.c playview/src/widget/vp-play-volume.c src/view/mp-video-detail-view.c playview/src/feature/vp-zoom-guide.c src/view/mp-video-search-view.c playview/src/feature/vp-subtitle-font.c src/common/mp-video-util-db-controller.c playview/src/core/vp-mm-player.c playview/src/feature/vp-subtitle-track.c src/widget/mp-video-rename-ctrl.c playview/src/core/vp-device-language.c playview/src/core/vp-sound.c playview/src/feature/vp-subtitle-alignment.c src/widget/mp-video-list-view-as-ctrl.c playview/src/widget/vp-play-brightness-popup.c playview/src/feature/vp-sound-alive.c playview/src/common/vp-play-config.c src/view/mp-video-list-view-common.c playview/src/feature/vp-subtitle-sync.c src/widget/mp-video-nocontent-layout.c src/widget/mp-video-list-auto-play-ctrl.c playview/src/widget/vp-play-minicontroller.c playview/src/widget/vp-play-lockscreenmc.c
+USER_SRCS = playview/src/widget/vp-play-more.c playview/src/core/vp-avrcp.c playview/src/widget/vp-play-button.c src/common/mp-rotate-ctrl.c src/feature/mp-util-move.c src/common/mp-util-preference.c playview/src/feature/vp-subtitle-size.c src/view/mp-video-list-view-normal.c src/common/mp-video-info-ctrl.c src/viewMgr/videos-view-mgr.c playview/src/feature/vp-subtitle-color.c playview/src/core/vp-hollic.c src/view/mp-video-list-view-thumbnail.c src/view/mp-video-list-folder-share-via-view.c common/src/vp-chapter-db.c playview/src/core/vp-image-util.c playview/src/core/vp-multi-path.c playview/src/feature/vp-subtitle-edge.c src/view/mp-video-list-view-folder.c playview/src/widget/vp-play-volume-popup.c src/common/mp-util-media-service.c playview/src/core/vp-media-contents.c playview/src/feature/vp-play-speed.c src/widget/mp-video-list-sort-ctrl.c src/widget/mp-external-ug.c src/widget/mp-footer-toolbar.c playview/src/feature/vp-repeat.c playview/src/feature/vp-subtitle-bg-color.c common/src/vp-preview-db.c playview/src/core/vp-sensor.c src/widget/mp-video-view-popup-ctrl.c src/view/mp-video-list-view-main.c playview/src/core/vp-device.c src/feature/mp-launching-video-displayer.c playview/src/feature/vp-audio-track.c src/view/mp-video-list-view-item-of-folder.c playview/src/feature/vp-subtitle.c playview/src/feature/vp-share.c common/src/vp-thumb-db.c playview/src/feature/vp-detail.c src/view/mp-video-list-personal-view.c playview/src/feature/vp-capture.c playview/src/core/vp-media-key.c src/common/mp-util.c playview/src/widget/vp-play-loading-ani.c src/common/mp-drm-ctrl.c playview/src/widget/vp-play-progressbar.c src/video-player.c src/view/mp-video-list-share-via-view.c src/common/mp-util-config.c playview/src/view/vp-play-normal-view.c src/view/mp-video-list-remove-view.c src/widget/mp-util-widget-ctrl.c playview/src/widget/vp-play-subtitle.c common/src/vp-util.c src/view/mp-video-list-view-select.c playview/src/feature/vp-setting.c core/src/vp-drm.c video-downloader/src/VppDownload.c src/view/mp-video-list-personal-ctrl.c src/widget/mp-video-list-option-ctrl.c playview/src/common/vp-play-util.c playview/src/widget/vp-play-popup.c playview/src/common/vp-play-ug.c playview/src/vp-play-view.c common/src/vp-file-util.c playview/src/feature/vp-sound-path.c playview/src/common/vp-play-preference.c common/src/vp-pinch-zoom.c src/view/mp-video-list-remove-ctrl.c src/view/mp-library-view-mgr.c common/src/vp-media-content-util.c common/src/vp-db-util.c playview/src/widget/vp-play-bookmark.c playview/src/feature/vp-subtitle-select.c playview/src/widget/vp-play-volume.c src/view/mp-video-detail-view.c playview/src/feature/vp-zoom-guide.c src/view/mp-video-search-view.c playview/src/feature/vp-subtitle-font.c src/common/mp-video-util-db-controller.c playview/src/core/vp-mm-player.c playview/src/feature/vp-subtitle-track.c src/widget/mp-video-rename-ctrl.c playview/src/core/vp-device-language.c playview/src/core/vp-sound.c playview/src/feature/vp-subtitle-alignment.c src/widget/mp-video-list-view-as-ctrl.c playview/src/widget/vp-play-brightness-popup.c playview/src/feature/vp-sound-alive.c playview/src/common/vp-play-config.c src/view/mp-video-list-view-common.c playview/src/feature/vp-subtitle-sync.c src/widget/mp-video-nocontent-layout.c src/widget/mp-video-list-auto-play-ctrl.c playview/src/widget/vp-play-minicontroller.c playview/src/widget/vp-play-lockscreenmc.c common/src/vp-playtime-db.c
 
 # EDC Sources
 USER_EDCS =  
index bc06b2ef0c6c1576d3aa777fab9e6ce74f3cc2f6..f0c5e94c6f908ff26c859200d8dc37b985b859d5 100755 (executable)
@@ -474,11 +474,11 @@ bool mp_util_svc_extract_video_list_from_folder(char *szFolderPath,
        case MP_LIST_VIEW_ALL:
                if (!mp_util_get_personal_status()) {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101) and FOLDER_PATH = \"%s\" and FOLDER_PATH NOT LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101) and FOLDER_PATH = \'%s\' and FOLDER_PATH NOT LIKE \'%s%%\'",
                                         szFolderPath, VIDEO_UTIL_PERSONAL_HEAD_STR);
                } else {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \"%s\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \'%s\'",
                                         szFolderPath);
                }
                break;
@@ -486,11 +486,11 @@ bool mp_util_svc_extract_video_list_from_folder(char *szFolderPath,
        case MP_LIST_VIEW_PHONE:
                if (!mp_util_get_personal_status()) {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 and (MEDIA_STORAGE_TYPE = 0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \"%s\" and FOLDER_PATH NOT LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 and (MEDIA_STORAGE_TYPE = 0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \'%s\' and FOLDER_PATH NOT LIKE \'%s%%\'",
                                         szFolderPath, VIDEO_UTIL_PERSONAL_HEAD_STR);
                } else {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \"%s\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \'%s\'",
                                         szFolderPath);
                }
                break;
@@ -498,11 +498,11 @@ bool mp_util_svc_extract_video_list_from_folder(char *szFolderPath,
        case MP_LIST_VIEW_CLOUD:
                if (!mp_util_get_personal_status()) {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101) and MEDIA_STORAGE_TYPE = 101 and FOLDER_PATH = \"%s\" and FOLDER_PATH NOT LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101) and MEDIA_STORAGE_TYPE = 101 and FOLDER_PATH = \'%s\' and FOLDER_PATH NOT LIKE \'%s%%\'",
                                         szFolderPath, VIDEO_UTIL_PERSONAL_HEAD_STR);
                } else {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_STORAGE_TYPE = 101 and FOLDER_PATH = \"%s\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_STORAGE_TYPE = 101 and FOLDER_PATH = \'%s\'",
                                         szFolderPath);
                }
                break;
@@ -510,11 +510,11 @@ bool mp_util_svc_extract_video_list_from_folder(char *szFolderPath,
        default:
                if (!mp_util_get_personal_status()) {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101) and FOLDER_PATH = \"%s\" and FOLDER_PATH NOT LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101) and FOLDER_PATH = \'%s\' and FOLDER_PATH NOT LIKE \'%s%%\'",
                                         szFolderPath, VIDEO_UTIL_PERSONAL_HEAD_STR);
                } else {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \"%s\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \'%s\'",
                                         szFolderPath);
                }
                break;
@@ -717,6 +717,73 @@ char *mp_util_get_folder_thumbnail(int nVideoFolderIndex, int nSortType)
        return szThumbnailPath;
 }
 
+static bool mp_util_svc_iterate_for_video_url_cb(media_info_h pMediaItem, void *pUserData)
+{
+       media_content_type_e nMediaType = MEDIA_CONTENT_TYPE_OTHERS;
+       if (!pMediaItem) {
+               return TRUE;
+       }
+       Eina_List **pList = (Eina_List **) pUserData;
+       media_info_get_media_type(pMediaItem, &nMediaType);
+
+       if (nMediaType == MEDIA_CONTENT_TYPE_VIDEO) {
+               // this will be deallocated when the eina list is deallocated.
+               char *szTmpItemFilePath = NULL;
+
+               media_info_get_file_path(pMediaItem, &szTmpItemFilePath);
+               VideoLogInfo("URL: %s", szTmpItemFilePath);
+
+               if (szTmpItemFilePath == NULL) {
+                       VideoLogError("Fail to get file path of media item.");
+                       return TRUE;
+               }
+               *pList = eina_list_append(*pList, szTmpItemFilePath);
+       }
+       VideoLogError("EinaList size: %d", eina_list_count(*pList));
+       return TRUE;
+}
+
+
+void mp_util_svc_extract_video_url_by_item_type(void *list)
+{
+       VideoLogError("");
+       filter_h m_FilterHandle = NULL;
+       media_content_order_e nOrderType = MEDIA_CONTENT_ORDER_DESC;
+       char szTmpStr[STR_LEN_MAX] = { 0, };
+       char szOrderObj[STR_LEN_MAX] = { 0, };
+
+       strncpy(szOrderObj, MEDIA_ADDED_TIME, STR_LEN_MAX - 1);
+       snprintf(szTmpStr, STR_LEN_MAX,
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101 OR MEDIA_STORAGE_TYPE=121) and MEDIA_PATH not like \'%s%%\'",
+                                        VIDEO_UTIL_PERSONAL_HEAD_STR);
+       if (media_filter_create(&m_FilterHandle) != MEDIA_CONTENT_ERROR_NONE) {
+               VideoLogInfo("Fail to create media filter handle.");
+               return;
+       }
+       if (media_filter_set_condition(m_FilterHandle, szTmpStr, MEDIA_CONTENT_COLLATE_DEFAULT) != MEDIA_CONTENT_ERROR_NONE) {
+               VideoLogError("Fail to set filter condition.");
+               media_filter_destroy(m_FilterHandle);
+               return;
+       }
+
+       if (media_filter_set_order(m_FilterHandle, MEDIA_CONTENT_ORDER_DESC, szOrderObj, MEDIA_CONTENT_COLLATE_NOCASE) != MEDIA_CONTENT_ERROR_NONE) {
+               VideoLogError("Fail to set order.");
+               media_filter_destroy(m_FilterHandle);
+               return;
+       }
+
+       if (media_info_foreach_media_from_db(m_FilterHandle, mp_util_svc_iterate_for_video_url_cb, list) != MEDIA_CONTENT_ERROR_NONE) {
+               VideoLogError("Fail to get video item list with filter condition.");
+               media_filter_destroy(m_FilterHandle);
+               return;
+       }
+
+       if (media_filter_destroy(m_FilterHandle) != MEDIA_CONTENT_ERROR_NONE) {
+               VideoLogError("Fail to destroy media filter handle.");
+               return;
+       }
+}
+
 /**
 * Get video list by item type
 * @param nSortType : sort type
@@ -776,7 +843,7 @@ bool mp_util_svc_extract_video_list_by_item_type(int nSortType,
        case MP_LIST_VIEW_ALL:
                if (!mp_util_get_personal_status()) {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101 OR MEDIA_STORAGE_TYPE=121) and MEDIA_PATH not like \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101 OR MEDIA_STORAGE_TYPE=121) and MEDIA_PATH not like \'%s%%\'",
                                         VIDEO_UTIL_PERSONAL_HEAD_STR);
                } else {
                        snprintf(szTmpStr, STR_LEN_MAX,
@@ -787,7 +854,7 @@ bool mp_util_svc_extract_video_list_by_item_type(int nSortType,
        case MP_LIST_VIEW_PHONE:
                if (!mp_util_get_personal_status()) {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 and (MEDIA_STORAGE_TYPE = 0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH not like \"%s%%\"",
+                                        "MEDIA_TYPE = 1 and (MEDIA_STORAGE_TYPE = 0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH not like \'%s%%\'",
                                         VIDEO_UTIL_PERSONAL_HEAD_STR);
                } else {
                        snprintf(szTmpStr, STR_LEN_MAX,
@@ -799,7 +866,7 @@ bool mp_util_svc_extract_video_list_by_item_type(int nSortType,
        case MP_LIST_VIEW_CLOUD:
                if (!mp_util_get_personal_status()) {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101) and MEDIA_STORAGE_TYPE = 101 and MEDIA_PATH not like \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101) and MEDIA_STORAGE_TYPE = 101 and MEDIA_PATH not like \'%s%%\'",
                                         VIDEO_UTIL_PERSONAL_HEAD_STR);
                } else {
                        snprintf(szTmpStr, STR_LEN_MAX,
@@ -811,7 +878,7 @@ bool mp_util_svc_extract_video_list_by_item_type(int nSortType,
        default:
                if (!mp_util_get_personal_status()) {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101 OR MEDIA_STORAGE_TYPE=121) and MEDIA_PATH not like \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101 OR MEDIA_STORAGE_TYPE=121) and MEDIA_PATH not like \'%s%%\'",
                                         VIDEO_UTIL_PERSONAL_HEAD_STR);
                } else {
                        snprintf(szTmpStr, STR_LEN_MAX,
@@ -1030,7 +1097,7 @@ bool mp_util_svc_get_video_id_by_video_url(const char *szPath,
                bRet = FALSE;
        }
 
-       snprintf(szTmpStr, STR_LEN_MAX, "MEDIA_PATH = \"%s\"", szPath);
+       snprintf(szTmpStr, STR_LEN_MAX, "MEDIA_PATH = \'%s\'", szPath);
        if (media_filter_set_condition(m_FilterHandle,
                                                                   szTmpStr,
                                                                   MEDIA_CONTENT_COLLATE_DEFAULT) !=
@@ -1100,7 +1167,7 @@ char *mp_util_svc_get_video_Thumbnail_by_video_url(const char *szMediaUri)
 
        memset(szTmpStr, 0, STR_LEN_MAX);
        snprintf(szTmpStr, STR_LEN_MAX,
-                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101 OR MEDIA_STORAGE_TYPE=121) AND MEDIA_PATH = \"%s\"",
+                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101 OR MEDIA_STORAGE_TYPE=121) AND MEDIA_PATH = \'%s\'",
                         szMediaUri);
        if (media_filter_set_condition
                (m_FilterHandle, szTmpStr,
@@ -1162,7 +1229,7 @@ void mp_util_svc_set_video_last_played_time_by_url(char *szMediaUri,
        }
 
        snprintf(szTmpStr, STR_LEN_MAX,
-                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101 OR MEDIA_STORAGE_TYPE=121) AND MEDIA_PATH = \"%s\"",
+                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101 OR MEDIA_STORAGE_TYPE=121) AND MEDIA_PATH = \'%s\'",
                         szMediaUri);
        if (media_filter_set_condition
                (m_FilterHandle, szTmpStr,
@@ -1581,11 +1648,11 @@ bool mp_util_svc_extract_personal_video_folder_list(int nSortType,
 
        if (bPersonal == FALSE) {
                snprintf(szTmpStr, STR_LEN_MAX,
-                                "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH NOT LIKE \"%s%%\"",
+                                "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH NOT LIKE \'%s%%\'",
                                 VIDEO_UTIL_PERSONAL_HEAD_STR);
        } else {
                snprintf(szTmpStr, STR_LEN_MAX,
-                                "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH LIKE \"%s%%\"",
+                                "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH LIKE \'%s%%\'",
                                 VIDEO_UTIL_PERSONAL_HEAD_STR);
        }
        if (media_filter_set_condition
@@ -1964,7 +2031,7 @@ void mp_util_svc_update_thumbnail_info(const int nVideoItemIndex)
 
        memset(szTmpStr, 0, STR_LEN_MAX);
        snprintf(szTmpStr, STR_LEN_MAX,
-                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101 OR MEDIA_STORAGE_TYPE=121) AND MEDIA_PATH = \"%s\"",
+                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101 OR MEDIA_STORAGE_TYPE=121) AND MEDIA_PATH = \'%s\'",
                         szMediaUri);
        if (media_filter_set_condition
                (m_FilterHandle, szTmpStr,
@@ -2357,7 +2424,7 @@ bool mp_util_svc_get_video_detail_by_video_url(const char *szPath,
        }
 
        snprintf(szTmpStr, STR_LEN_MAX,
-                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101 OR MEDIA_STORAGE_TYPE=121) AND MEDIA_PATH = \"%s\"",
+                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2 OR MEDIA_STORAGE_TYPE=101 OR MEDIA_STORAGE_TYPE=121) AND MEDIA_PATH = \'%s\'",
                         szPath);
        if (media_filter_set_condition
                (m_FilterHandle, szTmpStr,
@@ -2488,11 +2555,11 @@ bool mp_util_svc_extract_video_list_from_folder_by_personal(char
        case MP_LIST_VIEW_ALL:
                if (nViewType == 0) {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \"%s\" and MEDIA_PATH NOT LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \'%s\' and MEDIA_PATH NOT LIKE \'%s%%\'",
                                         szFolderPath, VIDEO_UTIL_PERSONAL_HEAD_STR);
                } else {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \"%s\" and MEDIA_PATH LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \'%s\' and MEDIA_PATH LIKE \'%s%%\'",
                                         szFolderPath, VIDEO_UTIL_PERSONAL_HEAD_STR);
                }
                break;
@@ -2500,11 +2567,11 @@ bool mp_util_svc_extract_video_list_from_folder_by_personal(char
        case MP_LIST_VIEW_PHONE:
                if (nViewType == 0) {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 and (MEDIA_STORAGE_TYPE = 0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \"%s\" and MEDIA_PATH NOT LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 and (MEDIA_STORAGE_TYPE = 0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \'%s\' and MEDIA_PATH NOT LIKE \'%s%%\'",
                                         szFolderPath, VIDEO_UTIL_PERSONAL_HEAD_STR);
                } else {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 and (MEDIA_STORAGE_TYPE = 0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \"%s\" and MEDIA_PATH LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 and (MEDIA_STORAGE_TYPE = 0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \'%s\' and MEDIA_PATH LIKE \'%s%%\'",
                                         szFolderPath, VIDEO_UTIL_PERSONAL_HEAD_STR);
                }
                break;
@@ -2512,11 +2579,11 @@ bool mp_util_svc_extract_video_list_from_folder_by_personal(char
        case MP_LIST_VIEW_CLOUD:
                if (nViewType == 0) {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \"%s\" and MEDIA_PATH NOT LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \'%s\' and MEDIA_PATH NOT LIKE \'%s%%\'",
                                         szFolderPath, VIDEO_UTIL_PERSONAL_HEAD_STR);
                } else {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \"%s\" and MEDIA_PATH LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \'%s\' and MEDIA_PATH LIKE \'%s%%\'",
                                         szFolderPath, VIDEO_UTIL_PERSONAL_HEAD_STR);
                }
                break;
@@ -2524,11 +2591,11 @@ bool mp_util_svc_extract_video_list_from_folder_by_personal(char
        default:
                if (nViewType == 0) {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \"%s\" and MEDIA_PATH NOT LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \'%s\' and MEDIA_PATH NOT LIKE \'%s%%\'",
                                         szFolderPath, VIDEO_UTIL_PERSONAL_HEAD_STR);
                } else {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \"%s\" and MEDIA_PATH LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and FOLDER_PATH = \'%s\' and MEDIA_PATH LIKE \'%s%%\'",
                                         szFolderPath, VIDEO_UTIL_PERSONAL_HEAD_STR);
                }
                break;
@@ -2672,11 +2739,11 @@ bool mp_util_svc_extract_video_list_by_personal(int nSortType,
        case MP_LIST_VIEW_ALL:
                if (nViewType == 0) {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH NOT LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH NOT LIKE \'%s%%\'",
                                         VIDEO_UTIL_PERSONAL_HEAD_STR);
                } else {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH LIKE \'%s%%\'",
                                         VIDEO_UTIL_PERSONAL_HEAD_STR);
                }
                break;
@@ -2684,11 +2751,11 @@ bool mp_util_svc_extract_video_list_by_personal(int nSortType,
        case MP_LIST_VIEW_PHONE:
                if (nViewType == 0) {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 and (MEDIA_STORAGE_TYPE = 0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH NOT LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 and (MEDIA_STORAGE_TYPE = 0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH NOT LIKE \'%s%%\'",
                                         VIDEO_UTIL_PERSONAL_HEAD_STR);
                } else {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 and (MEDIA_STORAGE_TYPE = 0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 and (MEDIA_STORAGE_TYPE = 0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH LIKE \'%s%%\'",
                                         VIDEO_UTIL_PERSONAL_HEAD_STR);
                }
 
@@ -2697,11 +2764,11 @@ bool mp_util_svc_extract_video_list_by_personal(int nSortType,
        case MP_LIST_VIEW_CLOUD:
                if (nViewType == 0) {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH NOT LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH NOT LIKE \'%s%%\'",
                                         VIDEO_UTIL_PERSONAL_HEAD_STR);
                } else {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH LIKE \'%s%%\'",
                                         VIDEO_UTIL_PERSONAL_HEAD_STR);
                }
 
@@ -2710,11 +2777,11 @@ bool mp_util_svc_extract_video_list_by_personal(int nSortType,
        default:
                if (nViewType == 0) {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH NOT LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH NOT LIKE \'%s%%\'",
                                         VIDEO_UTIL_PERSONAL_HEAD_STR);
                } else {
                        snprintf(szTmpStr, STR_LEN_MAX,
-                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH LIKE \"%s%%\"",
+                                        "MEDIA_TYPE = 1 AND (MEDIA_STORAGE_TYPE=0 OR MEDIA_STORAGE_TYPE=1 OR MEDIA_STORAGE_TYPE=2) and MEDIA_PATH LIKE \'%s%%\'",
                                         VIDEO_UTIL_PERSONAL_HEAD_STR);
                }
                break;
index 0af492df6e26569051ad7b2b7485307046ecf2e1..f287773333909c9daf332505362ff5710ca88c54 100755 (executable)
@@ -18,6 +18,7 @@
 #include <app.h>
 #include <glib.h>
 #include <system_settings.h>
+#include "vp-playtime-db.h"
 #include "video-player.h"
 #include "videos-view-mgr.h"
 #include "mp-util.h"
@@ -36,6 +37,8 @@ static bool appCreate(void *pUserData)
 {
        VideoLogWarning("== APP CREATE ==");
 
+       vp_playtime_db_create();
+
        return TRUE;
 }
 
index f4eb6bb5bddbe68822847bc15613da767cdaf717..d74210f2dab363e95f55933c9a09c8ba9a8163ef 100755 (executable)
@@ -19,6 +19,8 @@
 #include <Elementary.h>
 #include <glib.h>
 
+#include "vp-file-util.h"
+#include "vp-playtime-db.h"
 #include "mp-util.h"
 #include "mp-video-log.h"
 #include "mp-external-ug.h"
 #include "mp-video-list-view-item-of-folder.h"
 #include "mp-video-util-db-controller.h"
 #include "mp-util-widget-ctrl.h"
-#include "vp-file-util.h"
 #include "mp-rotate-ctrl.h"
 #include "videos-view-mgr.h"
 #include "mp-video-list-view-main.h"
 
+
 #define VIDEO_SELECTED_INFO_TIMER              4.0
 #define GENGRID_ITEM_WIDTH                             304  // Width is  ICON(280) + LEFT_PADDING(12)  RIGHT_PADDING(12)
 #define GENGRID_ITEM_HEIGHT                            256  //Height is ICON(160) + TEXT_PART(56) + Bottom_PADDING(40)
@@ -884,6 +886,40 @@ static Evas_Object *__mp_remove_folder_view_get_grid_icon_cb(void *pUserData, Ev
        return NULL;
 }
 
+static int __mp_remove_view_sqlite_table_data_cb(void *user_data, int count, char **col_data, char **colums) {
+               stGengridItemData *item_data = (stGengridItemData*)user_data;
+               if(item_data == NULL ) {
+                       VideoLogError("Item data is invalid");
+                       return 0;
+               }
+               VideoLogInfo("Search Set Count : %d [Must not greater than one]", count);
+               for(int i = 0; i<count; ++i) {
+                       VideoLogDebug("SQL Search Set[%d] ==> [Col: %s] [Data: %s]", i, colums[i], col_data[i]);
+                       int total_duration = mp_util_svc_get_video_duration_time(item_data->itemIndex);
+                       if(col_data[i]) {
+                               int current_duration = atoi(col_data[i]);
+                               if(current_duration > 0 && total_duration > 0 && current_duration <= total_duration) {
+                                       double progress = ((double)current_duration/(double)total_duration);
+                                       edje_object_part_drag_value_set(elm_layout_edje_get(item_data->progress_layout), "elm.cur.progressbar", progress, 0.0);
+                               }
+                       }
+               }
+               //always return zero , otherwise sqlite3_exec will abort the subsequent statements
+               return 0;
+}
+static void __mp_remove_view_set_playback_progress(int videoIndex, void *data)
+{
+       char *url = mp_util_svc_get_video_url(videoIndex);
+       if(url == NULL) {
+               VideoLogError("Failed to get url");
+               return;
+       }
+       vp_playtime_db_get_progress((const char*)url, __mp_remove_view_sqlite_table_data_cb, data);
+       free(url);
+       url = NULL;
+}
+
+
 /**
  *
  * @param pUserData
@@ -939,10 +975,11 @@ static Evas_Object *__mp_remove_view_get_grid_icon_cb(void *pUserData, Evas_Obje
                VideoLogInfo("layout file set %s %s",(ret? "Successful": "Failed"), pPart);
                evas_object_size_hint_weight_set(progessbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
                evas_object_size_hint_align_set(progessbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
-               double value = (((double) rand() ) / RAND_MAX );
-               edje_object_part_drag_value_set(elm_layout_edje_get(progessbar), "elm.cur.progressbar", value, 0.0);
-               //__mp_thumbnail_view_get_playback_progress(nVideoItemIndex);
+               edje_object_part_drag_value_set(elm_layout_edje_get(progessbar), "elm.cur.progressbar", 0.0, 0.0);
                item_data->progress_layout = progessbar;
+
+               __mp_remove_view_set_playback_progress(nVideoItemIndex, item_data);
+
                return progessbar;
        }
        else if(!strcmp(pPart, "elm.check"))
index 9ba6f76d78e4bbf8a31853d1626b1fb46a9151e9..ea753a245efcbafd59b5e44fdbbdb5f94e742c43 100755 (executable)
@@ -19,8 +19,9 @@
 #include <Elementary.h>
 #include <glib.h>
 
-#include "mp-util.h"
+#include "vp-playtime-db.h"
 #include "vp-file-util.h"
+#include "mp-util.h"
 #include "mp-video-log.h"
 #include "mp-external-ug.h"
 #include "mp-video-string-define.h"
@@ -899,6 +900,41 @@ static char *__mp_share_view_get_label_of_grid_item_cb(void
 #endif
 
 #ifdef VS_FEATURE_THUMBNAIL_VIEW
+
+static int __mp_share_view_sqlite_table_data_cb(void *user_data, int count, char **col_data, char **colums) {
+               stGengridItemData *item_data = (stGengridItemData*)user_data;
+               if(item_data == NULL ) {
+                       VideoLogError("Item data is invalid");
+                       return 0;
+               }
+               VideoLogInfo("Search Set Count : %d [Must not greater than one]", count);
+               for(int i = 0; i<count; ++i) {
+                       VideoLogDebug("SQL Search Set[%d] ==> [Col: %s] [Data: %s]", i, colums[i], col_data[i]);
+                       int total_duration = mp_util_svc_get_video_duration_time(item_data->itemIndex);
+                       if(col_data[i]) {
+                               int current_duration = atoi(col_data[i]);
+                               if(current_duration > 0 && total_duration > 0 && current_duration <= total_duration) {
+                                       double progress = ((double)current_duration/(double)total_duration);
+                                       edje_object_part_drag_value_set(elm_layout_edje_get(item_data->progress_layout), "elm.cur.progressbar", progress, 0.0);
+                               }
+                       }
+               }
+               //always return zero , otherwise sqlite3_exec will abort the subsequent statements
+               return 0;
+}
+static void __mp_share_view_set_playback_progress(int videoIndex, void *data)
+{
+       char *url = mp_util_svc_get_video_url(videoIndex);
+       if(url == NULL) {
+               VideoLogError("Failed to get url");
+               return;
+       }
+       vp_playtime_db_get_progress((const char*)url, __mp_share_view_sqlite_table_data_cb, data);
+       free(url);
+       url = NULL;
+}
+
+
 /**
  *
  * @param pUserData
@@ -955,10 +991,11 @@ static Evas_Object *__mp_share_view_get_grid_icon_cb(void *pUserData,
                VideoLogInfo("layout file set %s %s",(ret? "Successful": "Failed"), pPart);
                evas_object_size_hint_weight_set(progessbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
                evas_object_size_hint_align_set(progessbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
-               double value = (((double) rand() ) / RAND_MAX );
-               edje_object_part_drag_value_set(elm_layout_edje_get(progessbar), "elm.cur.progressbar", value, 0.0);
-               //__mp_thumbnail_view_get_playback_progress(nVideoItemIndex);
+               edje_object_part_drag_value_set(elm_layout_edje_get(progessbar), "elm.cur.progressbar", 0.0, 0.0);
                item_data->progress_layout = progessbar;
+
+               __mp_share_view_set_playback_progress(nVideoItemIndex, item_data);
+
                return progessbar;
        }
        else if(!strcmp(pPart, "elm.check"))
index 256a4dfd7168f21fa2a970045f20cded3c787d25..526ecc82d54e24f628b77ba77381d8a692e0d4f1 100755 (executable)
@@ -16,6 +16,7 @@
 
 #include <glib.h>
 
+#include "vp-playtime-db.h"
 #include "vp-util.h"
 #include "vp-file-util.h"
 #include "mp-video-log.h"
@@ -252,6 +253,40 @@ static void __mp_folder_item_view_delete_btn_cb(void *pUserData,
 }
 #endif
 
+static int __mp_folder_item_view_sqlite_table_data_cb(void *user_data, int count, char **col_data, char **colums) {
+               stGengridItemData *item_data = (stGengridItemData*)user_data;
+               if(item_data == NULL ) {
+                       VideoLogError("Item data is invalid");
+                       return 0;
+               }
+               VideoLogInfo("Search Set Count : %d [Must not be greater than one]", count);
+               for(int i = 0; i<count; ++i) {
+                       VideoLogDebug("SQL Search Set[%d] ==> [Col: %s] [Data: %s]", i, colums[i], col_data[i]);
+                       int total_duration = mp_util_svc_get_video_duration_time(item_data->videoIndex);
+                       if(col_data[i]) {
+                               int current_duration = atoi(col_data[i]);
+                               if(current_duration > 0 && total_duration > 0 && current_duration <= total_duration) {
+                                       double progress = ((double)current_duration/(double)total_duration);
+                                       edje_object_part_drag_value_set(elm_layout_edje_get(item_data->progress_layout), "elm.cur.progressbar", progress, 0.0);
+                               }
+                       }
+               }
+               //always return zero , otherwise sqlite3_exec will abort the subsequent statements
+               return 0;
+}
+static void __mp_folder_item_view_set_playback_progress(int videoIndex, void *data)
+{
+       char *url = mp_util_svc_get_video_url(videoIndex);
+       if(url == NULL) {
+               VideoLogError("Failed to get url");
+               return;
+       }
+       vp_playtime_db_get_progress((const char*)url, __mp_folder_item_view_sqlite_table_data_cb, data);
+       free(url);
+       url = NULL;
+}
+
+
 /**
  *
  * @param pUserData
@@ -315,11 +350,10 @@ Evas_Object *__mp_folder_item_view_get_icon_of_video_item_cb(void
                VideoLogInfo("layout file set %s %s",(ret? "Successful": "Failed"), pPart);
                evas_object_size_hint_weight_set(progessbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
                evas_object_size_hint_align_set(progessbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
-               // TO DO: remove this once we are able to get the elapsed time for video file.
-               double value = (((double) rand() ) / RAND_MAX );
-               edje_object_part_drag_value_set(elm_layout_edje_get(progessbar), "elm.cur.progressbar", value, 0.0);
-               //__mp_thumbnail_view_get_playback_progress(nVideoItemIndex);
+               edje_object_part_drag_value_set(elm_layout_edje_get(progessbar), "elm.cur.progressbar", 0.0, 0.0);
                item_data->progress_layout = progessbar;
+
+               __mp_folder_item_view_set_playback_progress(nVideoItemIndex, item_data);
                return progessbar;
        }
        return NULL;
@@ -1449,18 +1483,19 @@ static void __mp_folder_item_view_soft_back_button_cb(void *data, Evas_Object *
        elm_naviframe_item_pop(g_pFolderViewHandle->pNaviFrameHandle);
 }
 
-static void __mp_folder_item_view_back_button_cb(void *data, Elm_Object_Item *item)
+static Eina_Bool  __mp_folder_item_view_back_button_cb(void *data, Elm_Object_Item *item)
 {
        if(g_pFolderViewHandle == NULL)
        {
                VideoLogError("g_pFolderViewHandle is invalid");
-               return;
+               return EINA_FALSE;
        }
        VideoLogInfo("");
        g_pFolderViewHandle->bExist = true;
        mp_folder_view_set_is_item_view(false);
        evas_object_smart_callback_add(g_pFolderViewHandle->pNaviFrameHandle, "transition,finished", __mp_folder_item_view_trans_finished_cb, NULL);
        mp_folder_item_view_pop();
+       return EINA_TRUE;
 }
 
 static Evas_Object* _create_gengrid(Evas_Object *parent)
index dce12d156e966474dc78b0f6979e4e00fb0fba3a..935f6c111b6fe7ebbafc67ae696b70cf2688c216 100755 (executable)
@@ -21,7 +21,7 @@
 #include <stdbool.h>
 #include <media_content.h>
 
-
+#include "vp-playtime-db.h"
 #include "mp-util.h"
 #include "vp-util.h"
 #include "mp-video-log.h"
@@ -64,6 +64,7 @@
 #include "mp-util-config.h"
 
 
+
 #define TOOLBAR_BUTTON_VIDEOS "Videos"
 #define TOOLBAR_BUTTOn_FOLDERS "Folders"
 
@@ -692,6 +693,64 @@ static void __mp_list_view_result_view_update_cb(void)
 
 }
 
+static int __mp_list_view_playtime_db_select_all_cb(void *user_data, int count, char **data, char **colums) {
+       Eina_List **list = (Eina_List **)user_data;
+       for(int i = 0; i<count; ++i) {
+               if(data[i]) {
+                       *list = eina_list_append(*list, strdup(data[i]));
+               }
+       }
+       return 0;
+}
+
+static void __mp_list_view_playtime_db_update() {
+       // Get url list from playtime db
+       Eina_List *playdb_url_list = NULL;
+       int ret = vp_playtime_db_select_all(__mp_list_view_playtime_db_select_all_cb, &playdb_url_list);
+
+       // Get url list from media db
+       Eina_List *mediadb_url_list = NULL;
+       mp_util_svc_extract_video_url_by_item_type(&mediadb_url_list);
+
+       // we need to remove enty which are not present in media db but present in playdb
+       // this can happened when an item is deleted or an external media device e.g usb etc is unplugged
+       // in that case media file which are no longer available needs to remove from play db
+       // we do this by comparing the media db list and play time list
+       // we remove the url that are present in playtime db but not in media db.
+       // this is kind of brute force :).so if you have any optimization than update this implementation.
+
+       Eina_List *playdb_l = NULL;
+       Eina_List *playdb_next = NULL;
+       char      *playdb_data = NULL;
+       EINA_LIST_FOREACH_SAFE(playdb_url_list, playdb_l, playdb_next, playdb_data)
+       {
+
+               Eina_List *mediadb_l = NULL, *mediadb_next = NULL;
+               char *mediadb_data = NULL;
+               EINA_LIST_FOREACH_SAFE(mediadb_url_list, mediadb_l, mediadb_next, mediadb_data)
+               {
+                       if(strcmp(playdb_data, mediadb_data) == 0) {
+                               free(mediadb_data);
+                               mediadb_url_list = eina_list_remove_list(mediadb_url_list, mediadb_l);
+                               free(playdb_data);
+                               playdb_url_list = eina_list_remove_list(playdb_url_list, playdb_l);
+                               break;
+                       }
+               }
+       }
+
+       // Free the remaing list
+       char *data = NULL;
+       EINA_LIST_FREE(mediadb_url_list, data) {
+                       free(data);
+       }
+
+       // this will be freed while removing url from db
+       if(eina_list_count(playdb_url_list) > 0) {
+               vp_playtime_db_remove_entries(playdb_url_list);
+       }
+}
+
 /**
  *
  * @param nUpdateStyle
@@ -705,6 +764,10 @@ static void __mp_list_view_db_update(int nUpdateStyle)
        }
 
        mp_util_db_run_backup_fun_except_lev0(NULL, NULL, NULL, NULL);
+
+       // Update playtime db before update list so that , it will reflect the updated progress.
+       __mp_list_view_playtime_db_update();
+
        __mp_list_view_update_list(g_pMainViewHandle->nListTabType,
                                                           LIST_UPDATE_TYPE_ALL);
 
index 986ef4f1648add5baba6c3a68b6e6f0a61f04ac8..8ebf8a19bb86f53817aefbbbbf639027f58e6439 100755 (executable)
@@ -22,7 +22,7 @@
 #include <Ecore_Evas.h>
 #include <Elementary.h>
 
-#include "vp-play-log.h"
+#include "vp-playtime-db.h"
 #include "vp-util.h"
 #include "vp-file-util.h"
 #include "vp-pinch-zoom.h"
@@ -296,7 +296,6 @@ bool mp_thumbnail_view_arrange_list_item(void *pMainViewHandle,
                                                                                 UpdateListItemsCbFunc
                                                                                 pUpdateVideoListUserCb)
 {
-       srand((unsigned int)time(NULL));
        VideoLogInfo("");
 
        if (!pMainViewHandle || !pMainViewWidget || !pUpdateVideoListUserCb) {
@@ -821,12 +820,7 @@ static void __mp_thumbnail_view_gengrid_realize_cb(void *pUserData,
  * @param pPart
  * @return
  */
-static char *__mp_thumbnail_view_get_label_of_grid_item_cb(const void
-                                                                                                                  *pUserData,
-                                                                                                                  Evas_Object *
-                                                                                                                  pObject,
-                                                                                                                  const char
-                                                                                                                  *pPart)
+static char *__mp_thumbnail_view_get_label_of_grid_item_cb(void *pUserData, Evas_Object *pObject, const char *pPart)
 {
        const stGengridItemData *item_data =  pUserData;
        int nVideoItemIndex = item_data->videoIndex;
@@ -848,17 +842,38 @@ static char *__mp_thumbnail_view_get_label_of_grid_item_cb(const void
        return NULL;
 }
 
-// static double __mp_thumbnail_view_get_playback_progress(int videoIndex)
-// {
-       // char *path = mp_util_svc_get_video_url(videoIndex);
-       // int width = 0, height  = 0;
-       // unsigned int duration = 0, playedtime = 0;
-       // char *title = NULL;
-       // mp_util_svc_get_video_detail_by_video_url((const char*)path, &width, &height, &title, &duration, &playedtime);
-       // VideoLogInfo(" =====> VideoURL : %s", path);
-       // VideoLogInfo(" =====> [W: %d] [H: %d] [Title: %s]", width, height, title);
-       // VideoLogInfo(" =====>  [Dur: %u] [ELA: %U] ", duration, playedtime);
-// }
+static int __mp_thumbnail_view_sqlite_table_data_cb(void *user_data, int count, char **col_data, char **colums) {
+               stGengridItemData *item_data = (stGengridItemData*)user_data;
+               if(item_data == NULL ) {
+                       VideoLogError("Item data is invalid");
+                       return 0;
+               }
+               VideoLogInfo("Search Set Count : %d [Must not greater than one]", count);
+               for(int i = 0; i<count; ++i) {
+                       VideoLogDebug("SQL Search Set[%d] ==> [Col: %s] [Data: %s]", i, colums[i], col_data[i]);
+                       int total_duration = mp_util_svc_get_video_duration_time(item_data->videoIndex);
+                       if(col_data[i]) {
+                               int current_duration = atoi(col_data[i]);
+                               if(current_duration > 0 && total_duration > 0 && current_duration <= total_duration) {
+                                       double progress = ((double)current_duration/(double)total_duration);
+                                       edje_object_part_drag_value_set(elm_layout_edje_get(item_data->progress_layout), "elm.cur.progressbar", progress, 0.0);
+                               }
+                       }
+               }
+               //always return zero , otherwise sqlite3_exec will abort the subsequent statements
+               return 0;
+}
+static void __mp_thumbnail_view_set_playback_progress(int videoIndex, void *data)
+{
+       char *url = mp_util_svc_get_video_url(videoIndex);
+       if(url == NULL) {
+               VideoLogError("Failed to get url");
+               return;
+       }
+       vp_playtime_db_get_progress((const char*)url, __mp_thumbnail_view_sqlite_table_data_cb, data);
+       free(url);
+       url = NULL;
+}
 
 /**
  *
@@ -867,9 +882,7 @@ static char *__mp_thumbnail_view_get_label_of_grid_item_cb(const void
  * @param pPart
  * @return
  */
-static Evas_Object *__mp_thumbnail_view_get_grid_icon_cb(const void *pUserData,
-                                                               Evas_Object *pObject,
-                                                               const char *pPart)
+static Evas_Object *__mp_thumbnail_view_get_grid_icon_cb(void *pUserData, Evas_Object *pObject, const char *pPart)
 {
        stGengridItemData *item_data = (void*)pUserData;
        int nVideoItemIndex = item_data->videoIndex;
@@ -913,10 +926,11 @@ static Evas_Object *__mp_thumbnail_view_get_grid_icon_cb(const void *pUserData,
                VideoLogInfo("layout file set %s %s",(ret? "Successful": "Failed"), pPart);
                evas_object_size_hint_weight_set(progessbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
                evas_object_size_hint_align_set(progessbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
-               double value = (((double) rand() ) / RAND_MAX );
-               edje_object_part_drag_value_set(elm_layout_edje_get(progessbar), "elm.cur.progressbar", value, 0.0);
-               //__mp_thumbnail_view_get_playback_progress(nVideoItemIndex);
+               edje_object_part_drag_value_set(elm_layout_edje_get(progessbar), "elm.cur.progressbar", 0.0, 0.0);
                item_data->progress_layout = progessbar;
+
+               __mp_thumbnail_view_set_playback_progress(nVideoItemIndex, item_data);
+
                return progessbar;
        }
        return NULL;
@@ -1015,10 +1029,8 @@ static void __mp_thumbnail_view_append_gengrid_items(Evas_Object *pGengrid)
        {
                g_pThumbnailView->pVideolistGIC = elm_gengrid_item_class_new();
                g_pThumbnailView->pVideolistGIC->item_style = "videolist";
-               g_pThumbnailView->pVideolistGIC->func.text_get =
-                       (void *) __mp_thumbnail_view_get_label_of_grid_item_cb;
-               g_pThumbnailView->pVideolistGIC->func.content_get =
-                       (void *) __mp_thumbnail_view_get_grid_icon_cb;
+               g_pThumbnailView->pVideolistGIC->func.text_get = __mp_thumbnail_view_get_label_of_grid_item_cb;
+               g_pThumbnailView->pVideolistGIC->func.content_get = __mp_thumbnail_view_get_grid_icon_cb;
                g_pThumbnailView->pVideolistGIC->func.state_get = NULL;
                g_pThumbnailView->pVideolistGIC->func.del = NULL;
        }
index 176e77a8c24c6023f134841daa27d00cd232a7ec..080402523bf1985f1e1377e96726e20e4343b82a 100755 (executable)
@@ -9,7 +9,7 @@ type = app
 profile = mobile-3.0
 
 # C Sources
-USER_SRCS = src/serviceParser/vp-service-parser.c src/vp-main.c ../playview/src/core/vp-media-key.c ../src/view/mp-library-view-mgr.c ../playview/src/feature/vp-subtitle-size.c ../playview/src/feature/vp-share.c ../common/src/vp-pinch-zoom.c ../src/view/mp-video-list-remove-ctrl.c ../playview/src/feature/vp-audio-track.c ../playview/src/widget/vp-play-brightness-popup.c ../src/widget/mp-video-view-popup-ctrl.c ../playview/src/core/vp-image-util.c ../src/widget/mp-external-ug.c ../src/view/mp-video-list-view-common.c ../playview/src/core/vp-multi-path.c ../src/feature/mp-launching-video-displayer.c ../src/view/mp-video-list-view-thumbnail.c ../playview/src/common/vp-play-config.c ../src/view/mp-video-list-personal-view.c ../src/view/mp-video-detail-view.c ../playview/src/feature/vp-sound-alive.c ../src/view/mp-video-list-view-folder.c ../playview/src/vp-play-view.c ../src/view/mp-video-list-view-item-of-folder.c ../playview/src/feature/vp-subtitle-sync.c ../playview/src/feature/vp-sound-path.c ../common/src/vp-media-content-util.c ../playview/src/common/vp-play-preference.c ../playview/src/widget/vp-play-volume-popup.c ../playview/src/core/vp-media-contents.c ../common/src/vp-db-util.c ../src/widget/mp-video-list-option-ctrl.c ../playview/src/feature/vp-repeat.c ../playview/src/core/vp-avrcp.c ../playview/src/feature/vp-subtitle-alignment.c ../playview/src/widget/vp-play-subtitle.c ../common/src/vp-util.c ../src/widget/mp-video-list-sort-ctrl.c ../src/view/mp-video-list-personal-ctrl.c ../common/src/vp-file-util.c ../playview/src/feature/vp-subtitle-bg-color.c ../src/common/mp-util-media-service.c ../playview/src/widget/vp-play-bookmark.c ../playview/src/feature/vp-subtitle-select.c ../src/widget/mp-util-widget-ctrl.c ../playview/src/feature/vp-subtitle-font.c ../common/src/vp-chapter-db.c ../src/view/mp-video-list-view-normal.c ../src/common/mp-util-config.c ../playview/src/common/vp-play-util.c ../playview/src/widget/vp-play-minicontroller.c ../playview/src/widget/vp-play-lockscreenmc.c ../playview/src/widget/vp-play-popup.c ../src/common/mp-rotate-ctrl.c ../src/common/mp-util-preference.c ../playview/src/feature/vp-detail.c ../playview/src/widget/vp-play-progressbar.c ../playview/src/feature/vp-subtitle-edge.c ../src/widget/mp-video-nocontent-layout.c ../src/view/mp-video-list-share-via-view.c ../src/viewMgr/videos-view-mgr.c ../src/widget/mp-footer-toolbar.c ../playview/src/core/vp-sound.c ../playview/src/common/vp-play-ug.c ../playview/src/core/vp-device-language.c ../playview/src/feature/vp-play-speed.c ../src/view/mp-video-list-folder-share-via-view.c ../playview/src/feature/vp-subtitle-track.c ../playview/src/feature/vp-subtitle-color.c ../playview/src/core/vp-hollic.c ../src/view/mp-video-list-view-select.c ../playview/src/core/vp-mm-player.c ../src/view/mp-video-list-remove-view.c ../playview/src/widget/vp-play-volume.c ../playview/src/widget/vp-play-loading-ani.c ../playview/src/view/vp-play-normal-view.c ../playview/src/core/vp-device.c ../src/view/mp-video-list-view-main.c ../playview/src/widget/vp-play-button.c ../playview/src/widget/vp-play-more.c ../src/widget/mp-video-rename-ctrl.c ../common/src/vp-preview-db.c ../src/widget/mp-video-list-view-as-ctrl.c ../src/widget/mp-video-list-auto-play-ctrl.c ../src/feature/mp-util-move.c ../src/view/mp-video-search-view.c ../playview/src/feature/vp-capture.c ../src/common/mp-drm-ctrl.c ../src/common/mp-video-info-ctrl.c ../playview/src/feature/vp-subtitle.c ../src/common/mp-video-util-db-controller.c ../common/src/vp-thumb-db.c ../src/common/mp-util.c ../playview/src/core/vp-sensor.c ../playview/src/feature/vp-zoom-guide.c ../playview/src/feature/vp-setting.c
+USER_SRCS = src/serviceParser/vp-service-parser.c src/vp-main.c ../playview/src/core/vp-media-key.c ../src/view/mp-library-view-mgr.c ../playview/src/feature/vp-subtitle-size.c ../playview/src/feature/vp-share.c ../common/src/vp-pinch-zoom.c ../src/view/mp-video-list-remove-ctrl.c ../playview/src/feature/vp-audio-track.c ../playview/src/widget/vp-play-brightness-popup.c ../src/widget/mp-video-view-popup-ctrl.c ../playview/src/core/vp-image-util.c ../src/widget/mp-external-ug.c ../src/view/mp-video-list-view-common.c ../playview/src/core/vp-multi-path.c ../src/feature/mp-launching-video-displayer.c ../src/view/mp-video-list-view-thumbnail.c ../playview/src/common/vp-play-config.c ../src/view/mp-video-list-personal-view.c ../src/view/mp-video-detail-view.c ../playview/src/feature/vp-sound-alive.c ../src/view/mp-video-list-view-folder.c ../playview/src/vp-play-view.c ../src/view/mp-video-list-view-item-of-folder.c ../playview/src/feature/vp-subtitle-sync.c ../playview/src/feature/vp-sound-path.c ../common/src/vp-media-content-util.c ../playview/src/common/vp-play-preference.c ../playview/src/widget/vp-play-volume-popup.c ../playview/src/core/vp-media-contents.c ../common/src/vp-db-util.c ../src/widget/mp-video-list-option-ctrl.c ../playview/src/feature/vp-repeat.c ../playview/src/core/vp-avrcp.c ../playview/src/feature/vp-subtitle-alignment.c ../playview/src/widget/vp-play-subtitle.c ../common/src/vp-util.c ../src/widget/mp-video-list-sort-ctrl.c ../src/view/mp-video-list-personal-ctrl.c ../common/src/vp-file-util.c ../playview/src/feature/vp-subtitle-bg-color.c ../src/common/mp-util-media-service.c ../playview/src/widget/vp-play-bookmark.c ../playview/src/feature/vp-subtitle-select.c ../src/widget/mp-util-widget-ctrl.c ../playview/src/feature/vp-subtitle-font.c ../common/src/vp-chapter-db.c ../src/view/mp-video-list-view-normal.c ../src/common/mp-util-config.c ../playview/src/common/vp-play-util.c ../playview/src/widget/vp-play-minicontroller.c ../playview/src/widget/vp-play-lockscreenmc.c ../playview/src/widget/vp-play-popup.c ../src/common/mp-rotate-ctrl.c ../src/common/mp-util-preference.c ../playview/src/feature/vp-detail.c ../playview/src/widget/vp-play-progressbar.c ../playview/src/feature/vp-subtitle-edge.c ../src/widget/mp-video-nocontent-layout.c ../src/view/mp-video-list-share-via-view.c ../src/viewMgr/videos-view-mgr.c ../src/widget/mp-footer-toolbar.c ../playview/src/core/vp-sound.c ../playview/src/common/vp-play-ug.c ../playview/src/core/vp-device-language.c ../playview/src/feature/vp-play-speed.c ../src/view/mp-video-list-folder-share-via-view.c ../playview/src/feature/vp-subtitle-track.c ../playview/src/feature/vp-subtitle-color.c ../playview/src/core/vp-hollic.c ../src/view/mp-video-list-view-select.c ../playview/src/core/vp-mm-player.c ../src/view/mp-video-list-remove-view.c ../playview/src/widget/vp-play-volume.c ../playview/src/widget/vp-play-loading-ani.c ../playview/src/view/vp-play-normal-view.c ../playview/src/core/vp-device.c ../src/view/mp-video-list-view-main.c ../playview/src/widget/vp-play-button.c ../playview/src/widget/vp-play-more.c ../src/widget/mp-video-rename-ctrl.c ../common/src/vp-preview-db.c ../src/widget/mp-video-list-view-as-ctrl.c ../src/widget/mp-video-list-auto-play-ctrl.c ../src/feature/mp-util-move.c ../src/view/mp-video-search-view.c ../playview/src/feature/vp-capture.c ../src/common/mp-drm-ctrl.c ../src/common/mp-video-info-ctrl.c ../playview/src/feature/vp-subtitle.c ../src/common/mp-video-util-db-controller.c ../common/src/vp-thumb-db.c ../src/common/mp-util.c ../playview/src/core/vp-sensor.c ../playview/src/feature/vp-zoom-guide.c ../playview/src/feature/vp-setting.c ../common/src/vp-playtime-db.c
 
 # EDC Sources
 USER_EDCS =