14e04a5de26ea0a6d42049390289da569ac0b5ec
[platform/core/multimedia/libmedia-service.git] / plugin / media-content-plugin.c
1 /*
2  * libmedia-service
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Hyunjun Ko <zzoon.ko@samsung.com>, Haejeong Kim <backto.kim@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #include <string.h>
23 #include <mm_file.h>
24 #include <media-util.h>
25 #include "media-svc.h"
26 #include "media-svc-util.h"
27
28 int insert_item_begin(bool with_noti, int from_pid)
29 {
30         return media_svc_insert_item_begin(with_noti, from_pid);
31 }
32
33 int insert_item_end(uid_t uid)
34 {
35         return media_svc_insert_item_end(uid);
36 }
37
38 int insert_item(sqlite3 *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid)
39 {
40         return media_svc_insert_item_bulk(handle, storage_id, storage_type, file_path, uid);
41 }
42
43 int set_item_validity(const char *storage_id, const char *file_path, int storage_type, int validity, uid_t uid)
44 {
45         return media_svc_set_item_validity(file_path, validity, uid);
46 }
47
48 int send_dir_update_noti(const char *dir_path, const char *folder_id, int update_type, int pid)
49 {
50         return media_svc_send_dir_update_noti(dir_path, folder_id, (media_item_update_type_e)update_type, pid);
51 }
52
53 int check_db(sqlite3 *handle, uid_t uid)
54 {
55         int ret = MS_MEDIA_ERR_NONE;
56         bool exist = false;
57
58         ret = media_svc_check_table_exist(handle, &exist);
59         if (ret != MS_MEDIA_ERR_NONE)
60                 return ret;
61
62         if (!exist)
63                 ret = media_svc_create_table(uid);
64
65         return ret;
66 }
67
68 int check_storage(sqlite3 *handle, const char *storage_id, char **storage_path, int *validity, uid_t uid)
69 {
70         return media_svc_check_storage(handle, storage_id, storage_path, validity);
71 }
72
73 int insert_storage(sqlite3 *handle, const char *storage_id, int storage_type, const char *storage_path, uid_t uid)
74 {
75         return media_svc_insert_storage(handle, storage_id, storage_path, storage_type, uid);
76 }
77
78 int update_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, uid_t uid)
79 {
80         return media_svc_update_storage(handle, storage_id, storage_path, uid);
81 }
82
83 int set_storage_validity(sqlite3 *handle, const char *storage_id, int validity, uid_t uid)
84 {
85         return media_svc_set_storage_validity(handle, storage_id, validity, uid);
86 }
87
88 int set_all_storage_validity(sqlite3 *handle, int validity, uid_t uid)
89 {
90         return media_svc_set_storage_validity(handle, NULL, validity, uid);
91 }
92
93 int get_storage_id(sqlite3 *handle, const char *path, char *storage_id, uid_t uid)
94 {
95         return media_svc_get_storage_id(handle, path, storage_id, uid);
96 }
97
98 int insert_folder(sqlite3 *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid)
99 {
100         return media_svc_insert_folder(handle, storage_id, storage_type, file_path, uid);
101 }
102
103 int set_folder_validity(sqlite3 *handle, const char *storage_id, const char *start_path, int validity, bool is_recursive, uid_t uid)
104 {
105         return media_svc_set_folder_validity(start_path, validity, is_recursive, uid);
106 }
107
108 int check_folder_exist(sqlite3 *handle, const char *storage_id, const char *folder_path)
109 {
110         return media_svc_check_folder_exist_by_path(handle, folder_path);
111 }
112
113 int get_media_type(const char *path, int *mediatype)
114 {
115         return media_svc_get_media_type(path, mediatype);
116 }
117
118 int refresh_item(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid)
119 {
120         int ret = MS_MEDIA_ERR_NONE;
121         ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
122
123         ret = ms_user_get_storage_type(uid, path, &storage_type);
124         if (ret != MS_MEDIA_ERR_NONE)
125                 return ret;
126
127         return media_svc_refresh_item(handle, true, storage_id, storage_type, path, uid);
128 }
129
130 /* For scanner V2 */
131 int cleanup_db(sqlite3 *handle, uid_t uid)
132 {
133         return MS_MEDIA_ERR_NONE;
134 }
135
136 int update_folder_time(sqlite3 *handle, const char *storage_id, char *folder_path, uid_t uid)
137 {
138         return MS_MEDIA_ERR_NONE;
139 }
140
141 int get_uuid(char **uuid)
142 {
143         return MS_MEDIA_ERR_NONE;
144 }
145
146 int set_storage_scan_status(sqlite3 *handle, const char *storage_id, int status, uid_t uid)
147 {
148         return MS_MEDIA_ERR_NONE;
149 }
150
151 int insert_item_scan(sqlite3 *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid)
152 {
153         return MS_MEDIA_ERR_NONE;
154 }
155
156 int get_extract_list(sqlite3 *handle, const char *storage_id, int scan_type, const char *path, int is_end, void *array)
157 {
158         return MS_MEDIA_ERR_NONE;
159 }
160
161 int update_one_extract_item(sqlite3 *handle, const char *storage_id, int storage_type, void *data)
162 {
163         return MS_MEDIA_ERR_NONE;
164 }
165
166 int delete_all_invalid_items_in_folder(sqlite3 *handle, const char *storage_id, const char *path, bool is_recursive, uid_t uid)
167 {
168         return MS_MEDIA_ERR_NONE;
169 }
170
171 int delete_invalid_folder_by_path(sqlite3 *handle, const char *storage_id, const char *folder_path, uid_t uid)
172 {
173         return MS_MEDIA_ERR_NONE;
174 }
175
176 int get_folder_scan_status(sqlite3 *handle, const char *storage_id, const char *path, int *status)
177 {
178         return MS_MEDIA_ERR_NONE;
179 }
180
181 int set_folder_scan_status(sqlite3 *handle, const char *storage_id, const char *path, int status, uid_t uid)
182 {
183         return MS_MEDIA_ERR_NONE;
184 }
185
186 int check_folder_modified(sqlite3 *handle, const char *path, const char *storage_id, bool *modified)
187 {
188         return MS_MEDIA_ERR_NONE;
189 }
190
191 int get_null_scan_folder_list(sqlite3 *handle, const char *storage_id, const char *folder_path, GPtrArray **dir_array)
192 {
193         return MS_MEDIA_ERR_NONE;
194 }
195
196 int change_validity_item_batch(sqlite3 *handle, const char *storage_id, const char *path, int des_validity, int src_validity, uid_t uid)
197 {
198         return MS_MEDIA_ERR_NONE;
199 }