4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hyunjun Ko <zzoon.ko@samsung.com>, Haejeong Kim <backto.kim@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
25 #include <media-util.h>
26 #include "media-svc.h"
27 #include "media-svc-util.h"
29 #define MEDIA_SVC_PLUGIN_ERROR_NONE 0
30 #define MEDIA_SVC_PLUGIN_ERROR -1
32 #define STRING_VALID(str) \
33 ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
34 #define STORAGE_VALID(storage)\
35 (((storage == MEDIA_SVC_STORAGE_INTERNAL) || (storage == MEDIA_SVC_STORAGE_EXTERNAL) || (storage == MEDIA_SVC_STORAGE_EXTERNAL_USB)) ? TRUE : FALSE)
47 } media_svc_error_type_e;
49 static void __set_error_message(int err_type, char **err_msg);
51 static void __set_error_message(int err_type, char **err_msg)
58 if (err_type == ERR_HANDLE)
59 *err_msg = strdup("invalid handle");
60 else if (err_type == ERR_FILE_PATH)
61 *err_msg = strdup("invalid file path");
62 else if (err_type == ERR_FOLDER_PATH)
63 *err_msg = strdup("invalid folder path");
64 else if (err_type == ERR_MIME_TYPE)
65 *err_msg = strdup("invalid mime type");
66 else if (err_type == ERR_NOT_MEDIAFILE)
67 *err_msg = strdup("not media content");
68 else if (err_type == ERR_STORAGE_TYPE)
69 *err_msg = strdup("invalid storage type");
70 else if (err_type == ERR_CHECK_ITEM)
71 *err_msg = strdup("item does not exist");
72 else if (err_type == MS_MEDIA_ERR_DB_CONNECT_FAIL)
73 *err_msg = strdup("DB connect error");
74 else if (err_type == MS_MEDIA_ERR_DB_DISCONNECT_FAIL)
75 *err_msg = strdup("DB disconnect error");
76 else if (err_type == MS_MEDIA_ERR_INVALID_PARAMETER)
77 *err_msg = strdup("invalid parameter");
78 else if (err_type == MS_MEDIA_ERR_DB_INTERNAL)
79 *err_msg = strdup("DB internal error");
80 else if (err_type == MS_MEDIA_ERR_DB_NO_RECORD)
81 *err_msg = strdup("not found in DB");
82 else if (err_type == MS_MEDIA_ERR_INTERNAL)
83 *err_msg = strdup("media service internal error");
84 else if (err_type == MS_MEDIA_ERR_DB_CORRUPT)
85 *err_msg = strdup("DB corrupt error");
87 *err_msg = strdup("error unknown");
92 int connect_db(void **handle, uid_t uid, char **err_msg)
94 int ret = media_svc_connect(handle, uid, FALSE);
97 __set_error_message(ret, err_msg);
98 return MEDIA_SVC_PLUGIN_ERROR;
101 return MEDIA_SVC_PLUGIN_ERROR_NONE;
104 int disconnect_db(void *handle, char **err_msg)
106 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
108 if (handle == NULL) {
109 __set_error_message(ERR_HANDLE, err_msg);
110 return MEDIA_SVC_PLUGIN_ERROR;
113 ret = media_svc_disconnect(handle);
115 __set_error_message(ret, err_msg);
116 return MEDIA_SVC_PLUGIN_ERROR;
119 return MEDIA_SVC_PLUGIN_ERROR_NONE;
122 int cleanup_db(void *handle, uid_t uid, char **err_msg)
124 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
126 if (handle == NULL) {
127 __set_error_message(ERR_HANDLE, err_msg);
128 return MEDIA_SVC_PLUGIN_ERROR;
131 ret = media_svc_cleanup_db(handle, uid);
133 __set_error_message(ret, err_msg);
134 return MEDIA_SVC_PLUGIN_ERROR;
137 return MEDIA_SVC_PLUGIN_ERROR_NONE;
140 int check_item_exist(void *handle, const char *storage_id, const char *file_path, bool *modified, char **err_msg)
142 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
145 if (handle == NULL) {
146 __set_error_message(ERR_HANDLE, err_msg);
147 return MEDIA_SVC_PLUGIN_ERROR;
150 if (!STRING_VALID(file_path)) {
151 __set_error_message(ERR_FILE_PATH, err_msg);
152 return MEDIA_SVC_PLUGIN_ERROR;
155 time_t modified_time = 0;
156 unsigned long long file_size = 0;
159 ret = media_svc_get_file_info(handle, storage_id, file_path, &modified_time, &file_size);
160 if (ret == MS_MEDIA_ERR_NONE) {
161 memset(&st, 0, sizeof(struct stat));
162 if (stat(file_path, &st) == 0) {
163 if ((st.st_mtime != modified_time) || (st.st_size != file_size))
169 return MEDIA_SVC_PLUGIN_ERROR_NONE; /*exist */
172 __set_error_message(ERR_CHECK_ITEM, err_msg);
174 return MEDIA_SVC_PLUGIN_ERROR; /*not exist */
177 int insert_item_begin(void *handle, int item_cnt, int with_noti, int from_pid, char **err_msg)
179 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
181 ret = media_svc_insert_item_begin(item_cnt, with_noti, from_pid);
183 __set_error_message(ret, err_msg);
184 return MEDIA_SVC_PLUGIN_ERROR;
187 return MEDIA_SVC_PLUGIN_ERROR_NONE;
190 int insert_item_end(void *handle, uid_t uid, char **err_msg)
192 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
194 ret = media_svc_insert_item_end(uid);
196 __set_error_message(ret, err_msg);
197 return MEDIA_SVC_PLUGIN_ERROR;
200 return MEDIA_SVC_PLUGIN_ERROR_NONE;
203 int insert_item(void *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid, char **err_msg)
205 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
207 if (handle == NULL) {
208 __set_error_message(ERR_HANDLE, err_msg);
209 return MEDIA_SVC_PLUGIN_ERROR;
212 if (!STRING_VALID(file_path)) {
213 __set_error_message(ERR_FILE_PATH, err_msg);
214 return MEDIA_SVC_PLUGIN_ERROR;
217 if (!STORAGE_VALID(storage_type)) {
218 __set_error_message(ERR_STORAGE_TYPE, err_msg);
219 return MEDIA_SVC_PLUGIN_ERROR;
222 ret = media_svc_insert_item_bulk(handle, storage_id, storage_type, file_path, FALSE, uid);
224 __set_error_message(ret, err_msg);
225 return MEDIA_SVC_PLUGIN_ERROR;
228 return MEDIA_SVC_PLUGIN_ERROR_NONE;
231 int insert_burst_item(void *handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid, char **err_msg)
233 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
235 if (handle == NULL) {
236 __set_error_message(ERR_HANDLE, err_msg);
237 return MEDIA_SVC_PLUGIN_ERROR;
240 if (!STRING_VALID(file_path)) {
241 __set_error_message(ERR_FILE_PATH, err_msg);
242 return MEDIA_SVC_PLUGIN_ERROR;
245 if (!STORAGE_VALID(storage_type)) {
246 __set_error_message(ERR_STORAGE_TYPE, err_msg);
247 return MEDIA_SVC_PLUGIN_ERROR;
250 ret = media_svc_insert_item_bulk(handle, storage_id, storage_type, file_path, TRUE, uid);
252 __set_error_message(ret, err_msg);
253 return MEDIA_SVC_PLUGIN_ERROR;
256 return MEDIA_SVC_PLUGIN_ERROR_NONE;
259 int set_all_storage_items_validity(void *handle, const char *storage_id, int storage_type, int validity, uid_t uid, char **err_msg)
261 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
263 if (!STORAGE_VALID(storage_type)) {
264 __set_error_message(ERR_STORAGE_TYPE, err_msg);
265 return MEDIA_SVC_PLUGIN_ERROR;
268 ret = media_svc_set_all_storage_items_validity(storage_id, storage_type, validity, uid);
270 __set_error_message(ret, err_msg);
271 return MEDIA_SVC_PLUGIN_ERROR;
274 return MEDIA_SVC_PLUGIN_ERROR_NONE;
277 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)
279 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
281 if (handle == NULL) {
282 __set_error_message(ERR_HANDLE, err_msg);
283 return MEDIA_SVC_PLUGIN_ERROR;
286 if (!STRING_VALID(folder_path)) {
287 __set_error_message(ERR_FOLDER_PATH, err_msg);
288 return MEDIA_SVC_PLUGIN_ERROR;
291 ret = media_svc_set_folder_items_validity(handle, storage_id, folder_path, validity, recursive, uid);
293 __set_error_message(ret, err_msg);
294 return MEDIA_SVC_PLUGIN_ERROR;
297 return MEDIA_SVC_PLUGIN_ERROR_NONE;
300 int set_item_validity_begin(void *handle, int item_cnt, char **err_msg)
302 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
304 ret = media_svc_set_item_validity_begin(item_cnt);
306 __set_error_message(ret, err_msg);
307 return MEDIA_SVC_PLUGIN_ERROR;
310 return MEDIA_SVC_PLUGIN_ERROR_NONE;
313 int set_item_validity_end(void *handle, uid_t uid, char **err_msg)
315 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
317 ret = media_svc_set_item_validity_end(uid);
319 __set_error_message(ret, err_msg);
320 return MEDIA_SVC_PLUGIN_ERROR;
323 return MEDIA_SVC_PLUGIN_ERROR_NONE;
326 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)
328 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
330 if (!STRING_VALID(file_path)) {
331 __set_error_message(ERR_FILE_PATH, err_msg);
332 return MEDIA_SVC_PLUGIN_ERROR;
335 ret = media_svc_set_item_validity(storage_id, file_path, validity, uid);
338 __set_error_message(ret, err_msg);
339 return MEDIA_SVC_PLUGIN_ERROR;
342 return MEDIA_SVC_PLUGIN_ERROR_NONE;
345 int delete_item(void *handle, const char *storage_id, const char *file_path, uid_t uid, char **err_msg)
347 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
349 if (handle == NULL) {
350 __set_error_message(ERR_HANDLE, err_msg);
351 return MEDIA_SVC_PLUGIN_ERROR;
354 if (!STRING_VALID(file_path)) {
355 __set_error_message(ERR_FILE_PATH, err_msg);
356 return MEDIA_SVC_PLUGIN_ERROR;
359 ret = media_svc_check_item_exist_by_path(handle, storage_id, file_path);
361 ret = media_svc_delete_item_by_path(handle, storage_id, file_path, uid);
364 __set_error_message(ret, err_msg);
365 return MEDIA_SVC_PLUGIN_ERROR;
367 return MEDIA_SVC_PLUGIN_ERROR_NONE;
370 __set_error_message(ERR_CHECK_ITEM, err_msg); /*not exist in DB so can't delete item. */
371 return MEDIA_SVC_PLUGIN_ERROR;
374 int delete_all_invalid_items_in_storage(void *handle, const char *storage_id, int storage_type, uid_t uid, char **err_msg)
376 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
378 if (handle == NULL) {
379 __set_error_message(ERR_HANDLE, err_msg);
380 return MEDIA_SVC_PLUGIN_ERROR;
383 if (!STORAGE_VALID(storage_type)) {
384 __set_error_message(ERR_STORAGE_TYPE, err_msg);
385 return MEDIA_SVC_PLUGIN_ERROR;
388 ret = media_svc_delete_invalid_items_in_storage(handle, storage_id, storage_type, uid);
390 __set_error_message(ret, err_msg);
391 return MEDIA_SVC_PLUGIN_ERROR;
394 return MEDIA_SVC_PLUGIN_ERROR_NONE;
397 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)
399 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
401 if (!STRING_VALID(dir_path)) {
402 __set_error_message(ERR_FOLDER_PATH, err_msg);
403 return MEDIA_SVC_PLUGIN_ERROR;
406 ret = media_svc_send_dir_update_noti(handle, storage_id, dir_path, folder_id, (media_item_update_type_e)update_type, pid);
408 __set_error_message(ret, err_msg);
409 return MEDIA_SVC_PLUGIN_ERROR;
412 return MEDIA_SVC_PLUGIN_ERROR_NONE;
415 int check_db(void *handle, uid_t uid, char **err_msg)
417 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
418 int user_version = -1;
420 ret = media_svc_get_user_version(handle, &user_version);
422 __set_error_message(ret, err_msg);
423 return MEDIA_SVC_PLUGIN_ERROR;
426 if (user_version == 0) {
428 ret = media_svc_create_table(uid);
430 __set_error_message(ret, err_msg);
431 return MEDIA_SVC_PLUGIN_ERROR;
435 ret = media_svc_check_db_upgrade(handle, user_version, uid);
437 __set_error_message(ret, err_msg);
438 return MEDIA_SVC_PLUGIN_ERROR;
442 return MEDIA_SVC_PLUGIN_ERROR_NONE;
445 int update_folder_time(void *handle, const char *storage_id, char *folder_path, uid_t uid, char **err_msg)
448 return MEDIA_SVC_PLUGIN_ERROR_NONE;
451 int get_uuid(void * handle, char **uuid, char **err_msg)
453 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
455 ret = media_svc_generate_uuid(uuid);
457 __set_error_message(ret, err_msg);
458 return MEDIA_SVC_PLUGIN_ERROR;
461 return MEDIA_SVC_PLUGIN_ERROR_NONE;
464 int check_storage(void * handle, const char *storage_id, char **storage_path, int *validity, uid_t uid, char **err_msg)
466 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
468 if (handle == NULL) {
469 __set_error_message(ERR_HANDLE, err_msg);
470 return MEDIA_SVC_PLUGIN_ERROR;
473 ret = media_svc_check_storage(handle, storage_id, storage_path, validity, uid);
475 __set_error_message(ret, err_msg);
476 return MEDIA_SVC_PLUGIN_ERROR;
479 return MEDIA_SVC_PLUGIN_ERROR_NONE;
482 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)
484 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
486 if (handle == NULL) {
487 __set_error_message(ERR_HANDLE, err_msg);
488 return MEDIA_SVC_PLUGIN_ERROR;
491 ret = media_svc_insert_storage(handle, storage_id, storage_name, storage_path, storage_type, uid);
493 __set_error_message(ret, err_msg);
494 return MEDIA_SVC_PLUGIN_ERROR;
497 return MEDIA_SVC_PLUGIN_ERROR_NONE;
500 int update_storage(void *handle, const char *storage_id, const char *storage_path, uid_t uid, char **err_msg)
502 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
504 if (handle == NULL) {
505 __set_error_message(ERR_HANDLE, err_msg);
506 return MEDIA_SVC_PLUGIN_ERROR;
509 ret = media_svc_update_storage(handle, storage_id, storage_path, uid);
511 __set_error_message(ret, err_msg);
512 return MEDIA_SVC_PLUGIN_ERROR;
515 return MEDIA_SVC_PLUGIN_ERROR_NONE;
518 int set_storage_validity(void * handle, const char *storage_id, int validity, uid_t uid, char **err_msg)
520 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
522 if (handle == NULL) {
523 __set_error_message(ERR_HANDLE, err_msg);
524 return MEDIA_SVC_PLUGIN_ERROR;
527 ret = media_svc_set_storage_validity(handle, storage_id, validity, uid);
529 __set_error_message(ret, err_msg);
530 return MEDIA_SVC_PLUGIN_ERROR;
533 return MEDIA_SVC_PLUGIN_ERROR_NONE;
536 int set_all_storage_validity(void * handle, int validity, uid_t uid, char **err_msg)
538 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
540 if (handle == NULL) {
541 __set_error_message(ERR_HANDLE, err_msg);
542 return MEDIA_SVC_PLUGIN_ERROR;
545 ret = media_svc_set_storage_validity(handle, NULL, validity, uid);
547 __set_error_message(ret, err_msg);
548 return MEDIA_SVC_PLUGIN_ERROR;
551 return MEDIA_SVC_PLUGIN_ERROR_NONE;
554 int get_storage_id(void * handle, const char *path, char *storage_id, uid_t uid, char **err_msg)
556 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
558 if (handle == NULL) {
559 __set_error_message(ERR_HANDLE, err_msg);
560 return MEDIA_SVC_PLUGIN_ERROR;
563 ret = media_svc_get_storage_id(handle, path, storage_id, uid);
565 __set_error_message(ret, err_msg);
566 return MEDIA_SVC_PLUGIN_ERROR;
569 return MEDIA_SVC_PLUGIN_ERROR_NONE;
572 int set_storage_scan_status(void *handle, const char *storage_id, int status, uid_t uid, char **err_msg)
575 return MEDIA_SVC_PLUGIN_ERROR_NONE;
578 int get_storage_list(void *handle, char ***storage_list, char ***storage_id_list, int **scan_status_list, int *count, char **err_msg)
580 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
582 if (handle == NULL) {
583 __set_error_message(ERR_HANDLE, err_msg);
584 return MEDIA_SVC_PLUGIN_ERROR;
588 __set_error_message(ERR_HANDLE, err_msg);
589 return MEDIA_SVC_PLUGIN_ERROR;
592 ret = media_svc_get_storage_list(handle, storage_list, storage_id_list, scan_status_list, count);
594 __set_error_message(ret, err_msg);
595 return MEDIA_SVC_PLUGIN_ERROR;
598 return MEDIA_SVC_PLUGIN_ERROR_NONE;
601 int update_item_begin(void *handle, int item_cnt, char **err_msg)
603 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
605 ret = media_svc_update_item_begin(item_cnt);
607 __set_error_message(ret, err_msg);
608 return MEDIA_SVC_PLUGIN_ERROR;
611 return MEDIA_SVC_PLUGIN_ERROR_NONE;
614 int update_item_end(void *handle, uid_t uid, char **err_msg)
616 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
618 ret = media_svc_update_item_end(uid);
620 __set_error_message(ret, err_msg);
621 return MEDIA_SVC_PLUGIN_ERROR;
624 return MEDIA_SVC_PLUGIN_ERROR_NONE;
627 int update_item_meta(void *handle, const char *file_path, const char *storage_id, int storage_type, uid_t uid, char **err_msg)
629 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
631 if (handle == NULL) {
632 __set_error_message(ERR_HANDLE, err_msg);
633 return MEDIA_SVC_PLUGIN_ERROR;
636 if (file_path == NULL) {
637 __set_error_message(ERR_HANDLE, err_msg);
638 return MEDIA_SVC_PLUGIN_ERROR;
641 if (storage_id == NULL) {
642 __set_error_message(ERR_HANDLE, err_msg);
643 return MEDIA_SVC_PLUGIN_ERROR;
646 ret = media_svc_update_item_meta(handle, file_path, storage_id, storage_type, uid);
648 __set_error_message(ret, err_msg);
649 return MEDIA_SVC_PLUGIN_ERROR;
652 return MEDIA_SVC_PLUGIN_ERROR_NONE;
655 int insert_item_scan(void * handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid, char **err_msg)
658 return MEDIA_SVC_PLUGIN_ERROR_NONE;
661 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)
664 return MEDIA_SVC_PLUGIN_ERROR_NONE;
667 int update_one_extract_item(void* handle, const char* storage_id, int storage_type, void* data, int burst, char** err_msg)
670 return MEDIA_SVC_PLUGIN_ERROR_NONE;
673 int query_do_update_list(void* handle, char** err_msg)
676 return MEDIA_SVC_PLUGIN_ERROR_NONE;
679 int delete_all_invalid_items_in_folder(void **handle, const char* storage_id, const char*path, bool is_recursive, uid_t uid)
682 return MEDIA_SVC_PLUGIN_ERROR_NONE;
685 int delete_invalid_folder_by_path(void **handle, const char *storage_id, const char *folder_path, uid_t uid)
688 return MEDIA_SVC_PLUGIN_ERROR_NONE;
691 int insert_folder_begin(void * handle, int item_cnt, char **err_msg)
693 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
695 ret = media_svc_insert_folder_begin(item_cnt);
697 __set_error_message(ret, err_msg);
698 return MEDIA_SVC_PLUGIN_ERROR;
701 return MEDIA_SVC_PLUGIN_ERROR_NONE;
704 int insert_folder_end(void *handle, uid_t uid, char **err_msg)
706 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
708 ret = media_svc_insert_folder_end(uid);
710 __set_error_message(ret, err_msg);
711 return MEDIA_SVC_PLUGIN_ERROR;
714 return MEDIA_SVC_PLUGIN_ERROR_NONE;
717 int insert_folder(void * handle, const char *storage_id, const char *file_path, int storage_type, uid_t uid, char **err_msg)
719 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
721 if (handle == NULL) {
722 __set_error_message(ERR_HANDLE, err_msg);
723 return MEDIA_SVC_PLUGIN_ERROR;
726 if (!STRING_VALID(file_path)) {
727 __set_error_message(ERR_FILE_PATH, err_msg);
728 return MEDIA_SVC_PLUGIN_ERROR;
731 if (!STORAGE_VALID(storage_type)) {
732 __set_error_message(ERR_STORAGE_TYPE, err_msg);
733 return MEDIA_SVC_PLUGIN_ERROR;
736 ret = media_svc_insert_folder(handle, storage_id, storage_type, file_path, uid);
738 __set_error_message(ret, err_msg);
739 return MEDIA_SVC_PLUGIN_ERROR;
742 return MEDIA_SVC_PLUGIN_ERROR_NONE;
745 int delete_invalid_folder(void * handle, const char *storage_id, int storage_type, uid_t uid, char **err_msg)
747 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
749 ret = media_svc_delete_invalid_folder(storage_id, storage_type, uid);
751 __set_error_message(ret, err_msg);
752 return MEDIA_SVC_PLUGIN_ERROR;
755 return MEDIA_SVC_PLUGIN_ERROR_NONE;
758 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)
760 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
762 if (handle == NULL) {
763 __set_error_message(ERR_HANDLE, err_msg);
764 return MEDIA_SVC_PLUGIN_ERROR;
767 ret = media_svc_set_folder_validity(handle, storage_id, start_path, validity, is_recursive, uid);
769 __set_error_message(ret, err_msg);
770 return MEDIA_SVC_PLUGIN_ERROR;
773 return MEDIA_SVC_PLUGIN_ERROR_NONE;
776 int get_folder_scan_status(void *handle, const char *storage_id, const char *path, int *status, char **err_msg)
779 return MEDIA_SVC_PLUGIN_ERROR_NONE;
782 int set_folder_scan_status(void *handle, const char *storage_id, const char *path, int status, uid_t uid, char **err_msg)
785 return MEDIA_SVC_PLUGIN_ERROR_NONE;
788 int check_folder_modified(void *handle, const char *path, const char *storage_id, bool *modified, char **err_msg)
791 return MEDIA_SVC_PLUGIN_ERROR_NONE;
794 int get_null_scan_folder_list(void *handle, const char *storage_id, const char *folder_path, char ***folder_list, int *count, char **err_msg)
797 return MEDIA_SVC_PLUGIN_ERROR_NONE;
800 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)
803 return MEDIA_SVC_PLUGIN_ERROR_NONE;
806 int check_folder_exist(void * handle, const char *storage_id, const char *folder_path, char **err_msg)
808 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
810 if (handle == NULL) {
811 __set_error_message(ERR_HANDLE, err_msg);
812 return MEDIA_SVC_PLUGIN_ERROR;
815 ret = media_svc_check_folder_exist_by_path(handle, storage_id, folder_path);
817 __set_error_message(ret, err_msg);
818 return MEDIA_SVC_PLUGIN_ERROR;
821 return MEDIA_SVC_PLUGIN_ERROR_NONE;
824 int get_folder_id(void * handle, const char *storage_id, const char *path, char *folder_id, char **err_msg)
826 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
828 if (handle == NULL) {
829 __set_error_message(ERR_HANDLE, err_msg);
830 return MEDIA_SVC_PLUGIN_ERROR;
833 ret = media_svc_get_folder_id(handle, storage_id, path, folder_id);
835 __set_error_message(ret, err_msg);
836 return MEDIA_SVC_PLUGIN_ERROR;
839 return MEDIA_SVC_PLUGIN_ERROR_NONE;
842 int get_media_type(void *handle, const char *path, int *mediatype, char **err_msg)
844 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
846 if (handle == NULL) {
847 __set_error_message(ERR_HANDLE, err_msg);
848 return MEDIA_SVC_PLUGIN_ERROR;
851 ret = media_svc_get_media_type(path, mediatype);
853 __set_error_message(ret, err_msg);
854 return MEDIA_SVC_PLUGIN_ERROR;
857 return MEDIA_SVC_PLUGIN_ERROR_NONE;