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.
24 #include <media-thumbnail.h>
25 #include "media-svc.h"
27 #define MEDIA_SVC_PLUGIN_ERROR_NONE 0
28 #define MEDIA_SVC_PLUGIN_ERROR -1
30 #define STRING_VALID(str) \
31 ((str != NULL && strlen(str) > 0) ? TRUE : FALSE)
32 #define STORAGE_VALID(storage)\
33 (((storage == MEDIA_SVC_STORAGE_INTERNAL) || (storage == MEDIA_SVC_STORAGE_EXTERNAL)) ? TRUE : FALSE)
45 }media_svc_error_type_e;
47 #define MS_CATEGORY_UNKNOWN 0x00000000 /**< Default */
48 #define MS_CATEGORY_ETC 0x00000001 /**< ETC category */
49 #define MS_CATEGORY_IMAGE 0x00000002 /**< Image category */
50 #define MS_CATEGORY_VIDEO 0x00000004 /**< Video category */
51 #define MS_CATEGORY_MUSIC 0x00000008 /**< Music category */
52 #define MS_CATEGORY_SOUND 0x00000010 /**< Sound category */
54 #define CONTENT_TYPE_NUM 4
55 #define MUSIC_MIME_NUM 29
56 #define SOUND_MIME_NUM 1
57 #define MIME_TYPE_LENGTH 255
58 #define MIME_LENGTH 50
59 #define _3GP_FILE ".3gp"
60 #define _MP4_FILE ".mp4"
64 char content_type[15];
66 } fex_content_table_t;
68 static const fex_content_table_t content_category[CONTENT_TYPE_NUM] = {
69 {"audio", MS_CATEGORY_SOUND},
70 {"image", MS_CATEGORY_IMAGE},
71 {"video", MS_CATEGORY_VIDEO},
72 {"application", MS_CATEGORY_ETC},
75 static const char music_mime_table[MUSIC_MIME_NUM][MIME_LENGTH] = {
76 /*known mime types of normal files*/
82 /* known mime types of drm files*/
84 "x-mp3", /*alias of audio/mpeg*/
85 "x-mpeg", /*alias of audio/mpeg*/
87 "x-ogg", /*alias of audio/ogg*/
88 "vnd.ms-playready.media.pya:*.pya", /*playready*/
91 "x-m4a", /*alias of audio/mp4*/
92 /* below mimes are rare*/
102 "x-vorbis", /*alias of audio/x-vorbis+ogg*/
103 "vorbis", /*alias of audio/x-vorbis+ogg*/
105 "x-mp2", /*alias of audio/mp2*/
106 "x-pn-realaudio", /*alias of audio/vnd.rn-realaudio*/
107 "vnd.m-realaudio", /*alias of audio/vnd.rn-realaudio*/
111 static const char sound_mime_table[SOUND_MIME_NUM][MIME_LENGTH] = {
115 static int __get_content_type_from_mime(const char * path, const char * mimetype, int * category);
116 static int __get_content_type(const char * file_path, const char * mime_type);
117 static void __set_error_message(int err_type, char ** err_msg);
119 static int __get_content_type_from_mime(const char * path, const char * mimetype, int * category)
124 *category = MS_CATEGORY_UNKNOWN;
126 //MS_DBG("mime type : %s", mimetype);
128 /*categorize from mimetype */
129 for (i = 0; i < CONTENT_TYPE_NUM; i++) {
130 if (strstr(mimetype, content_category[i].content_type) != NULL) {
131 *category = (*category | content_category[i].category_by_mime);
136 /*in application type, exitst sound file ex) x-smafs */
137 if (*category & MS_CATEGORY_ETC) {
138 int prefix_len = strlen(content_category[0].content_type);
140 for (i = 0; i < SOUND_MIME_NUM; i++) {
141 if (strstr(mimetype + prefix_len, sound_mime_table[i]) != NULL) {
142 *category ^= MS_CATEGORY_ETC;
143 *category |= MS_CATEGORY_SOUND;
149 /*check music file in soun files. */
150 if (*category & MS_CATEGORY_SOUND) {
151 int prefix_len = strlen(content_category[0].content_type) + 1;
153 //MS_DBG("mime_type : %s", mimetype + prefix_len);
155 for (i = 0; i < MUSIC_MIME_NUM; i++) {
156 if (strcmp(mimetype + prefix_len, music_mime_table[i]) == 0) {
157 *category ^= MS_CATEGORY_SOUND;
158 *category |= MS_CATEGORY_MUSIC;
163 /*m3u file is playlist but mime type is "audio/x-mpegurl". but It has to be classified into MS_CATEGORY_ETC since playlist is not a sound track*/
164 if(strncasecmp(mimetype, "audio/x-mpegurl", strlen("audio/x-mpegurl")) == 0) {
165 *category ^= MS_CATEGORY_SOUND;
166 *category |= MS_CATEGORY_ETC;
168 } else if (*category & MS_CATEGORY_VIDEO) {
169 /*some video files don't have video stream. in this case it is categorize as music. */
170 /*"3gp" and "mp4" must check video stream and then categorize in directly. */
171 char file_ext[10] = {0};
172 memset(file_ext, 0, sizeof(file_ext));
173 if((_media_svc_get_file_ext(path, file_ext)) && strlen(file_ext) > 0) {
174 if ((strncasecmp(file_ext, _3GP_FILE, 4) == 0) || (strncasecmp(file_ext, _MP4_FILE, 5) == 0)) {
178 err = mm_file_get_stream_info(path, &audio, &video);
180 if (audio > 0 && video == 0) {
181 *category ^= MS_CATEGORY_VIDEO;
182 *category |= MS_CATEGORY_MUSIC;
189 //MS_DBG("category_from_ext : %d", *category);
194 static int __get_content_type(const char * file_path, const char * mime_type)
196 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
199 ret = __get_content_type_from_mime(file_path, mime_type, &category);
201 if (category & MS_CATEGORY_SOUND) return MEDIA_SVC_MEDIA_TYPE_SOUND;
202 else if (category & MS_CATEGORY_MUSIC) return MEDIA_SVC_MEDIA_TYPE_MUSIC;
203 else if (category & MS_CATEGORY_IMAGE) return MEDIA_SVC_MEDIA_TYPE_IMAGE;
204 else if (category & MS_CATEGORY_VIDEO) return MEDIA_SVC_MEDIA_TYPE_VIDEO;
205 else return MEDIA_SVC_MEDIA_TYPE_OTHER;
208 static void __set_error_message(int err_type, char ** err_msg)
215 if(err_type == ERR_HANDLE)
216 *err_msg = strdup("invalid handle");
217 else if(err_type == ERR_FILE_PATH)
218 *err_msg = strdup("invalid file path");
219 else if(err_type == ERR_FOLDER_PATH)
220 *err_msg = strdup("invalid folder path");
221 else if(err_type == ERR_MIME_TYPE)
222 *err_msg = strdup("invalid mime type");
223 else if(err_type == ERR_NOT_MEDIAFILE)
224 *err_msg = strdup("not media content");
225 else if(err_type == ERR_STORAGE_TYPE)
226 *err_msg = strdup("invalid storage type");
227 else if(err_type == ERR_CHECK_ITEM)
228 *err_msg = strdup("item does not exist");
229 else if(err_type == MEDIA_INFO_ERROR_DATABASE_CONNECT)
230 *err_msg = strdup("DB connect error");
231 else if(err_type == MEDIA_INFO_ERROR_DATABASE_DISCONNECT)
232 *err_msg = strdup("DB disconnect error");
233 else if(err_type == MEDIA_INFO_ERROR_INVALID_PARAMETER)
234 *err_msg = strdup("invalid parameter");
235 else if(err_type == MEDIA_INFO_ERROR_DATABASE_INTERNAL)
236 *err_msg = strdup("DB internal error");
237 else if(err_type == MEDIA_INFO_ERROR_DATABASE_NO_RECORD)
238 *err_msg = strdup("not found in DB");
239 else if(err_type == MEDIA_INFO_ERROR_INTERNAL)
240 *err_msg = strdup("media service internal error");
242 *err_msg = strdup("error unknown");
247 int check_item(const char *file_path, const char * mime_type, char ** err_msg)
249 if (!STRING_VALID(file_path)) {
250 __set_error_message(ERR_FILE_PATH, err_msg);
251 return MEDIA_SVC_PLUGIN_ERROR;
254 if (!STRING_VALID(mime_type)) {
255 __set_error_message(ERR_MIME_TYPE, err_msg);
256 return MEDIA_SVC_PLUGIN_ERROR;
259 return MEDIA_SVC_PLUGIN_ERROR_NONE;
262 int connect(void ** handle, char ** err_msg)
264 int ret = media_svc_connect(handle);
267 __set_error_message(ret, err_msg);
268 return MEDIA_SVC_PLUGIN_ERROR;
271 return MEDIA_SVC_PLUGIN_ERROR_NONE;
274 int disconnect(void * handle, char ** err_msg)
276 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
279 __set_error_message(ERR_HANDLE, err_msg);
280 return MEDIA_SVC_PLUGIN_ERROR;
283 ret = media_svc_disconnect(handle);
285 __set_error_message(ret, err_msg);
286 return MEDIA_SVC_PLUGIN_ERROR;
289 return MEDIA_SVC_PLUGIN_ERROR_NONE;
292 int check_item_exist(void* handle, const char *file_path, int storage_type, char ** err_msg)
294 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
297 __set_error_message(ERR_HANDLE, err_msg);
298 return MEDIA_SVC_PLUGIN_ERROR;
301 if (!STRING_VALID(file_path)) {
302 __set_error_message(ERR_FILE_PATH, err_msg);
303 return MEDIA_SVC_PLUGIN_ERROR;
306 if(!STORAGE_VALID(storage_type)) {
307 __set_error_message(ERR_STORAGE_TYPE, err_msg);
308 return MEDIA_SVC_PLUGIN_ERROR;
311 ret = media_svc_check_item_exist_by_path(handle, file_path);
312 if(ret == MEDIA_INFO_ERROR_NONE)
313 return MEDIA_SVC_PLUGIN_ERROR_NONE; //exist
315 __set_error_message(ERR_CHECK_ITEM, err_msg);
317 return MEDIA_SVC_PLUGIN_ERROR; //not exist
320 int insert_item_begin(void * handle, int item_cnt, int with_noti, int from_pid, char ** err_msg)
322 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
325 __set_error_message(ERR_HANDLE, err_msg);
326 return MEDIA_SVC_PLUGIN_ERROR;
329 ret = media_svc_insert_item_begin(handle, item_cnt, with_noti, from_pid);
331 __set_error_message(ret, err_msg);
332 return MEDIA_SVC_PLUGIN_ERROR;
335 return MEDIA_SVC_PLUGIN_ERROR_NONE;
338 int insert_item_end(void * handle, char ** err_msg)
340 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
343 __set_error_message(ERR_HANDLE, err_msg);
344 return MEDIA_SVC_PLUGIN_ERROR;
347 ret = media_svc_insert_item_end(handle);
349 __set_error_message(ret, err_msg);
350 return MEDIA_SVC_PLUGIN_ERROR;
353 return MEDIA_SVC_PLUGIN_ERROR_NONE;
356 int insert_item(void * handle, const char *file_path, int storage_type, const char * mime_type, char ** err_msg)
358 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
361 __set_error_message(ERR_HANDLE, err_msg);
362 return MEDIA_SVC_PLUGIN_ERROR;
365 if (!STRING_VALID(file_path)) {
366 __set_error_message(ERR_FILE_PATH, err_msg);
367 return MEDIA_SVC_PLUGIN_ERROR;
370 if (!STRING_VALID(mime_type)) {
371 __set_error_message(ERR_MIME_TYPE, err_msg);
372 return MEDIA_SVC_PLUGIN_ERROR;
375 if(!STORAGE_VALID(storage_type)) {
376 __set_error_message(ERR_STORAGE_TYPE, err_msg);
377 return MEDIA_SVC_PLUGIN_ERROR;
380 media_svc_media_type_e content_type = __get_content_type(file_path, mime_type);
382 ret = media_svc_insert_item_bulk(handle, storage_type, file_path, mime_type, content_type, FALSE);
384 __set_error_message(ret, err_msg);
385 return MEDIA_SVC_PLUGIN_ERROR;
388 return MEDIA_SVC_PLUGIN_ERROR_NONE;
391 int insert_item_immediately(void * handle, const char *file_path, int storage_type, const char * mime_type, char ** err_msg)
393 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
396 __set_error_message(ERR_HANDLE, err_msg);
397 return MEDIA_SVC_PLUGIN_ERROR;
400 if (!STRING_VALID(file_path)) {
401 __set_error_message(ERR_FILE_PATH, err_msg);
402 return MEDIA_SVC_PLUGIN_ERROR;
405 if (!STRING_VALID(mime_type)) {
406 __set_error_message(ERR_MIME_TYPE, err_msg);
407 return MEDIA_SVC_PLUGIN_ERROR;
410 if(!STORAGE_VALID(storage_type)) {
411 __set_error_message(ERR_STORAGE_TYPE, err_msg);
412 return MEDIA_SVC_PLUGIN_ERROR;
415 media_svc_media_type_e content_type = __get_content_type(file_path, mime_type);
417 ret = media_svc_insert_item_immediately(handle, storage_type, file_path, mime_type, content_type);
420 __set_error_message(ret, err_msg);
421 return MEDIA_SVC_PLUGIN_ERROR;
424 return MEDIA_SVC_PLUGIN_ERROR_NONE;
427 int insert_burst_item(void * handle, const char *file_path, int storage_type, const char * mime_type, char ** err_msg)
429 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
432 __set_error_message(ERR_HANDLE, err_msg);
433 return MEDIA_SVC_PLUGIN_ERROR;
436 if (!STRING_VALID(file_path)) {
437 __set_error_message(ERR_FILE_PATH, err_msg);
438 return MEDIA_SVC_PLUGIN_ERROR;
441 if (!STRING_VALID(mime_type)) {
442 __set_error_message(ERR_MIME_TYPE, err_msg);
443 return MEDIA_SVC_PLUGIN_ERROR;
446 if(!STORAGE_VALID(storage_type)) {
447 __set_error_message(ERR_STORAGE_TYPE, err_msg);
448 return MEDIA_SVC_PLUGIN_ERROR;
451 media_svc_media_type_e content_type = __get_content_type(file_path, mime_type);
453 ret = media_svc_insert_item_bulk(handle, storage_type, file_path, mime_type, content_type, TRUE);
455 __set_error_message(ret, err_msg);
456 return MEDIA_SVC_PLUGIN_ERROR;
459 return MEDIA_SVC_PLUGIN_ERROR_NONE;
462 int move_item_begin(void * handle, int item_cnt, char ** err_msg)
464 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
467 __set_error_message(ERR_HANDLE, err_msg);
468 return MEDIA_SVC_PLUGIN_ERROR;
471 ret = media_svc_move_item_begin(handle, item_cnt);
473 __set_error_message(ret, err_msg);
474 return MEDIA_SVC_PLUGIN_ERROR;
477 return MEDIA_SVC_PLUGIN_ERROR_NONE;
480 int move_item_end(void * handle, char ** err_msg)
482 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
485 __set_error_message(ERR_HANDLE, err_msg);
486 return MEDIA_SVC_PLUGIN_ERROR;
489 ret = media_svc_move_item_end(handle);
491 __set_error_message(ret, err_msg);
492 return MEDIA_SVC_PLUGIN_ERROR;
495 return MEDIA_SVC_PLUGIN_ERROR_NONE;
498 int move_item(void * handle, const char *src_path, int src_storage_type, const char *dest_path, int dest_storage_type, const char * mime_type, char ** err_msg)
500 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
503 __set_error_message(ERR_HANDLE, err_msg);
504 return MEDIA_SVC_PLUGIN_ERROR;
507 if ((!STRING_VALID(src_path)) || (!STRING_VALID(dest_path))) {
508 __set_error_message(ERR_FILE_PATH, err_msg);
509 return MEDIA_SVC_PLUGIN_ERROR;
512 if (!STRING_VALID(mime_type)) {
513 __set_error_message(ERR_MIME_TYPE, err_msg);
514 return MEDIA_SVC_PLUGIN_ERROR;
517 if((!STORAGE_VALID(src_storage_type)) || (!STORAGE_VALID(dest_storage_type))) {
518 __set_error_message(ERR_STORAGE_TYPE, err_msg);
519 return MEDIA_SVC_PLUGIN_ERROR;
522 ret = media_svc_move_item(handle, src_storage_type, src_path, dest_storage_type, dest_path);
524 __set_error_message(ret, err_msg);
525 return MEDIA_SVC_PLUGIN_ERROR;
528 return MEDIA_SVC_PLUGIN_ERROR_NONE;
531 int set_all_storage_items_validity(void * handle, int storage_type, int validity, char ** err_msg)
533 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
536 __set_error_message(ERR_HANDLE, err_msg);
537 return MEDIA_SVC_PLUGIN_ERROR;
540 if(!STORAGE_VALID(storage_type)) {
541 __set_error_message(ERR_STORAGE_TYPE, err_msg);
542 return MEDIA_SVC_PLUGIN_ERROR;
545 ret = media_svc_set_all_storage_items_validity(handle, storage_type, validity);
547 __set_error_message(ret, err_msg);
548 return MEDIA_SVC_PLUGIN_ERROR;
551 return MEDIA_SVC_PLUGIN_ERROR_NONE;
554 int set_folder_item_validity(void * handle, const char * folder_path, int validity, int recursive, char ** err_msg)
556 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
559 __set_error_message(ERR_HANDLE, err_msg);
560 return MEDIA_SVC_PLUGIN_ERROR;
563 if (!STRING_VALID(folder_path)) {
564 __set_error_message(ERR_FOLDER_PATH, err_msg);
565 return MEDIA_SVC_PLUGIN_ERROR;
568 ret = media_svc_set_folder_items_validity(handle, folder_path, validity, recursive);
570 __set_error_message(ret, err_msg);
571 return MEDIA_SVC_PLUGIN_ERROR;
574 return MEDIA_SVC_PLUGIN_ERROR_NONE;
577 int set_item_validity_begin(void * handle, int item_cnt, char ** err_msg)
579 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
582 __set_error_message(ERR_HANDLE, err_msg);
583 return MEDIA_SVC_PLUGIN_ERROR;
586 ret = media_svc_set_item_validity_begin(handle, item_cnt);
588 __set_error_message(ret, err_msg);
589 return MEDIA_SVC_PLUGIN_ERROR;
592 return MEDIA_SVC_PLUGIN_ERROR_NONE;
595 int set_item_validity_end(void * handle, char ** err_msg)
597 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
600 __set_error_message(ERR_HANDLE, err_msg);
601 return MEDIA_SVC_PLUGIN_ERROR;
604 ret = media_svc_set_item_validity_end(handle);
606 __set_error_message(ret, err_msg);
607 return MEDIA_SVC_PLUGIN_ERROR;
610 return MEDIA_SVC_PLUGIN_ERROR_NONE;
613 int set_item_validity(void * handle, const char *file_path, int storage_type, const char * mime_type, int validity, char ** err_msg)
615 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
618 __set_error_message(ERR_HANDLE, err_msg);
619 return MEDIA_SVC_PLUGIN_ERROR;
622 if (!STRING_VALID(file_path)) {
623 __set_error_message(ERR_FILE_PATH, err_msg);
624 return MEDIA_SVC_PLUGIN_ERROR;
627 if (!STRING_VALID(mime_type)) {
628 __set_error_message(ERR_MIME_TYPE, err_msg);
629 return MEDIA_SVC_PLUGIN_ERROR;
632 if(!STORAGE_VALID(storage_type)) {
633 __set_error_message(ERR_STORAGE_TYPE, err_msg);
634 return MEDIA_SVC_PLUGIN_ERROR;
637 ret = media_svc_set_item_validity(handle, file_path, validity);
640 __set_error_message(ret, err_msg);
641 return MEDIA_SVC_PLUGIN_ERROR;
644 return MEDIA_SVC_PLUGIN_ERROR_NONE;
647 int delete_item(void * handle, const char *file_path, int storage_type, char ** err_msg)
649 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
652 __set_error_message(ERR_HANDLE, err_msg);
653 return MEDIA_SVC_PLUGIN_ERROR;
656 if (!STRING_VALID(file_path)) {
657 __set_error_message(ERR_FILE_PATH, err_msg);
658 return MEDIA_SVC_PLUGIN_ERROR;
661 if(!STORAGE_VALID(storage_type)) {
662 __set_error_message(ERR_STORAGE_TYPE, err_msg);
663 return MEDIA_SVC_PLUGIN_ERROR;
666 ret = media_svc_check_item_exist_by_path(handle, file_path);
668 ret = media_svc_delete_item_by_path(handle, file_path);
671 __set_error_message(ret, err_msg);
672 return MEDIA_SVC_PLUGIN_ERROR;
675 return MEDIA_SVC_PLUGIN_ERROR_NONE;
678 __set_error_message(ERR_CHECK_ITEM, err_msg); //not exist in DB so can't delete item.
679 return MEDIA_SVC_PLUGIN_ERROR;
682 int delete_all_items_in_storage(void * handle, int storage_type, char ** err_msg)
684 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
687 __set_error_message(ERR_HANDLE, err_msg);
688 return MEDIA_SVC_PLUGIN_ERROR;
691 if(!STORAGE_VALID(storage_type)) {
692 __set_error_message(ERR_STORAGE_TYPE, err_msg);
693 return MEDIA_SVC_PLUGIN_ERROR;
696 ret = media_svc_delete_all_items_in_storage(handle, storage_type);
698 __set_error_message(ret, err_msg);
699 return MEDIA_SVC_PLUGIN_ERROR;
702 return MEDIA_SVC_PLUGIN_ERROR_NONE;
705 int delete_all_invalid_items_in_storage(void * handle, int storage_type, char ** err_msg)
707 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
710 __set_error_message(ERR_HANDLE, err_msg);
711 return MEDIA_SVC_PLUGIN_ERROR;
714 if(!STORAGE_VALID(storage_type)) {
715 __set_error_message(ERR_STORAGE_TYPE, err_msg);
716 return MEDIA_SVC_PLUGIN_ERROR;
719 ret = media_svc_delete_invalid_items_in_storage(handle, storage_type);
721 __set_error_message(ret, err_msg);
722 return MEDIA_SVC_PLUGIN_ERROR;
725 return MEDIA_SVC_PLUGIN_ERROR_NONE;
728 int delete_all_invalid_items_in_folder(void * handle, const char *folder_path, char ** err_msg)
730 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
733 __set_error_message(ERR_HANDLE, err_msg);
734 return MEDIA_SVC_PLUGIN_ERROR;
737 if (!STRING_VALID(folder_path)) {
738 __set_error_message(ERR_FOLDER_PATH, err_msg);
739 return MEDIA_SVC_PLUGIN_ERROR;
742 ret = media_svc_delete_invalid_items_in_folder(handle, folder_path);
744 __set_error_message(ret, err_msg);
745 return MEDIA_SVC_PLUGIN_ERROR;
748 return MEDIA_SVC_PLUGIN_ERROR_NONE;
751 int delete_all_items(void * handle, char ** err_msg)
753 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
756 __set_error_message(ERR_HANDLE, err_msg);
757 return MEDIA_SVC_PLUGIN_ERROR;
760 ret = delete_all_items_in_storage(handle, MEDIA_SVC_STORAGE_INTERNAL, err_msg);
762 return MEDIA_SVC_PLUGIN_ERROR;
764 ret = delete_all_items_in_storage(handle, MEDIA_SVC_STORAGE_EXTERNAL, err_msg);
766 return MEDIA_SVC_PLUGIN_ERROR;
768 return MEDIA_SVC_PLUGIN_ERROR_NONE;
771 int refresh_item(void * handle, const char *file_path, int storage_type, const char * mime_type, char ** err_msg)
773 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
776 __set_error_message(ERR_HANDLE, err_msg);
777 return MEDIA_SVC_PLUGIN_ERROR;
780 if (!STRING_VALID(file_path)) {
781 __set_error_message(ERR_FILE_PATH, err_msg);
782 return MEDIA_SVC_PLUGIN_ERROR;
785 if (!STRING_VALID(mime_type)) {
786 __set_error_message(ERR_MIME_TYPE, err_msg);
787 return MEDIA_SVC_PLUGIN_ERROR;
790 if(!STORAGE_VALID(storage_type)) {
791 __set_error_message(ERR_STORAGE_TYPE, err_msg);
792 return MEDIA_SVC_PLUGIN_ERROR;
795 media_svc_media_type_e content_type = __get_content_type(file_path, mime_type);
797 ret = media_svc_refresh_item(handle, storage_type, file_path, content_type);
800 __set_error_message(ret, err_msg);
801 return MEDIA_SVC_PLUGIN_ERROR;
804 return MEDIA_SVC_PLUGIN_ERROR_NONE;
807 int update_begin(void)
809 return MEDIA_SVC_PLUGIN_ERROR_NONE;
814 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
816 ret = thumbnail_request_extract_all_thumbs();
818 return MEDIA_SVC_PLUGIN_ERROR;
821 return MEDIA_SVC_PLUGIN_ERROR_NONE;
824 int send_dir_update_noti(void * handle, const char *dir_path, char **err_msg)
826 int ret = MEDIA_SVC_PLUGIN_ERROR_NONE;
828 if (!STRING_VALID(dir_path)) {
829 __set_error_message(ERR_FOLDER_PATH, err_msg);
830 return MEDIA_SVC_PLUGIN_ERROR;
833 ret = media_svc_send_dir_update_noti(handle, dir_path);
835 __set_error_message(ret, err_msg);
836 return MEDIA_SVC_PLUGIN_ERROR;
839 return MEDIA_SVC_PLUGIN_ERROR_NONE;