Add to scan dcm after media scanning was done
[platform/core/multimedia/libmedia-service.git] / plugin / media-content-plugin.c
index aaef050..cece7d4 100755 (executable)
@@ -23,6 +23,7 @@
 #include <sys/stat.h>
 #include <mm_file.h>
 #include <media-thumbnail.h>
+#include <media-util.h>
 #include "media-svc.h"
 #include "media-svc-util.h"
 
@@ -461,6 +462,12 @@ int update_end(const char *start_path, uid_t uid)
                return MEDIA_SVC_PLUGIN_ERROR;
        }
 #endif
+       int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
+
+       ret = dcm_svc_request_extract_all(uid);
+       if (ret < 0) {
+               return MEDIA_SVC_PLUGIN_ERROR;
+       }
        return MEDIA_SVC_PLUGIN_ERROR_NONE;
 }
 
@@ -510,7 +517,7 @@ int count_delete_items_in_folder(void *handle, const char *storage_id, const cha
        return MEDIA_SVC_PLUGIN_ERROR_NONE;
 }
 
-int check_db(void *handle, bool *need_full_scan, uid_t uid, char **err_msg)
+int check_db(void *handle, uid_t uid, char **err_msg)
 {
        int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
        int user_version = -1;
@@ -530,7 +537,7 @@ int check_db(void *handle, bool *need_full_scan, uid_t uid, char **err_msg)
                }
        } else {
                /*check db version*/
-               ret = media_svc_check_db_upgrade(handle, need_full_scan, user_version, uid);
+               ret = media_svc_check_db_upgrade(handle, user_version, uid);
                if (ret < 0) {
                        __set_error_message(ret, err_msg);
                        return MEDIA_SVC_PLUGIN_ERROR;
@@ -841,7 +848,7 @@ int update_item_end(void *handle, uid_t uid, char **err_msg)
        return MEDIA_SVC_PLUGIN_ERROR_NONE;
 }
 
-int update_item_meta(void *handle, const char *file_path, int storage_type, uid_t uid, char **err_msg)
+int update_item_meta(void *handle, const char *file_path, const char *storage_id, int storage_type, uid_t uid, char **err_msg)
 {
        int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
 
@@ -855,7 +862,12 @@ int update_item_meta(void *handle, const char *file_path, int storage_type, uid_
                return MEDIA_SVC_PLUGIN_ERROR;
        }
 
-       ret = media_svc_update_item_meta(handle, file_path, storage_type, uid);
+       if (storage_id == NULL) {
+               __set_error_message(ERR_HANDLE, err_msg);
+               return MEDIA_SVC_PLUGIN_ERROR;
+       }
+
+       ret = media_svc_update_item_meta(handle, file_path, storage_id, storage_type, uid);
        if (ret < 0) {
                __set_error_message(ret, err_msg);
                return MEDIA_SVC_PLUGIN_ERROR;
@@ -1005,13 +1017,13 @@ int get_folder_scan_status(void *handle, const char *storage_id, const char *pat
        int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
        int storage_status = 0;
 
-       if(handle == NULL) {
+       if (handle == NULL) {
                __set_error_message(ERR_HANDLE, err_msg);
                return MEDIA_SVC_PLUGIN_ERROR;
        }
 
        ret = media_svc_get_folder_scan_status(handle, storage_id, path, &storage_status);
-       if(ret < 0) {
+       if (ret < 0) {
                __set_error_message(ret, err_msg);
                return MEDIA_SVC_PLUGIN_ERROR;
        }
@@ -1027,7 +1039,7 @@ int set_folder_scan_status(void *handle, const char *storage_id, const char *pat
        int storage_status = status;
 
        ret = media_svc_set_folder_scan_status(storage_id, path, storage_status, uid);
-       if(ret < 0) {
+       if (ret < 0) {
                __set_error_message(ret, err_msg);
                return MEDIA_SVC_PLUGIN_ERROR;
        }
@@ -1040,7 +1052,7 @@ int check_folder_modified(void *handle, const char *path, const char *storage_id
        int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
        *modified = TRUE;
 
-       if(handle == NULL) {
+       if (handle == NULL) {
                __set_error_message(ERR_HANDLE, err_msg);
                return MEDIA_SVC_PLUGIN_ERROR;
        }
@@ -1063,18 +1075,18 @@ int get_null_scan_folder_list(void *handle, const char *storage_id, const char *
 {
        int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
 
-       if(handle == NULL) {
+       if (handle == NULL) {
                __set_error_message(ERR_HANDLE, err_msg);
                return MEDIA_SVC_PLUGIN_ERROR;
        }
 
-       if(count == NULL) {
+       if (count == NULL) {
                __set_error_message(ERR_HANDLE, err_msg);
                return MEDIA_SVC_PLUGIN_ERROR;
        }
 
        ret = media_svc_get_null_scan_folder_list(handle, storage_id, folder_path, folder_list, count);
-       if(ret < 0) {
+       if (ret < 0) {
                __set_error_message(ret, err_msg);
                return MEDIA_SVC_PLUGIN_ERROR;
        }
@@ -1087,7 +1099,7 @@ int change_validity_item_batch(void **handle, const char *storage_id, const char
        int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
 
        ret = media_svc_change_validity_item_batch(storage_id, path, des_validity, src_validity, uid);
-       if(ret < 0) {
+       if (ret < 0) {
                __set_error_message(ret, err_msg);
                return MEDIA_SVC_PLUGIN_ERROR;
        }
@@ -1131,7 +1143,7 @@ int check_folder_exist(void * handle, const char *storage_id, const char *folder
        return MEDIA_SVC_PLUGIN_ERROR_NONE;
 }
 
-int count_subfolder(void * handle, const char *storage_id, const char *folder_path, int *count, char **err_msg)
+int count_subfolder(void *handle, const char *storage_id, const char *folder_path, int *count, char **err_msg)
 {
        int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
        int cnt = 0;