static void* WorkThread(const std::shared_ptr<ReplyCallbackData>& user_data) {
LoggerD("entered");
+ int ret = MEDIA_CONTENT_ERROR_NONE;
ContentCallbacks cbType = user_data->cbType;
switch(cbType) {
case ContentManagerUpdatebatchCallback: {
- ContentManager::getInstance()->updateBatch(user_data->args);
+ ret = ContentManager::getInstance()->updateBatch(user_data->args);
+ if(ret != MEDIA_CONTENT_ERROR_NONE){
+ LoggerD("UpdateBatch Failed");
+ user_data->isSuccess = ContentManager::getInstance()->convertError(ret);
+ }
break;
}
case ContentManagerGetdirectoriesCallback: {
case ContentManagerScanfileCallback: {
std::string contentURI = user_data->args.get("contentURI").get<std::string>();
std::string real_path = common::VirtualFs::GetInstance().GetRealPath(contentURI);
- int res = ContentManager::getInstance()->scanFile(real_path);
- if (res != MEDIA_CONTENT_ERROR_NONE) {
- LOGGER(ERROR) << "Scan file failed, error: " << res;
+ ret = ContentManager::getInstance()->scanFile(real_path);
+ if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ LOGGER(ERROR) << "Scan file failed, error: " << ret;
common::PlatformResult err(common::ErrorCode::UNKNOWN_ERR, "Scan file failed.");
user_data->isSuccess = err;
}
void ContentManager::createPlaylist(std::string name,
const std::shared_ptr<ReplyCallbackData>& user_data) {
LoggerD("Enter");
- media_playlist_h playlist = NULL;
+ media_playlist_h playlist = NULL;
int ret = media_playlist_insert_to_db(name.c_str(),&playlist);
std::unique_ptr<std::remove_pointer<media_playlist_h>::type, int(*)(media_playlist_h)>
LoggerD("Enter");
int ret;
- filter_h filter = nullptr;
+ filter_h filter = nullptr;
media_filter_create(&filter);
std::unique_ptr<std::remove_pointer<filter_h>::type, int(*)(filter_h)>
filter_ptr(filter, &media_filter_destroy); // automatically release the memory
media_info_h media = NULL;
ret = media_info_get_media_from_db(id.c_str(), &media);
if (media != NULL && ret == MEDIA_CONTENT_ERROR_NONE) {
- setContent(media, content);
+ ret = setContent(media, content);
+ if(ret != MEDIA_CONTENT_ERROR_NONE){
+ LoggerE("setContent failed");
+ return ret;
+ }
+
ret = media_info_update_to_db(media);
+ if(ret != MEDIA_CONTENT_ERROR_NONE){
+ LoggerE("update to db failed");
+ }
media_info_destroy(media);
} else {
return ret;