Folder related functions cleanup
[platform/core/multimedia/libmedia-service.git] / plugin / media-content-plugin.c
index 40281ec..1a6cbd9 100755 (executable)
@@ -31,9 +31,9 @@ int cleanup_db(sqlite3 *handle, uid_t uid)
        return MS_MEDIA_ERR_NONE;
 }
 
-int insert_item_begin(int item_cnt, int with_noti, int from_pid)
+int insert_item_begin(int item_cnt, bool with_noti, int from_pid)
 {
-       return media_svc_insert_item_begin(item_cnt, with_noti, from_pid);
+       return media_svc_insert_item_begin(with_noti, from_pid);
 }
 
 int insert_item_end(uid_t uid)
@@ -46,39 +46,26 @@ int insert_item(sqlite3 *handle, const char *storage_id, const char *file_path,
        return media_svc_insert_item_bulk(handle, storage_id, storage_type, file_path, uid);
 }
 
-int set_folder_item_validity(sqlite3 *handle, const char *storage_id, const char *folder_path, int validity, int recursive, uid_t uid)
-{
-       return media_svc_set_folder_items_validity(handle, storage_id, folder_path, validity, recursive, uid);
-}
-
 int set_item_validity_begin(int item_cnt)
 {
-       return media_svc_set_item_validity_begin(item_cnt);
+       /* No more need in v1 */
+       return MS_MEDIA_ERR_NONE;
 }
 
 int set_item_validity_end(uid_t uid)
 {
-       return media_svc_set_item_validity_end(uid);
+       /* No more need in v1 */
+       return MS_MEDIA_ERR_NONE;
 }
 
 int set_item_validity(const char *storage_id, const char *file_path, int storage_type, int validity, uid_t uid)
 {
-       return media_svc_set_item_validity(storage_id, file_path, validity, uid);
+       return media_svc_set_item_validity(file_path, validity, uid);
 }
 
-int delete_item(sqlite3 *handle, const char *storage_id, const char *file_path, uid_t uid)
+int send_dir_update_noti(const char *dir_path, const char *folder_id, int update_type, int pid)
 {
-       return media_svc_delete_item_by_path(handle, storage_id, file_path, uid);
-}
-
-int delete_all_invalid_items_in_storage(sqlite3 *handle, const char *storage_id, int storage_type, uid_t uid)
-{
-       return media_svc_delete_invalid_items_in_storage(handle, storage_id, storage_type, uid);
-}
-
-int send_dir_update_noti(sqlite3 *handle, const char *storage_id, const char *dir_path, const char *folder_id, int update_type, int pid)
-{
-       return media_svc_send_dir_update_noti(handle, storage_id, dir_path, folder_id, (media_item_update_type_e)update_type, pid);
+       return media_svc_send_dir_update_noti(dir_path, folder_id, (media_item_update_type_e)update_type, pid);
 }
 
 int check_db(sqlite3 *handle, uid_t uid)
@@ -106,12 +93,13 @@ int update_folder_time(sqlite3 *handle, const char *storage_id, char *folder_pat
 
 int get_uuid(char **uuid)
 {
-       return media_svc_generate_uuid(uuid);
+       /* For scanner V2 */
+       return MS_MEDIA_ERR_NONE;
 }
 
 int check_storage(sqlite3 *handle, const char *storage_id, char **storage_path, int *validity, uid_t uid)
 {
-       return media_svc_check_storage(handle, storage_id, storage_path, validity, uid);
+       return media_svc_check_storage(handle, storage_id, storage_path, validity);
 }
 
 int insert_storage(sqlite3 *handle, const char *storage_id, int storage_type, const char *storage_path, uid_t uid)
@@ -145,24 +133,9 @@ int set_storage_scan_status(sqlite3 *handle, const char *storage_id, int status,
        return MS_MEDIA_ERR_NONE;
 }
 
-int get_storage_list(sqlite3 *handle, char ***storage_list, char ***storage_id_list, int *count)
-{
-       return media_svc_get_storage_list(handle, storage_list, storage_id_list, count);
-}
-
-int update_item_begin(int item_cnt)
-{
-       return media_svc_update_item_begin(item_cnt);
-}
-
-int update_item_end(uid_t uid)
+int update_item_meta(sqlite3 *handle, uid_t uid)
 {
-       return media_svc_update_item_end(uid);
-}
-
-int update_item_meta(const char *file_path, const char *storage_id, int storage_type, uid_t uid)
-{
-       return media_svc_update_item_meta(file_path, storage_id, storage_type, uid);
+       return media_svc_update_item_meta(handle, uid);
 }
 
 int insert_item_scan(sqlite3 *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid)
@@ -203,12 +176,14 @@ int delete_invalid_folder_by_path(sqlite3 *handle, const char *storage_id, const
 
 int insert_folder_begin(int item_cnt)
 {
-       return media_svc_insert_folder_begin(item_cnt);
+       /* For scanner V2 */
+       return MS_MEDIA_ERR_NONE;
 }
 
 int insert_folder_end(uid_t uid)
 {
-       return media_svc_insert_folder_end(uid);
+       /* For scanner V2 */
+       return MS_MEDIA_ERR_NONE;
 }
 
 int insert_folder(sqlite3 *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid)
@@ -216,14 +191,9 @@ int insert_folder(sqlite3 *handle, const char *storage_id, const char *file_path
        return media_svc_insert_folder(handle, storage_id, storage_type, file_path, uid);
 }
 
-int delete_invalid_folder(const char *storage_id, int storage_type, uid_t uid)
-{
-       return media_svc_delete_invalid_folder(storage_id, storage_type, uid);
-}
-
 int set_folder_validity(sqlite3 *handle, const char *storage_id, const char* start_path, int validity, bool is_recursive, uid_t uid)
 {
-       return media_svc_set_folder_validity(handle, storage_id, start_path, validity, is_recursive, uid);
+       return media_svc_set_folder_validity(storage_id, start_path, validity, is_recursive, uid);
 }
 
 int get_folder_scan_status(sqlite3 *handle, const char *storage_id, const char *path, int *status)
@@ -265,3 +235,15 @@ int get_media_type(const char *path, int *mediatype)
 {
        return media_svc_get_media_type(path, mediatype);
 }
+
+int refresh_item(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
+{
+       int ret = MS_MEDIA_ERR_NONE;
+       ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
+
+       ret = ms_user_get_storage_type(uid, path, &storage_type);
+       if (ret != MS_MEDIA_ERR_NONE)
+               return ret;
+
+       return media_svc_refresh_item(handle, true, storage_id, storage_type, path, uid);
+}