Remove drm source code.
[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-thumbnail.h>
25 #include "media-svc.h"
26 #include "media-svc-util.h"
27
28 #define MEDIA_SVC_PLUGIN_ERROR_NONE             0
29 #define MEDIA_SVC_PLUGIN_ERROR                  -1
30
31 #define STRING_VALID(str)       \
32         ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
33 #define STORAGE_VALID(storage)\
34         (((storage == MEDIA_SVC_STORAGE_INTERNAL) || (storage == MEDIA_SVC_STORAGE_EXTERNAL)) ? TRUE : FALSE)
35
36
37 typedef enum{
38         ERR_HANDLE = 1,
39         ERR_FILE_PATH,
40         ERR_FOLDER_PATH,
41         ERR_MIME_TYPE,
42         ERR_NOT_MEDIAFILE,
43         ERR_STORAGE_TYPE,
44         ERR_CHECK_ITEM,
45         ERR_MAX,
46 }media_svc_error_type_e;
47
48 static void __set_error_message(int err_type, char ** err_msg);
49
50 static void __set_error_message(int err_type, char ** err_msg)
51 {
52         if (err_msg)
53                 *err_msg = NULL;
54         else
55                 return;
56
57         if(err_type == ERR_HANDLE)
58                 *err_msg = strdup("invalid handle");
59         else if(err_type == ERR_FILE_PATH)
60                 *err_msg = strdup("invalid file path");
61         else if(err_type == ERR_FOLDER_PATH)
62                 *err_msg = strdup("invalid folder path");
63         else if(err_type == ERR_MIME_TYPE)
64                 *err_msg = strdup("invalid mime type");
65         else if(err_type == ERR_NOT_MEDIAFILE)
66                 *err_msg = strdup("not media content");
67         else if(err_type == ERR_STORAGE_TYPE)
68                 *err_msg = strdup("invalid storage type");
69         else if(err_type == ERR_CHECK_ITEM)
70                 *err_msg = strdup("item does not exist");
71         else if(err_type == MS_MEDIA_ERR_DB_CONNECT_FAIL)
72                 *err_msg = strdup("DB connect error");
73         else if(err_type == MS_MEDIA_ERR_DB_DISCONNECT_FAIL)
74                 *err_msg = strdup("DB disconnect error");
75         else if(err_type == MS_MEDIA_ERR_INVALID_PARAMETER)
76                 *err_msg = strdup("invalid parameter");
77         else if(err_type == MS_MEDIA_ERR_DB_INTERNAL)
78                 *err_msg = strdup("DB internal error");
79         else if(err_type == MS_MEDIA_ERR_DB_NO_RECORD)
80                 *err_msg = strdup("not found in DB");
81         else if(err_type == MS_MEDIA_ERR_INTERNAL)
82                 *err_msg = strdup("media service internal error");
83         else if(err_type == MS_MEDIA_ERR_DB_CORRUPT)
84                 *err_msg = strdup("DB corrupt error");
85         else
86                 *err_msg = strdup("error unknown");
87
88         return;
89 }
90
91 int check_item(const char *file_path, char ** err_msg)
92 {
93         if (!STRING_VALID(file_path)) {
94                 __set_error_message(ERR_FILE_PATH, err_msg);
95                 return MEDIA_SVC_PLUGIN_ERROR;
96         }
97
98         return MEDIA_SVC_PLUGIN_ERROR_NONE;
99 }
100
101 int connect_db(void ** handle, uid_t uid, char ** err_msg)
102 {
103         int ret = media_svc_connect(handle,uid);
104
105         if(ret < 0) {
106                 __set_error_message(ret, err_msg);
107                 return MEDIA_SVC_PLUGIN_ERROR;
108         }
109
110         return MEDIA_SVC_PLUGIN_ERROR_NONE;
111 }
112
113 int disconnect_db(void * handle, char ** err_msg)
114 {
115         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
116
117         if(handle == NULL) {
118                 __set_error_message(ERR_HANDLE, err_msg);
119                 return MEDIA_SVC_PLUGIN_ERROR;
120         }
121
122         ret = media_svc_disconnect(handle);
123         if(ret < 0) {
124                 __set_error_message(ret, err_msg);
125                 return MEDIA_SVC_PLUGIN_ERROR;
126         }
127
128         return MEDIA_SVC_PLUGIN_ERROR_NONE;
129 }
130
131 int check_item_exist(void* handle, const char *file_path, int storage_type, char ** err_msg)
132 {
133         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
134
135         if(handle == NULL) {
136                 __set_error_message(ERR_HANDLE, err_msg);
137                 return MEDIA_SVC_PLUGIN_ERROR;
138         }
139
140         if (!STRING_VALID(file_path)) {
141                 __set_error_message(ERR_FILE_PATH, err_msg);
142                 return MEDIA_SVC_PLUGIN_ERROR;
143         }
144
145         if(!STORAGE_VALID(storage_type)) {
146                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
147                 return MEDIA_SVC_PLUGIN_ERROR;
148         }
149
150         ret = media_svc_check_item_exist_by_path(handle, file_path);
151         if(ret == MS_MEDIA_ERR_NONE) {
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         if(handle == NULL) {
165                 __set_error_message(ERR_HANDLE, err_msg);
166                 return MEDIA_SVC_PLUGIN_ERROR;
167         }
168
169         ret = media_svc_insert_item_begin(handle, item_cnt, with_noti, from_pid);
170         if(ret < 0) {
171                 __set_error_message(ret, err_msg);
172                 return MEDIA_SVC_PLUGIN_ERROR;
173         }
174
175         return MEDIA_SVC_PLUGIN_ERROR_NONE;
176 }
177
178 int insert_item_end(void * handle, uid_t uid, char ** err_msg)
179 {
180         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
181
182         if(handle == NULL) {
183                 __set_error_message(ERR_HANDLE, err_msg);
184                 return MEDIA_SVC_PLUGIN_ERROR;
185         }
186
187         ret = media_svc_insert_item_end(handle, uid);
188         if(ret < 0) {
189                 __set_error_message(ret, err_msg);
190                 return MEDIA_SVC_PLUGIN_ERROR;
191         }
192
193         return MEDIA_SVC_PLUGIN_ERROR_NONE;
194 }
195
196 int insert_item(void * handle, const char *file_path, int storage_type, uid_t uid, char ** err_msg)
197 {
198         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
199
200         if(handle == NULL) {
201                 __set_error_message(ERR_HANDLE, err_msg);
202                 return MEDIA_SVC_PLUGIN_ERROR;
203         }
204
205         if (!STRING_VALID(file_path)) {
206                 __set_error_message(ERR_FILE_PATH, err_msg);
207                 return MEDIA_SVC_PLUGIN_ERROR;
208         }
209
210         if(!STORAGE_VALID(storage_type)) {
211                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
212                 return MEDIA_SVC_PLUGIN_ERROR;
213         }
214
215         ret = media_svc_insert_item_bulk(handle, storage_type, file_path, FALSE, uid);
216         if(ret < 0) {
217                 __set_error_message(ret, err_msg);
218                 return MEDIA_SVC_PLUGIN_ERROR;
219         }
220
221         return MEDIA_SVC_PLUGIN_ERROR_NONE;
222 }
223
224 int insert_item_immediately(void * handle, const char *file_path, int storage_type, uid_t uid, char ** err_msg)
225 {
226         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
227
228         if(handle == NULL) {
229                 __set_error_message(ERR_HANDLE, err_msg);
230                 return MEDIA_SVC_PLUGIN_ERROR;
231         }
232
233         if (!STRING_VALID(file_path)) {
234                 __set_error_message(ERR_FILE_PATH, err_msg);
235                 return MEDIA_SVC_PLUGIN_ERROR;
236         }
237
238         if(!STORAGE_VALID(storage_type)) {
239                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
240                 return MEDIA_SVC_PLUGIN_ERROR;
241         }
242
243         ret = media_svc_insert_item_immediately(handle, storage_type, file_path, uid);
244         if(ret < 0) {
245                 __set_error_message(ret, err_msg);
246                 return MEDIA_SVC_PLUGIN_ERROR;
247         }
248
249         return MEDIA_SVC_PLUGIN_ERROR_NONE;
250 }
251
252 int insert_burst_item(void * handle, const char *file_path, int storage_type, uid_t uid, char ** err_msg)
253 {
254         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
255
256         if(handle == NULL) {
257                 __set_error_message(ERR_HANDLE, err_msg);
258                 return MEDIA_SVC_PLUGIN_ERROR;
259         }
260
261         if (!STRING_VALID(file_path)) {
262                 __set_error_message(ERR_FILE_PATH, err_msg);
263                 return MEDIA_SVC_PLUGIN_ERROR;
264         }
265
266         if(!STORAGE_VALID(storage_type)) {
267                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
268                 return MEDIA_SVC_PLUGIN_ERROR;
269         }
270
271         ret = media_svc_insert_item_bulk(handle, storage_type, file_path, TRUE, uid);
272         if(ret < 0) {
273                 __set_error_message(ret, err_msg);
274                 return MEDIA_SVC_PLUGIN_ERROR;
275         }
276
277         return MEDIA_SVC_PLUGIN_ERROR_NONE;
278 }
279
280 int move_item_begin(void * handle, int item_cnt, char ** err_msg)
281 {
282         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
283
284         if(handle == NULL) {
285                 __set_error_message(ERR_HANDLE, err_msg);
286                 return MEDIA_SVC_PLUGIN_ERROR;
287         }
288
289         ret = media_svc_move_item_begin(handle, item_cnt);
290         if(ret < 0) {
291                 __set_error_message(ret, err_msg);
292                 return MEDIA_SVC_PLUGIN_ERROR;
293         }
294
295         return MEDIA_SVC_PLUGIN_ERROR_NONE;
296 }
297
298 int move_item_end(void * handle, uid_t uid, char ** err_msg)
299 {
300         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
301
302         if(handle == NULL) {
303                 __set_error_message(ERR_HANDLE, err_msg);
304                 return MEDIA_SVC_PLUGIN_ERROR;
305         }
306
307         ret = media_svc_move_item_end(handle, uid);
308         if(ret < 0) {
309                 __set_error_message(ret, err_msg);
310                 return MEDIA_SVC_PLUGIN_ERROR;
311         }
312
313         return MEDIA_SVC_PLUGIN_ERROR_NONE;
314 }
315
316 int move_item(void * handle, const char *src_path, int src_storage_type, const char *dest_path, int dest_storage_type, uid_t uid, char ** err_msg)
317 {
318         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
319
320         if(handle == NULL) {
321                 __set_error_message(ERR_HANDLE, err_msg);
322                 return MEDIA_SVC_PLUGIN_ERROR;
323         }
324
325         if ((!STRING_VALID(src_path)) || (!STRING_VALID(dest_path))) {
326                 __set_error_message(ERR_FILE_PATH, err_msg);
327                 return MEDIA_SVC_PLUGIN_ERROR;
328         }
329
330         if((!STORAGE_VALID(src_storage_type)) || (!STORAGE_VALID(dest_storage_type))) {
331                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
332                 return MEDIA_SVC_PLUGIN_ERROR;
333         }
334
335         ret = media_svc_move_item(handle, src_storage_type, src_path, dest_storage_type, dest_path, uid);
336         if(ret < 0) {
337                 __set_error_message(ret, err_msg);
338                 return MEDIA_SVC_PLUGIN_ERROR;
339         }
340
341         return MEDIA_SVC_PLUGIN_ERROR_NONE;
342 }
343
344 int set_all_storage_items_validity(void * handle, int storage_type, int validity, uid_t uid, char ** err_msg)
345 {
346         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
347
348         if(handle == NULL) {
349                 __set_error_message(ERR_HANDLE, err_msg);
350                 return MEDIA_SVC_PLUGIN_ERROR;
351         }
352
353         if(!STORAGE_VALID(storage_type)) {
354                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
355                 return MEDIA_SVC_PLUGIN_ERROR;
356         }
357
358         ret = media_svc_set_all_storage_items_validity(handle, storage_type, validity, uid);
359         if(ret < 0) {
360                 __set_error_message(ret, err_msg);
361                 return MEDIA_SVC_PLUGIN_ERROR;
362         }
363
364         return MEDIA_SVC_PLUGIN_ERROR_NONE;
365 }
366
367 int set_folder_item_validity(void * handle, const char * folder_path, int validity, int recursive, uid_t uid, char ** err_msg)
368 {
369         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
370
371         if(handle == NULL) {
372                 __set_error_message(ERR_HANDLE, err_msg);
373                 return MEDIA_SVC_PLUGIN_ERROR;
374         }
375
376         if (!STRING_VALID(folder_path)) {
377                 __set_error_message(ERR_FOLDER_PATH, err_msg);
378                 return MEDIA_SVC_PLUGIN_ERROR;
379         }
380
381         ret = media_svc_set_folder_items_validity(handle, folder_path, validity, recursive, uid);
382         if(ret < 0) {
383                 __set_error_message(ret, err_msg);
384                 return MEDIA_SVC_PLUGIN_ERROR;
385         }
386
387         return MEDIA_SVC_PLUGIN_ERROR_NONE;
388 }
389
390 int set_item_validity_begin(void * handle, int item_cnt, char ** err_msg)
391 {
392         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
393
394         if(handle == NULL) {
395                 __set_error_message(ERR_HANDLE, err_msg);
396                 return MEDIA_SVC_PLUGIN_ERROR;
397         }
398
399         ret = media_svc_set_item_validity_begin(handle, item_cnt);
400         if(ret < 0) {
401                 __set_error_message(ret, err_msg);
402                 return MEDIA_SVC_PLUGIN_ERROR;
403         }
404
405         return MEDIA_SVC_PLUGIN_ERROR_NONE;
406 }
407
408 int set_item_validity_end(void * handle, uid_t uid, char ** err_msg)
409 {
410         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
411
412         if(handle == NULL) {
413                 __set_error_message(ERR_HANDLE, err_msg);
414                 return MEDIA_SVC_PLUGIN_ERROR;
415         }
416
417         ret = media_svc_set_item_validity_end(handle, 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 set_item_validity(void * handle, const char *file_path, int storage_type, int validity, 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(file_path)) {
436                 __set_error_message(ERR_FILE_PATH, err_msg);
437                 return MEDIA_SVC_PLUGIN_ERROR;
438         }
439
440         if(!STORAGE_VALID(storage_type)) {
441                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
442                 return MEDIA_SVC_PLUGIN_ERROR;
443         }
444
445         ret = media_svc_set_item_validity(handle, file_path, validity, uid);
446
447         if(ret < 0) {
448                 __set_error_message(ret, err_msg);
449                 return MEDIA_SVC_PLUGIN_ERROR;
450         }
451
452         return MEDIA_SVC_PLUGIN_ERROR_NONE;
453 }
454
455 int delete_item(void * handle, const char *file_path, int storage_type, uid_t uid, char ** err_msg)
456 {
457         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
458
459         if(handle == NULL) {
460                 __set_error_message(ERR_HANDLE, err_msg);
461                 return MEDIA_SVC_PLUGIN_ERROR;
462         }
463
464         if (!STRING_VALID(file_path)) {
465                 __set_error_message(ERR_FILE_PATH, err_msg);
466                 return MEDIA_SVC_PLUGIN_ERROR;
467         }
468
469         if(!STORAGE_VALID(storage_type)) {
470                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
471                 return MEDIA_SVC_PLUGIN_ERROR;
472         }
473
474         ret = media_svc_check_item_exist_by_path(handle, file_path);
475         if(ret == 0) {
476                 ret = media_svc_delete_item_by_path(handle, file_path, uid);
477
478                 if(ret < 0) {
479                         __set_error_message(ret, err_msg);
480                         return MEDIA_SVC_PLUGIN_ERROR;
481                 }
482                 else
483                         return MEDIA_SVC_PLUGIN_ERROR_NONE;
484         }
485
486         __set_error_message(ERR_CHECK_ITEM, err_msg);   //not exist in DB so can't delete item.
487         return MEDIA_SVC_PLUGIN_ERROR;
488 }
489
490 int delete_all_items_in_storage(void * handle, int storage_type, uid_t uid, char ** err_msg)
491 {
492         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
493
494         if(handle == NULL) {
495                 __set_error_message(ERR_HANDLE, err_msg);
496                 return MEDIA_SVC_PLUGIN_ERROR;
497         }
498
499         if(!STORAGE_VALID(storage_type)) {
500                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
501                 return MEDIA_SVC_PLUGIN_ERROR;
502         }
503
504         ret = media_svc_delete_all_items_in_storage(handle, storage_type, uid);
505         if(ret < 0) {
506                         __set_error_message(ret, err_msg);
507                         return MEDIA_SVC_PLUGIN_ERROR;
508         }
509
510         return MEDIA_SVC_PLUGIN_ERROR_NONE;
511 }
512
513 int delete_all_invalid_items_in_storage(void * handle, int storage_type, uid_t uid, char ** err_msg)
514 {
515         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
516
517         if(handle == NULL) {
518                 __set_error_message(ERR_HANDLE, err_msg);
519                 return MEDIA_SVC_PLUGIN_ERROR;
520         }
521
522         if(!STORAGE_VALID(storage_type)) {
523                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
524                 return MEDIA_SVC_PLUGIN_ERROR;
525         }
526
527         ret = media_svc_delete_invalid_items_in_storage(handle, storage_type, uid);
528         if(ret < 0) {
529                         __set_error_message(ret, err_msg);
530                         return MEDIA_SVC_PLUGIN_ERROR;
531         }
532
533         return MEDIA_SVC_PLUGIN_ERROR_NONE;
534 }
535
536 int delete_all_invalid_items_in_folder(void * handle, const char *folder_path, uid_t uid, char ** err_msg)
537 {
538         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
539
540         if(handle == NULL) {
541                 __set_error_message(ERR_HANDLE, err_msg);
542                 return MEDIA_SVC_PLUGIN_ERROR;
543         }
544
545         if (!STRING_VALID(folder_path)) {
546                 __set_error_message(ERR_FOLDER_PATH, err_msg);
547                 return MEDIA_SVC_PLUGIN_ERROR;
548         }
549
550         ret = media_svc_delete_invalid_items_in_folder(handle, folder_path, uid);
551         if(ret < 0) {
552                 __set_error_message(ret, err_msg);
553                 return MEDIA_SVC_PLUGIN_ERROR;
554         }
555
556         return MEDIA_SVC_PLUGIN_ERROR_NONE;
557 }
558
559 int delete_all_items(void * handle, uid_t uid ,char ** err_msg)
560 {
561         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
562
563         if(handle == NULL) {
564                 __set_error_message(ERR_HANDLE, err_msg);
565                 return MEDIA_SVC_PLUGIN_ERROR;
566         }
567
568         ret = delete_all_items_in_storage(handle, MEDIA_SVC_STORAGE_INTERNAL, uid, err_msg);
569         if(ret < 0)
570                 return MEDIA_SVC_PLUGIN_ERROR;
571
572         ret = delete_all_items_in_storage(handle, MEDIA_SVC_STORAGE_EXTERNAL, uid, err_msg);
573         if(ret < 0)
574                 return MEDIA_SVC_PLUGIN_ERROR;
575
576         return MEDIA_SVC_PLUGIN_ERROR_NONE;
577 }
578
579 int refresh_item(void * handle, const char *file_path, int storage_type, uid_t uid, char ** err_msg)
580 {
581         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
582
583         if(handle == NULL) {
584                 __set_error_message(ERR_HANDLE, err_msg);
585                 return MEDIA_SVC_PLUGIN_ERROR;
586         }
587
588         if (!STRING_VALID(file_path)) {
589                 __set_error_message(ERR_FILE_PATH, err_msg);
590                 return MEDIA_SVC_PLUGIN_ERROR;
591         }
592
593         if(!STORAGE_VALID(storage_type)) {
594                 __set_error_message(ERR_STORAGE_TYPE, err_msg);
595                 return MEDIA_SVC_PLUGIN_ERROR;
596         }
597
598         ret = media_svc_refresh_item(handle, storage_type, file_path, uid);
599         if(ret < 0) {
600                 __set_error_message(ret, err_msg);
601                 return MEDIA_SVC_PLUGIN_ERROR;
602         }
603
604         return MEDIA_SVC_PLUGIN_ERROR_NONE;
605 }
606
607 int update_begin(void)
608 {
609         return MEDIA_SVC_PLUGIN_ERROR_NONE;
610 }
611
612 int update_end(uid_t uid)
613 {
614         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
615
616         ret = thumbnail_request_extract_all_thumbs(uid);
617         if(ret < 0) {
618                 return MEDIA_SVC_PLUGIN_ERROR;
619         }
620
621         return MEDIA_SVC_PLUGIN_ERROR_NONE;
622 }
623
624 int send_dir_update_noti(void * handle, const char *dir_path, char **err_msg)
625 {
626         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
627
628         if (!STRING_VALID(dir_path)) {
629                 __set_error_message(ERR_FOLDER_PATH, err_msg);
630                 return MEDIA_SVC_PLUGIN_ERROR;
631         }
632
633         ret = media_svc_send_dir_update_noti(handle, dir_path);
634         if(ret < 0) {
635                 __set_error_message(ret, err_msg);
636                 return MEDIA_SVC_PLUGIN_ERROR;
637         }
638
639         return MEDIA_SVC_PLUGIN_ERROR_NONE;
640 }
641
642 int count_delete_items_in_folder(void * handle, const char *folder_path, int *count, char ** err_msg)
643 {
644         int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
645
646         if(handle == NULL) {
647                 __set_error_message(ERR_HANDLE, err_msg);
648                 return MEDIA_SVC_PLUGIN_ERROR;
649         }
650
651         if(count == NULL) {
652                 __set_error_message(ERR_HANDLE, err_msg);
653                 return MEDIA_SVC_PLUGIN_ERROR;
654         }
655
656         if (!STRING_VALID(folder_path)) {
657                 __set_error_message(ERR_FOLDER_PATH, err_msg);
658                 return MEDIA_SVC_PLUGIN_ERROR;
659         }
660
661         ret = media_svc_count_invalid_items_in_folder(handle, folder_path, count);
662         if(ret < 0) {
663                 __set_error_message(ret, err_msg);
664                 return MEDIA_SVC_PLUGIN_ERROR;
665         }
666
667         return MEDIA_SVC_PLUGIN_ERROR_NONE;
668 }