From 498fe17d9b8a41a4ed10ccf444cff57156a6aab5 Mon Sep 17 00:00:00 2001 From: "chen89.chen" Date: Fri, 24 Nov 2017 20:36:39 +0800 Subject: [PATCH] add internal storage scan for tv Change-Id: I4fad82d426bb3d543e1ecf62fa4b77491c195364 --- src/scanner-v2/media-scanner-extract-v2.c | 21 +++++++++++---------- src/scanner-v2/media-scanner-scan-v2.c | 2 +- src/server/media-server-main.c | 8 ++++++++ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/scanner-v2/media-scanner-extract-v2.c b/src/scanner-v2/media-scanner-extract-v2.c index cd52eb6..1099277 100755 --- a/src/scanner-v2/media-scanner-extract-v2.c +++ b/src/scanner-v2/media-scanner-extract-v2.c @@ -378,12 +378,19 @@ gboolean msc_storage_extract_thread(void *data) goto NEXT; } MS_DBG_WARN("extract storage_id is [%s], path [%s]", extract_data->storage_id, update_path); - if (!ms_storage_mount_status(update_path)) { - MS_DBG_ERR("%s is unmounted", update_path); - ret = MS_MEDIA_ERR_USB_UNMOUNTED; - msc_remove_extract_request(extract_data); + ret = ms_user_get_storage_type(uid, extract_data->msg, &storage_type); + if (ret != MS_MEDIA_ERR_NONE) { + MS_DBG_ERR("ms_user_get_storage_type failed"); goto NEXT; } + if (storage_type == MS_STORAGE_EXTERNAL_USB) { + if (!ms_storage_mount_status(update_path)) { + MS_DBG_ERR("%s is unmounted", update_path); + ret = MS_MEDIA_ERR_USB_UNMOUNTED; + msc_remove_extract_request(extract_data); + goto NEXT; + } + } ms_set_storage_scan_status(handle, extract_data->storage_id, MEDIA_EXTRACT_PROCESSING, uid); __msc_extract_set_db_status(MS_DB_UPDATING); @@ -407,12 +414,6 @@ gboolean msc_storage_extract_thread(void *data) goto NEXT; } - ret = ms_user_get_storage_type(uid, extract_data->msg, &storage_type); - if (ret != MS_MEDIA_ERR_NONE) { - MS_DBG_ERR("ms_user_get_storage_type failed"); - goto NEXT; - } - /*extract meta*/ ret = __msc_folder_bulk_extract(handle, extract_data->storage_id, storage_type, update_path, scan_type, end_flag, extract_data->pid, uid, &io_err_count, end_flag); MS_DBG_WARN("extract PAUSE"); diff --git a/src/scanner-v2/media-scanner-scan-v2.c b/src/scanner-v2/media-scanner-scan-v2.c index ddddb40..9c7720d 100755 --- a/src/scanner-v2/media-scanner-scan-v2.c +++ b/src/scanner-v2/media-scanner-scan-v2.c @@ -304,7 +304,7 @@ static int __msc_dir_scan_for_folder(void **handle, const char *storage_id, cons if (ms_insert_folder(handle, storage_id, new_start_path, uid) != MS_MEDIA_ERR_NONE) MS_DBG_ERR("insert folder failed"); - MS_DBG_WARN("ms_insert_folder insert path11112222[%s]", new_start_path); + MS_DBG_WARN("ms_insert_folder insert path[%s]", new_start_path); } /*start db update. the number of element in the array , db update is complete.*/ diff --git a/src/server/media-server-main.c b/src/server/media-server-main.c index 7abf776..299cda3 100755 --- a/src/server/media-server-main.c +++ b/src/server/media-server-main.c @@ -791,6 +791,14 @@ static void __ms_check_mediadb(void) if (ms_set_all_storage_validity(db_handle, 0, uid) != MS_MEDIA_ERR_NONE) MS_DBG_ERR("ms_set_all_storage_validity fail"); +#ifdef _USE_TVPD_MODE +/* auto scan tv interal storage */ + char *internal_path = NULL; + ms_sys_get_uid(&uid); + ms_user_get_internal_root_path(uid, &internal_path); + ms_send_storage_scan_request(internal_path, INTERNAL_STORAGE_ID, MS_SCAN_PART, uid); +#endif + #ifdef _USE_SENIOR_MODE if (ms_is_support_senior_mode()) ms_send_storage_scan_request_senior_mode(db_handle); -- 2.7.4