Add some API and Fix remove folder query
[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 <sys/stat.h>
24 #include <mm_file.h>
25 #include <media-thumbnail.h>
26 #include <media-util.h>
27 #include "media-svc.h"
28 #include "media-svc-util.h"
29
30 #define MEDIA_SVC_PLUGIN_ERROR_NONE             0
31 #define MEDIA_SVC_PLUGIN_ERROR                  -1
32
33 #define STRING_VALID(str)       \
34         ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
35 #define STORAGE_VALID(storage)\
36         (((storage == MEDIA_SVC_STORAGE_INTERNAL) || (storage == MEDIA_SVC_STORAGE_EXTERNAL) || (storage == MEDIA_SVC_STORAGE_EXTERNAL_USB)) ? TRUE : FALSE)
37
38
39 typedef enum {
40         ERR_HANDLE = 1,
41         ERR_FILE_PATH,
42         ERR_FOLDER_PATH,
43         ERR_MIME_TYPE,
44         ERR_NOT_MEDIAFILE,
45         ERR_STORAGE_TYPE,
46         ERR_CHECK_ITEM,
47         ERR_MAX,
48 } media_svc_error_type_e;
49
50 static void __set_error_message(int err_type, char **err_msg);
51
52 static void __set_error_message(int err_type, char **err_msg)
53 {
54         if (err_msg)
55                 *err_msg = NULL;
56         else
57                 return;
58
59         if (err_type == ERR_HANDLE)
60                 *err_msg = strdup("invalid handle");
61         else if (err_type == ERR_FILE_PATH)
62                 *err_msg = strdup("invalid file path");
63         else if (err_type == ERR_FOLDER_PATH)
64                 *err_msg = strdup("invalid folder path");
65         else if (err_type == ERR_MIME_TYPE)
66                 *err_msg = strdup("invalid mime type");
67         else if (err_type == ERR_NOT_MEDIAFILE)
68                 *err_msg = strdup("not media content");
69         else if (err_type == ERR_STORAGE_TYPE)
70                 *err_msg = strdup("invalid storage type");
71         else if (err_type == ERR_CHECK_ITEM)
72                 *err_msg = strdup("item does not exist");
73         else if (err_type == MS_MEDIA_ERR_DB_CONNECT_FAIL)
74                 *err_msg = strdup("DB connect error");
75         else if (err_type == MS_MEDIA_ERR_DB_DISCONNECT_FAIL)
76                 *err_msg = strdup("DB disconnect error");
77         else if (err_type == MS_MEDIA_ERR_INVALID_PARAMETER)
78                 *err_msg = strdup("invalid parameter");
79         else if (err_type == MS_MEDIA_ERR_DB_INTERNAL)
80                 *err_msg = strdup("DB internal error");
81         else if (err_type == MS_MEDIA_ERR_DB_NO_RECORD)
82                 *err_msg = strdup("not found in DB");
83         else if (err_type == MS_MEDIA_ERR_INTERNAL)
84                 *err_msg = strdup("media service internal error");
85         else if (err_type == MS_MEDIA_ERR_DB_CORRUPT)
86                 *err_msg = strdup("DB corrupt error");
87         else
88                 *err_msg = strdup("error unknown");
89
90         return;
91 }
92
93 int connect_db(void **handle, uid_t uid, char **err_msg)
94 {
95         int ret = media_svc_connect(handle, uid, true);
96
97         if (ret < 0) {
98                 __set_error_message(ret, err_msg);
99                 return MEDIA_SVC_PLUGIN_ERROR;
100         }
101
102         return MEDIA_SVC_PLUGIN_ERROR_NONE;
103 }
104
105 int disconnect_db(void *handle, char **err_msg)
106 {
107         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
108
109         if (handle == NULL) {
110                 __set_error_message(ERR_HANDLE, err_msg);
111                 return MEDIA_SVC_PLUGIN_ERROR;
112         }
113
114         ret = media_svc_disconnect(handle);
115         if (ret < 0) {
116                 __set_error_message(ret, err_msg);
117                 return MEDIA_SVC_PLUGIN_ERROR;
118         }
119
120         return MEDIA_SVC_PLUGIN_ERROR_NONE;
121 }
122
123 int check_item_exist(void *handle, const char *storage_id, const char *file_path, bool *modified, char **err_msg)
124 {
125         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
126         *modified = TRUE;
127
128         if (handle == NULL) {
129                 __set_error_message(ERR_HANDLE, err_msg);
130                 return MEDIA_SVC_PLUGIN_ERROR;
131         }
132
133         if (!STRING_VALID(file_path)) {
134                 __set_error_message(ERR_FILE_PATH, err_msg);
135                 return MEDIA_SVC_PLUGIN_ERROR;
136         }
137
138         time_t modified_time = 0;
139         unsigned long long file_size = 0;
140         struct stat st;
141
142         ret = media_svc_get_file_info(handle, storage_id, file_path, &modified_time, &file_size);
143         if (ret == MS_MEDIA_ERR_NONE) {
144                 memset(&st, 0, sizeof(struct stat));
145                 if (stat(file_path, &st) == 0) {
146                         if ((st.st_mtime != modified_time) || (st.st_size != file_size))
147                                 *modified = TRUE;
148                         else
149                                 *modified = FALSE;
150                 }
151
152                 return MEDIA_SVC_PLUGIN_ERROR_NONE;     /*exist */
153         }
154
155         __set_error_message(ERR_CHECK_ITEM, err_msg);
156
157         return MEDIA_SVC_PLUGIN_ERROR;          /*not exist */
158 }
159
160 int insert_item_begin(void *handle, int item_cnt, int with_noti, int from_pid, char **err_msg)
161 {
162         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
163
164         ret = media_svc_insert_item_begin(item_cnt, with_noti, from_pid);
165         if (ret < 0) {
166                 __set_error_message(ret, err_msg);
167                 return MEDIA_SVC_PLUGIN_ERROR;
168         }
169
170         return MEDIA_SVC_PLUGIN_ERROR_NONE;
171 }
172
173 int insert_item_end(void *handle, uid_t uid, char **err_msg)
174 {
175         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
176
177         ret = media_svc_insert_item_end(uid);
178         if (ret < 0) {
179                 __set_error_message(ret, err_msg);
180                 return MEDIA_SVC_PLUGIN_ERROR;
181         }
182
183         return MEDIA_SVC_PLUGIN_ERROR_NONE;
184 }
185
186 int insert_item(void *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid, char **err_msg)
187 {
188         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
189
190         if (handle == NULL) {
191                 __set_error_message(ERR_HANDLE, err_msg);
192                 return MEDIA_SVC_PLUGIN_ERROR;
193         }
194
195         if (!STRING_VALID(file_path)) {
196                 __set_error_message(ERR_FILE_PATH, err_msg);
197                 return MEDIA_SVC_PLUGIN_ERROR;
198         }
199
200         if (!STORAGE_VALID(storage_type)) {
201                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
202                 return MEDIA_SVC_PLUGIN_ERROR;
203         }
204
205         ret = media_svc_insert_item_bulk(handle, storage_id, storage_type, file_path, FALSE, uid);
206         if (ret < 0) {
207                 __set_error_message(ret, err_msg);
208                 return MEDIA_SVC_PLUGIN_ERROR;
209         }
210
211         return MEDIA_SVC_PLUGIN_ERROR_NONE;
212 }
213
214 int insert_item_immediately(void *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid, char **err_msg)
215 {
216         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
217
218         if (handle == NULL) {
219                 __set_error_message(ERR_HANDLE, err_msg);
220                 return MEDIA_SVC_PLUGIN_ERROR;
221         }
222
223         if (!STRING_VALID(file_path)) {
224                 __set_error_message(ERR_FILE_PATH, err_msg);
225                 return MEDIA_SVC_PLUGIN_ERROR;
226         }
227
228         if (!STORAGE_VALID(storage_type)) {
229                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
230                 return MEDIA_SVC_PLUGIN_ERROR;
231         }
232
233         ret = media_svc_insert_item_immediately(handle, storage_id, storage_type, file_path, uid);
234         if (ret < 0) {
235                 __set_error_message(ret, err_msg);
236                 return MEDIA_SVC_PLUGIN_ERROR;
237         }
238
239         return MEDIA_SVC_PLUGIN_ERROR_NONE;
240 }
241
242 int insert_burst_item(void *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid, char **err_msg)
243 {
244         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
245
246         if (handle == NULL) {
247                 __set_error_message(ERR_HANDLE, err_msg);
248                 return MEDIA_SVC_PLUGIN_ERROR;
249         }
250
251         if (!STRING_VALID(file_path)) {
252                 __set_error_message(ERR_FILE_PATH, err_msg);
253                 return MEDIA_SVC_PLUGIN_ERROR;
254         }
255
256         if (!STORAGE_VALID(storage_type)) {
257                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
258                 return MEDIA_SVC_PLUGIN_ERROR;
259         }
260
261         ret = media_svc_insert_item_bulk(handle, storage_id, storage_type, file_path, TRUE, uid);
262         if (ret < 0) {
263                 __set_error_message(ret, err_msg);
264                 return MEDIA_SVC_PLUGIN_ERROR;
265         }
266
267         return MEDIA_SVC_PLUGIN_ERROR_NONE;
268 }
269
270 int set_all_storage_items_validity(void *handle, const char *storage_id, int storage_type, int validity, uid_t uid, char **err_msg)
271 {
272         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
273
274         if (!STORAGE_VALID(storage_type)) {
275                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
276                 return MEDIA_SVC_PLUGIN_ERROR;
277         }
278
279         ret = media_svc_set_all_storage_items_validity(storage_id, storage_type, validity, uid);
280         if (ret < 0) {
281                 __set_error_message(ret, err_msg);
282                 return MEDIA_SVC_PLUGIN_ERROR;
283         }
284
285         return MEDIA_SVC_PLUGIN_ERROR_NONE;
286 }
287
288 int set_folder_item_validity(void *handle, const char *storage_id, const char *folder_path, int validity, int recursive, uid_t uid, char **err_msg)
289 {
290         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
291
292         if (handle == NULL) {
293                 __set_error_message(ERR_HANDLE, err_msg);
294                 return MEDIA_SVC_PLUGIN_ERROR;
295         }
296
297         if (!STRING_VALID(folder_path)) {
298                 __set_error_message(ERR_FOLDER_PATH, err_msg);
299                 return MEDIA_SVC_PLUGIN_ERROR;
300         }
301
302         ret = media_svc_set_folder_items_validity(handle, storage_id, folder_path, validity, recursive, uid);
303         if (ret < 0) {
304                 __set_error_message(ret, err_msg);
305                 return MEDIA_SVC_PLUGIN_ERROR;
306         }
307
308         return MEDIA_SVC_PLUGIN_ERROR_NONE;
309 }
310
311 int set_item_validity_begin(void *handle, int item_cnt, char **err_msg)
312 {
313         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
314
315         ret = media_svc_set_item_validity_begin(item_cnt);
316         if (ret < 0) {
317                 __set_error_message(ret, err_msg);
318                 return MEDIA_SVC_PLUGIN_ERROR;
319         }
320
321         return MEDIA_SVC_PLUGIN_ERROR_NONE;
322 }
323
324 int set_item_validity_end(void *handle, uid_t uid, char **err_msg)
325 {
326         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
327
328         ret = media_svc_set_item_validity_end(uid);
329         if (ret < 0) {
330                 __set_error_message(ret, err_msg);
331                 return MEDIA_SVC_PLUGIN_ERROR;
332         }
333
334         return MEDIA_SVC_PLUGIN_ERROR_NONE;
335 }
336
337 int set_item_validity(void *handle, const char *storage_id, const char *file_path, int storage_type, int validity, uid_t uid, char **err_msg)
338 {
339         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
340
341         if (!STRING_VALID(file_path)) {
342                 __set_error_message(ERR_FILE_PATH, err_msg);
343                 return MEDIA_SVC_PLUGIN_ERROR;
344         }
345
346         ret = media_svc_set_item_validity(storage_id, file_path, validity, uid);
347
348         if (ret < 0) {
349                 __set_error_message(ret, err_msg);
350                 return MEDIA_SVC_PLUGIN_ERROR;
351         }
352
353         return MEDIA_SVC_PLUGIN_ERROR_NONE;
354 }
355
356 int delete_item(void *handle, const char *storage_id, const char *file_path, uid_t uid, char **err_msg)
357 {
358         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
359
360         if (handle == NULL) {
361                 __set_error_message(ERR_HANDLE, err_msg);
362                 return MEDIA_SVC_PLUGIN_ERROR;
363         }
364
365         if (!STRING_VALID(file_path)) {
366                 __set_error_message(ERR_FILE_PATH, err_msg);
367                 return MEDIA_SVC_PLUGIN_ERROR;
368         }
369
370         ret = media_svc_check_item_exist_by_path(handle, storage_id, file_path);
371         if (ret == 0) {
372                 ret = media_svc_delete_item_by_path(handle, storage_id, file_path, uid);
373
374                 if (ret < 0) {
375                         __set_error_message(ret, err_msg);
376                         return MEDIA_SVC_PLUGIN_ERROR;
377                 } else
378                         return MEDIA_SVC_PLUGIN_ERROR_NONE;
379         }
380
381         __set_error_message(ERR_CHECK_ITEM, err_msg);   /*not exist in DB so can't delete item. */
382         return MEDIA_SVC_PLUGIN_ERROR;
383 }
384
385 int delete_all_items_in_storage(void *handle, const char *storage_id, int storage_type, uid_t uid, char **err_msg)
386 {
387         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
388
389         if (!STORAGE_VALID(storage_type)) {
390                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
391                 return MEDIA_SVC_PLUGIN_ERROR;
392         }
393
394         ret = media_svc_delete_all_items_in_storage(storage_id, storage_type, uid);
395         if (ret < 0) {
396                 __set_error_message(ret, err_msg);
397                 return MEDIA_SVC_PLUGIN_ERROR;
398         }
399
400         return MEDIA_SVC_PLUGIN_ERROR_NONE;
401 }
402
403 int delete_all_invalid_items_in_storage(void *handle, const char *storage_id, int storage_type, uid_t uid, char **err_msg)
404 {
405         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
406
407         if (handle == NULL) {
408                 __set_error_message(ERR_HANDLE, err_msg);
409                 return MEDIA_SVC_PLUGIN_ERROR;
410         }
411
412         if (!STORAGE_VALID(storage_type)) {
413                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
414                 return MEDIA_SVC_PLUGIN_ERROR;
415         }
416
417         ret = media_svc_delete_invalid_items_in_storage(handle, storage_id, storage_type, uid);
418         if (ret < 0) {
419                 __set_error_message(ret, err_msg);
420                 return MEDIA_SVC_PLUGIN_ERROR;
421         }
422
423         return MEDIA_SVC_PLUGIN_ERROR_NONE;
424 }
425
426 int delete_all_invalid_items_in_folder(void *handle, const char *storage_id, const char *folder_path, bool is_recursve, uid_t uid, char **err_msg)
427 {
428         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
429
430         if (handle == NULL) {
431                 __set_error_message(ERR_HANDLE, err_msg);
432                 return MEDIA_SVC_PLUGIN_ERROR;
433         }
434
435         if (!STRING_VALID(folder_path)) {
436                 __set_error_message(ERR_FOLDER_PATH, err_msg);
437                 return MEDIA_SVC_PLUGIN_ERROR;
438         }
439
440         ret = media_svc_delete_invalid_items_in_folder(handle, storage_id, folder_path, is_recursve, uid);
441         if (ret < 0) {
442                 __set_error_message(ret, err_msg);
443                 return MEDIA_SVC_PLUGIN_ERROR;
444         }
445
446         return MEDIA_SVC_PLUGIN_ERROR_NONE;
447 }
448
449
450 int update_begin(void)
451 {
452         return MEDIA_SVC_PLUGIN_ERROR_NONE;
453 }
454
455 int update_end(uid_t uid)
456 {
457 #if 0
458         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
459
460         ret = thumbnail_request_extract_all_thumbs(uid);
461         if (ret < 0) {
462                 return MEDIA_SVC_PLUGIN_ERROR;
463         }
464
465         ret = dcm_svc_request_extract_all(uid);
466         if (ret < 0) {
467                 return MEDIA_SVC_PLUGIN_ERROR;
468         }
469 #endif
470         return MEDIA_SVC_PLUGIN_ERROR_NONE;
471 }
472
473 int send_dir_update_noti(void *handle, const char *storage_id, const char *dir_path, const char *folder_id, int update_type, int pid, char **err_msg)
474 {
475         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
476
477         if (!STRING_VALID(dir_path)) {
478                 __set_error_message(ERR_FOLDER_PATH, err_msg);
479                 return MEDIA_SVC_PLUGIN_ERROR;
480         }
481
482         ret = media_svc_send_dir_update_noti(handle, storage_id, dir_path, folder_id, (media_item_update_type_e)update_type, pid);
483         if (ret < 0) {
484                 __set_error_message(ret, err_msg);
485                 return MEDIA_SVC_PLUGIN_ERROR;
486         }
487
488         return MEDIA_SVC_PLUGIN_ERROR_NONE;
489 }
490
491 int count_delete_items_in_folder(void *handle, const char *storage_id, const char *folder_path, int *count, char **err_msg)
492 {
493         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
494
495         if (handle == NULL) {
496                 __set_error_message(ERR_HANDLE, err_msg);
497                 return MEDIA_SVC_PLUGIN_ERROR;
498         }
499
500         if (count == NULL) {
501                 __set_error_message(ERR_HANDLE, err_msg);
502                 return MEDIA_SVC_PLUGIN_ERROR;
503         }
504
505         if (!STRING_VALID(folder_path)) {
506                 __set_error_message(ERR_FOLDER_PATH, err_msg);
507                 return MEDIA_SVC_PLUGIN_ERROR;
508         }
509
510         ret = media_svc_count_invalid_items_in_folder(handle, storage_id, folder_path, count);
511         if (ret < 0) {
512                 __set_error_message(ret, err_msg);
513                 return MEDIA_SVC_PLUGIN_ERROR;
514         }
515
516         return MEDIA_SVC_PLUGIN_ERROR_NONE;
517 }
518
519 int check_db(void *handle, uid_t uid, char **err_msg)
520 {
521         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
522         int user_version = -1;
523
524         ret = media_svc_get_user_version(handle, &user_version);
525         if (ret < 0) {
526                 __set_error_message(ret, err_msg);
527                 return MEDIA_SVC_PLUGIN_ERROR;
528         }
529
530         if (user_version == 0) {
531                 /*check db schema*/
532                 ret = media_svc_create_table(uid);
533                 if (ret < 0) {
534                         __set_error_message(ret, err_msg);
535                         return MEDIA_SVC_PLUGIN_ERROR;
536                 }
537         } else {
538                 /*check db version*/
539                 ret = media_svc_check_db_upgrade(handle, user_version, uid);
540                 if (ret < 0) {
541                         __set_error_message(ret, err_msg);
542                         return MEDIA_SVC_PLUGIN_ERROR;
543                 }
544         }
545
546         return MEDIA_SVC_PLUGIN_ERROR_NONE;
547 }
548
549 int check_db_corrupt(void *handle, char **err_msg)
550 {
551         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
552
553         /*check db version*/
554         ret = media_svc_check_db_corrupt(handle);
555         if (ret < 0) {
556                 __set_error_message(ret, err_msg);
557                 return MEDIA_SVC_PLUGIN_ERROR;
558         }
559
560         return MEDIA_SVC_PLUGIN_ERROR_NONE;
561 }
562
563 int get_folder_list(void *handle, const char *storage_id, char *start_path, char ***folder_list, int **modified_time_list, int **item_num_list, int *count, char **err_msg)
564 {
565         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
566
567         if (handle == NULL) {
568                 __set_error_message(ERR_HANDLE, err_msg);
569                 return MEDIA_SVC_PLUGIN_ERROR;
570         }
571
572         if (count == NULL) {
573                 __set_error_message(ERR_HANDLE, err_msg);
574                 return MEDIA_SVC_PLUGIN_ERROR;
575         }
576
577         ret = media_svc_get_folder_list(handle, start_path, folder_list, (time_t **)modified_time_list, item_num_list, count);
578         if (ret < 0) {
579                 __set_error_message(ret, err_msg);
580                 return MEDIA_SVC_PLUGIN_ERROR;
581         }
582
583         return MEDIA_SVC_PLUGIN_ERROR_NONE;
584 }
585
586 int update_folder_time(void *handle, const char *storage_id, char *folder_path, uid_t uid, char **err_msg)
587 {
588         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
589
590         if (handle == NULL) {
591                 __set_error_message(ERR_HANDLE, err_msg);
592                 return MEDIA_SVC_PLUGIN_ERROR;
593         }
594
595         if (folder_path == NULL) {
596                 __set_error_message(ERR_HANDLE, err_msg);
597                 return MEDIA_SVC_PLUGIN_ERROR;
598         }
599
600         ret = media_svc_update_folder_time(handle, storage_id, folder_path, uid);
601         if (ret < 0) {
602                 __set_error_message(ret, err_msg);
603                 return MEDIA_SVC_PLUGIN_ERROR;
604         }
605
606         return MEDIA_SVC_PLUGIN_ERROR_NONE;
607 }
608
609 int get_uuid(void * handle, char **uuid, char **err_msg)
610 {
611         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
612
613         ret = media_svc_generate_uuid(uuid);
614         if (ret < 0) {
615                 __set_error_message(ret, err_msg);
616                 return MEDIA_SVC_PLUGIN_ERROR;
617         }
618
619         return MEDIA_SVC_PLUGIN_ERROR_NONE;
620 }
621
622 int get_mmc_info(void * handle, char **storage_name, char **storage_path, int *validity, bool *info_exist, char **err_msg)
623 {
624         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
625
626         if (handle == NULL) {
627                 __set_error_message(ERR_HANDLE, err_msg);
628                 return MEDIA_SVC_PLUGIN_ERROR;
629         }
630
631         ret = media_svc_get_mmc_info(handle, storage_name, storage_path, validity, info_exist);
632         if (ret < 0) {
633                 __set_error_message(MS_MEDIA_ERR_DB_NO_RECORD, err_msg);
634                 return MEDIA_SVC_PLUGIN_ERROR;
635         }
636
637         return MEDIA_SVC_PLUGIN_ERROR_NONE;
638 }
639
640 int check_storage(void * handle, const char *storage_id, const char *storage_name, char **storage_path, int *validity, char **err_msg)
641 {
642         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
643
644         if (handle == NULL) {
645                 __set_error_message(ERR_HANDLE, err_msg);
646                 return MEDIA_SVC_PLUGIN_ERROR;
647         }
648
649         ret = media_svc_check_storage(handle, storage_id, storage_name, storage_path, validity);
650         if (ret < 0) {
651                 __set_error_message(ret, err_msg);
652                 return MEDIA_SVC_PLUGIN_ERROR;
653         }
654
655         return MEDIA_SVC_PLUGIN_ERROR_NONE;
656 }
657
658 int insert_storage(void *handle, const char *storage_id, int storage_type, const char *storage_name, const char *storage_path, uid_t uid, char **err_msg)
659 {
660         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
661
662         if (handle == NULL) {
663                 __set_error_message(ERR_HANDLE, err_msg);
664                 return MEDIA_SVC_PLUGIN_ERROR;
665         }
666
667         ret = media_svc_insert_storage(handle, storage_id, storage_name, storage_path, NULL, storage_type, uid);
668         if (ret < 0) {
669                 __set_error_message(ret, err_msg);
670                 return MEDIA_SVC_PLUGIN_ERROR;
671         }
672
673         return MEDIA_SVC_PLUGIN_ERROR_NONE;
674 }
675
676 int update_storage(void *handle, const char *storage_id, const char *storage_path, uid_t uid, char **err_msg)
677 {
678         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
679
680         if (handle == NULL) {
681                 __set_error_message(ERR_HANDLE, err_msg);
682                 return MEDIA_SVC_PLUGIN_ERROR;
683         }
684
685         ret = media_svc_update_storage(handle, storage_id, storage_path, uid);
686         if (ret < 0) {
687                 __set_error_message(ret, err_msg);
688                 return MEDIA_SVC_PLUGIN_ERROR;
689         }
690
691         return MEDIA_SVC_PLUGIN_ERROR_NONE;
692 }
693
694 int delete_storage(void * handle, const char *storage_id, const char *storage_name, uid_t uid, char **err_msg)
695 {
696         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
697
698         if (handle == NULL) {
699                 __set_error_message(ERR_HANDLE, err_msg);
700                 return MEDIA_SVC_PLUGIN_ERROR;
701         }
702
703         ret = media_svc_delete_storage(handle, storage_id, storage_name, uid);
704         if (ret < 0) {
705                 __set_error_message(ret, err_msg);
706                 return MEDIA_SVC_PLUGIN_ERROR;
707         }
708
709         return MEDIA_SVC_PLUGIN_ERROR_NONE;
710 }
711
712 int set_storage_validity(void * handle, const char *storage_id, int validity, uid_t uid, char **err_msg)
713 {
714         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
715
716         if (handle == NULL) {
717                 __set_error_message(ERR_HANDLE, err_msg);
718                 return MEDIA_SVC_PLUGIN_ERROR;
719         }
720
721         ret = media_svc_set_storage_validity(handle, storage_id, validity, uid);
722         if (ret < 0) {
723                 __set_error_message(ret, err_msg);
724                 return MEDIA_SVC_PLUGIN_ERROR;
725         }
726
727         return MEDIA_SVC_PLUGIN_ERROR_NONE;
728 }
729
730 int set_all_storage_validity(void * handle, int validity, uid_t uid, char **err_msg)
731 {
732         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
733
734         if (handle == NULL) {
735                 __set_error_message(ERR_HANDLE, err_msg);
736                 return MEDIA_SVC_PLUGIN_ERROR;
737         }
738
739         ret = media_svc_set_storage_validity(handle, NULL, validity, uid);
740         if (ret < 0) {
741                 __set_error_message(ret, err_msg);
742                 return MEDIA_SVC_PLUGIN_ERROR;
743         }
744
745         return MEDIA_SVC_PLUGIN_ERROR_NONE;
746 }
747
748 int get_storage_id(void * handle, const char *path, char *storage_id, char **err_msg)
749 {
750         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
751
752         if (handle == NULL) {
753                 __set_error_message(ERR_HANDLE, err_msg);
754                 return MEDIA_SVC_PLUGIN_ERROR;
755         }
756
757         ret = media_svc_get_storage_id(handle, path, storage_id);
758         if (ret < 0) {
759                 __set_error_message(ret, err_msg);
760                 return MEDIA_SVC_PLUGIN_ERROR;
761         }
762
763         return MEDIA_SVC_PLUGIN_ERROR_NONE;
764 }
765
766 int get_storage_scan_status(void * handle, const char *storage_id, int *status, char **err_msg)
767 {
768         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
769         media_svc_scan_status_type_e storage_status = 0;
770
771         if (handle == NULL) {
772                 __set_error_message(ERR_HANDLE, err_msg);
773                 return MEDIA_SVC_PLUGIN_ERROR;
774         }
775
776         ret = media_svc_get_storage_scan_status(handle, storage_id, &storage_status);
777         if (ret < 0) {
778                 __set_error_message(ret, err_msg);
779                 return MEDIA_SVC_PLUGIN_ERROR;
780         }
781
782         *status = storage_status;
783
784         return MEDIA_SVC_PLUGIN_ERROR_NONE;
785 }
786
787 int set_storage_scan_status(void *handle, const char *storage_id, int status, uid_t uid, char **err_msg)
788 {
789         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
790         media_svc_scan_status_type_e storage_status = status;
791
792         ret = media_svc_set_storage_scan_status(storage_id, storage_status, uid);
793         if (ret < 0) {
794                 __set_error_message(ret, err_msg);
795                 return MEDIA_SVC_PLUGIN_ERROR;
796         }
797
798         return MEDIA_SVC_PLUGIN_ERROR_NONE;
799 }
800
801 int get_storage_list(void *handle, char ***storage_list, char ***storage_id_list, int **scan_status_list, int *count, char **err_msg)
802 {
803         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
804
805         if (handle == NULL) {
806                 __set_error_message(ERR_HANDLE, err_msg);
807                 return MEDIA_SVC_PLUGIN_ERROR;
808         }
809
810         if (count == NULL) {
811                 __set_error_message(ERR_HANDLE, err_msg);
812                 return MEDIA_SVC_PLUGIN_ERROR;
813         }
814
815         ret = media_svc_get_storage_list(handle, storage_list, storage_id_list, scan_status_list, count);
816         if (ret < 0) {
817                 __set_error_message(ret, err_msg);
818                 return MEDIA_SVC_PLUGIN_ERROR;
819         }
820
821         return MEDIA_SVC_PLUGIN_ERROR_NONE;
822 }
823
824 int update_item_begin(void *handle, int item_cnt, char **err_msg)
825 {
826         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
827
828         ret = media_svc_update_item_begin(item_cnt);
829         if (ret < 0) {
830                 __set_error_message(ret, err_msg);
831                 return MEDIA_SVC_PLUGIN_ERROR;
832         }
833
834         return MEDIA_SVC_PLUGIN_ERROR_NONE;
835 }
836
837 int update_item_end(void *handle, uid_t uid, char **err_msg)
838 {
839         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
840
841         ret = media_svc_update_item_end(uid);
842         if (ret < 0) {
843                 __set_error_message(ret, err_msg);
844                 return MEDIA_SVC_PLUGIN_ERROR;
845         }
846
847         return MEDIA_SVC_PLUGIN_ERROR_NONE;
848 }
849
850 int update_item_meta(void *handle, const char *file_path, const char *storage_id, int storage_type, uid_t uid, char **err_msg)
851 {
852         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
853
854         if (handle == NULL) {
855                 __set_error_message(ERR_HANDLE, err_msg);
856                 return MEDIA_SVC_PLUGIN_ERROR;
857         }
858
859         if (file_path == NULL) {
860                 __set_error_message(ERR_HANDLE, err_msg);
861                 return MEDIA_SVC_PLUGIN_ERROR;
862         }
863
864         if (storage_id == NULL) {
865                 __set_error_message(ERR_HANDLE, err_msg);
866                 return MEDIA_SVC_PLUGIN_ERROR;
867         }
868
869         ret = media_svc_update_item_meta(handle, file_path, storage_id, storage_type, uid);
870         if (ret < 0) {
871                 __set_error_message(ret, err_msg);
872                 return MEDIA_SVC_PLUGIN_ERROR;
873         }
874
875         return MEDIA_SVC_PLUGIN_ERROR_NONE;
876 }
877
878 int insert_item_scan(void * handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid, char **err_msg)
879 {
880         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
881
882         if (handle == NULL) {
883                 __set_error_message(ERR_HANDLE, err_msg);
884                 return MEDIA_SVC_PLUGIN_ERROR;
885         }
886
887         if (!STRING_VALID(file_path)) {
888                 __set_error_message(ERR_FILE_PATH, err_msg);
889                 return MEDIA_SVC_PLUGIN_ERROR;
890         }
891
892         if (!STORAGE_VALID(storage_type)) {
893                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
894                 return MEDIA_SVC_PLUGIN_ERROR;
895         }
896
897         ret = media_svc_insert_item_pass1(handle, storage_id, storage_type, file_path, FALSE, uid);
898         if (ret < 0) {
899                 __set_error_message(ret, err_msg);
900                 return MEDIA_SVC_PLUGIN_ERROR;
901         }
902
903         return MEDIA_SVC_PLUGIN_ERROR_NONE;
904 }
905
906 int update_item_extract(void * handle, const char *storage_id, int storage_type, int scan_type, uid_t uid, const char *path, int burst, char **err_msg)
907 {
908         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
909
910         if (handle == NULL) {
911                 __set_error_message(ERR_HANDLE, err_msg);
912                 return MEDIA_SVC_PLUGIN_ERROR;
913         }
914
915         if (!STORAGE_VALID(storage_type)) {
916                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
917                 return MEDIA_SVC_PLUGIN_ERROR;
918         }
919
920         ret = media_svc_insert_item_pass2(handle, storage_id, storage_type, scan_type, path, burst, uid);
921         if (ret < 0) {
922                 __set_error_message(ret, err_msg);
923                 return MEDIA_SVC_PLUGIN_ERROR;
924         }
925
926         return MEDIA_SVC_PLUGIN_ERROR_NONE;
927 }
928
929 int get_extract_list(void* handle, const char* storage_id, int storage_type, int scan_type, const char* path, int burst, uid_t uid, void* array, char** err_msg)
930 {
931 #if 0
932         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
933
934         if(handle == NULL) {
935                 __set_error_message(ERR_HANDLE, err_msg);
936                 return MEDIA_SVC_PLUGIN_ERROR;
937         }
938
939         if(!STORAGE_VALID(storage_type)) {
940                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
941                 return MEDIA_SVC_PLUGIN_ERROR;
942         }
943
944         ret = media_svc_pass2_get_extract_list(handle, storage_id, storage_type, scan_type, path, burst, uid, array);
945         if(ret < 0) {
946                 __set_error_message(ret, err_msg);
947                 return MEDIA_SVC_PLUGIN_ERROR;
948         }
949 #endif
950         return MEDIA_SVC_PLUGIN_ERROR_NONE;
951 }
952
953 int update_one_extract_item(void* handle, const char* storage_id, int storage_type, void* data, int burst, char** err_msg)
954 {
955 #if 0
956         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
957
958         if(handle == NULL) {
959                 __set_error_message(ERR_HANDLE, err_msg);
960                 return MEDIA_SVC_PLUGIN_ERROR;
961         }
962
963         if(!STORAGE_VALID(storage_type)) {
964                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
965                 return MEDIA_SVC_PLUGIN_ERROR;
966         }
967
968         ret = media_svc_insert_one_item_pass2(handle, storage_id, storage_type, data, burst);
969         if(ret < 0) {
970                 __set_error_message(ret, err_msg);
971                 return MEDIA_SVC_PLUGIN_ERROR;
972         }
973 #endif
974         return MEDIA_SVC_PLUGIN_ERROR_NONE;
975 }
976
977 int query_do_update_list(void* handle, char** err_msg)
978 {
979 #if 0
980         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
981
982         if(handle == NULL) {
983                 __set_error_message(ERR_HANDLE, err_msg);
984                 return MEDIA_SVC_PLUGIN_ERROR;
985         }
986
987         ret = media_svc_query_do_update_list(handle);
988         if(ret < 0) {
989                 __set_error_message(ret, err_msg);
990                 return MEDIA_SVC_PLUGIN_ERROR;
991         }
992 #endif
993         return MEDIA_SVC_PLUGIN_ERROR_NONE;
994 }
995
996 int insert_folder_begin(void * handle, int item_cnt, char **err_msg)
997 {
998         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
999
1000         ret = media_svc_insert_folder_begin(item_cnt);
1001         if (ret < 0) {
1002                 __set_error_message(ret, err_msg);
1003                 return MEDIA_SVC_PLUGIN_ERROR;
1004         }
1005
1006         return MEDIA_SVC_PLUGIN_ERROR_NONE;
1007 }
1008
1009 int insert_folder_end(void *handle, uid_t uid, char **err_msg)
1010 {
1011         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
1012
1013         ret = media_svc_insert_folder_end(uid);
1014         if (ret < 0) {
1015                 __set_error_message(ret, err_msg);
1016                 return MEDIA_SVC_PLUGIN_ERROR;
1017         }
1018
1019         return MEDIA_SVC_PLUGIN_ERROR_NONE;
1020 }
1021
1022 int insert_folder(void * handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid, char **err_msg)
1023 {
1024         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
1025
1026         if (handle == NULL) {
1027                 __set_error_message(ERR_HANDLE, err_msg);
1028                 return MEDIA_SVC_PLUGIN_ERROR;
1029         }
1030
1031         if (!STRING_VALID(file_path)) {
1032                 __set_error_message(ERR_FILE_PATH, err_msg);
1033                 return MEDIA_SVC_PLUGIN_ERROR;
1034         }
1035
1036         if (!STORAGE_VALID(storage_type)) {
1037                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
1038                 return MEDIA_SVC_PLUGIN_ERROR;
1039         }
1040
1041         ret = media_svc_insert_folder(handle, storage_id, storage_type, file_path, uid);
1042         if (ret < 0) {
1043                 __set_error_message(ret, err_msg);
1044                 return MEDIA_SVC_PLUGIN_ERROR;
1045         }
1046
1047         return MEDIA_SVC_PLUGIN_ERROR_NONE;
1048 }
1049
1050 int delete_invalid_folder(void * handle, const char *storage_id, int storage_type, uid_t uid, char **err_msg)
1051 {
1052         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
1053
1054         ret = media_svc_delete_invalid_folder(storage_id, storage_type, uid);
1055         if (ret < 0) {
1056                 __set_error_message(ret, err_msg);
1057                 return MEDIA_SVC_PLUGIN_ERROR;
1058         }
1059
1060         return MEDIA_SVC_PLUGIN_ERROR_NONE;
1061 }
1062
1063 int set_folder_validity(void * handle, const char *storage_id, const char* start_path, int validity, bool is_recursive, uid_t uid, char **err_msg)
1064 {
1065         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
1066
1067         if (handle == NULL) {
1068                 __set_error_message(ERR_HANDLE, err_msg);
1069                 return MEDIA_SVC_PLUGIN_ERROR;
1070         }
1071
1072         ret = media_svc_set_folder_validity(handle, storage_id, start_path, validity, is_recursive, uid);
1073         if (ret < 0) {
1074                 __set_error_message(ret, err_msg);
1075                 return MEDIA_SVC_PLUGIN_ERROR;
1076         }
1077
1078         return MEDIA_SVC_PLUGIN_ERROR_NONE;
1079 }
1080
1081 int delete_invalid_folder_by_path(void * handle, const char *storage_id, const char *folder_path, uid_t uid, int *delete_count, char **err_msg)
1082 {
1083         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
1084
1085         if (handle == NULL) {
1086                 __set_error_message(ERR_HANDLE, err_msg);
1087                 return MEDIA_SVC_PLUGIN_ERROR;
1088         }
1089
1090         ret = media_svc_delete_invalid_folder_by_path(handle, storage_id, folder_path, uid, delete_count);
1091         if (ret < 0) {
1092                 __set_error_message(ret, err_msg);
1093                 return MEDIA_SVC_PLUGIN_ERROR;
1094         }
1095
1096         return MEDIA_SVC_PLUGIN_ERROR_NONE;
1097 }
1098
1099 int get_folder_scan_status(void *handle, const char *storage_id, const char *path, int *status, char **err_msg)
1100 {
1101         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
1102         int storage_status = 0;
1103
1104         if (handle == NULL) {
1105                 __set_error_message(ERR_HANDLE, err_msg);
1106                 return MEDIA_SVC_PLUGIN_ERROR;
1107         }
1108
1109         ret = media_svc_get_folder_scan_status(handle, storage_id, path, &storage_status);
1110         if (ret < 0) {
1111                 __set_error_message(ret, err_msg);
1112                 return MEDIA_SVC_PLUGIN_ERROR;
1113         }
1114
1115         *status = storage_status;
1116
1117         return ret;
1118 }
1119
1120 int set_folder_scan_status(void *handle, const char *storage_id, const char *path, int status, uid_t uid, char **err_msg)
1121 {
1122         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
1123         int storage_status = status;
1124
1125         ret = media_svc_set_folder_scan_status(storage_id, path, storage_status, uid);
1126         if (ret < 0) {
1127                 __set_error_message(ret, err_msg);
1128                 return MEDIA_SVC_PLUGIN_ERROR;
1129         }
1130
1131         return ret;
1132 }
1133
1134 int check_folder_modified(void *handle, const char *path, const char *storage_id, bool *modified, char **err_msg)
1135 {
1136         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
1137         *modified = TRUE;
1138
1139         if (handle == NULL) {
1140                 __set_error_message(ERR_HANDLE, err_msg);
1141                 return MEDIA_SVC_PLUGIN_ERROR;
1142         }
1143
1144         if (!STRING_VALID(path)) {
1145                 __set_error_message(ERR_FILE_PATH, err_msg);
1146                 return MEDIA_SVC_PLUGIN_ERROR;
1147         }
1148
1149         ret = media_svc_get_folder_modified_time(handle, path, storage_id, modified);
1150         if (ret < 0) {
1151                 __set_error_message(ret, err_msg);
1152                 return MEDIA_SVC_PLUGIN_ERROR;
1153         }
1154
1155         return ret;
1156 }
1157
1158 int get_null_scan_folder_list(void *handle, const char *storage_id, const char *folder_path, char ***folder_list, int *count, char **err_msg)
1159 {
1160         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
1161
1162         if (handle == NULL) {
1163                 __set_error_message(ERR_HANDLE, err_msg);
1164                 return MEDIA_SVC_PLUGIN_ERROR;
1165         }
1166
1167         if (count == NULL) {
1168                 __set_error_message(ERR_HANDLE, err_msg);
1169                 return MEDIA_SVC_PLUGIN_ERROR;
1170         }
1171
1172         ret = media_svc_get_null_scan_folder_list(handle, storage_id, folder_path, folder_list, count);
1173         if (ret < 0) {
1174                 __set_error_message(ret, err_msg);
1175                 return MEDIA_SVC_PLUGIN_ERROR;
1176         }
1177
1178         return ret;
1179 }
1180
1181 int change_validity_item_batch(void **handle, const char *storage_id, const char *path, int des_validity, int src_validity, uid_t uid, char **err_msg)
1182 {
1183         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
1184
1185         ret = media_svc_change_validity_item_batch(storage_id, path, des_validity, src_validity, uid);
1186         if (ret < 0) {
1187                 __set_error_message(ret, err_msg);
1188                 return MEDIA_SVC_PLUGIN_ERROR;
1189         }
1190
1191         return ret;
1192 }
1193
1194 int check_folder_exist(void * handle, const char *storage_id, const char *folder_path, char **err_msg)
1195 {
1196         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
1197
1198         if (handle == NULL) {
1199                 __set_error_message(ERR_HANDLE, err_msg);
1200                 return MEDIA_SVC_PLUGIN_ERROR;
1201         }
1202
1203         ret = media_svc_check_folder_exist_by_path(handle, storage_id, folder_path);
1204         if (ret < 0) {
1205                 __set_error_message(ret, err_msg);
1206                 return MEDIA_SVC_PLUGIN_ERROR;
1207         }
1208
1209         return MEDIA_SVC_PLUGIN_ERROR_NONE;
1210 }
1211
1212 int count_subfolder(void *handle, const char *storage_id, const char *folder_path, int *count, char **err_msg)
1213 {
1214         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
1215         int cnt = 0;
1216
1217         if (handle == NULL) {
1218                 __set_error_message(ERR_HANDLE, err_msg);
1219                 return MEDIA_SVC_PLUGIN_ERROR;
1220         }
1221
1222         ret = media_svc_check_subfolder_by_path(handle, storage_id, folder_path, &cnt);
1223         if (ret < 0) {
1224                 __set_error_message(ret, err_msg);
1225                 return MEDIA_SVC_PLUGIN_ERROR;
1226         }
1227
1228         *count = cnt;
1229
1230         return MEDIA_SVC_PLUGIN_ERROR_NONE;
1231 }
1232
1233 int get_folder_id(void * handle, const char *storage_id, const char *path, char *folder_id, char **err_msg)
1234 {
1235         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
1236
1237         if (handle == NULL) {
1238                 __set_error_message(ERR_HANDLE, err_msg);
1239                 return MEDIA_SVC_PLUGIN_ERROR;
1240         }
1241
1242         ret = media_svc_get_folder_id(handle, storage_id, path, folder_id);
1243         if (ret < 0) {
1244                 __set_error_message(ret, err_msg);
1245                 return MEDIA_SVC_PLUGIN_ERROR;
1246         }
1247
1248         return MEDIA_SVC_PLUGIN_ERROR_NONE;
1249 }
1250
1251 int get_media_type(void *handle, const char *path, int *mediatype, char **err_msg)
1252 {
1253 #if 0
1254         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
1255
1256         if (handle == NULL) {
1257                 __set_error_message(ERR_HANDLE, err_msg);
1258                 return MEDIA_SVC_PLUGIN_ERROR;
1259         }
1260
1261         ret = media_svc_get_media_type(path, mediatype);
1262         if (ret < 0) {
1263                 __set_error_message(ret, err_msg);
1264                 return MEDIA_SVC_PLUGIN_ERROR;
1265         }
1266 #endif
1267         return MEDIA_SVC_PLUGIN_ERROR_NONE;
1268 }
1269
1270