From: Andrzej Popowski Date: Mon, 6 Jul 2015 12:52:30 +0000 (+0200) Subject: [Content] - Fixing problem wit the function getLyrics() X-Git-Tag: submit/tizen/20150702.103311^2~1^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5e8d0a9a377c4a782abe02cf513d93925bdcde8f;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Content] - Fixing problem wit the function getLyrics() Change-Id: I90a6fab6a9b605f1d0d99264cda5152b5139205e Signed-off-by: Andrzej Popowski --- diff --git a/src/content/content_manager.cc b/src/content/content_manager.cc index 0c8800cb..eece346c 100755 --- a/src/content/content_manager.cc +++ b/src/content/content_manager.cc @@ -1172,7 +1172,7 @@ int ContentManager::getLyrics(const picojson::value& args, picojson::object& res ret = metadata_extractor_set_path(extractor, contentURI.c_str()); if (ret != METADATA_EXTRACTOR_ERROR_NONE) { LOGGER(ERROR) << "metadata_extractor_set_path failed, error: " << ret; - return -1; + return ret; } picojson::array timestamps; picojson::array texts = picojson::array(); @@ -1182,11 +1182,15 @@ int ContentManager::getLyrics(const picojson::value& args, picojson::object& res METADATA_SYNCLYRICS_NUM, &strSyncTextNum); if (ret != METADATA_EXTRACTOR_ERROR_NONE) { LOGGER(ERROR) << "Media extractor error " << ret; + return ret; } - int nSyncTextNum = atoi(strSyncTextNum); - free(strSyncTextNum); - strSyncTextNum = NULL; + int nSyncTextNum = 0; + if (strSyncTextNum) { + nSyncTextNum = atoi(strSyncTextNum); + free(strSyncTextNum); + strSyncTextNum = NULL; + } if (nSyncTextNum > 0) { result["type"] = picojson::value(std::string("SYNCHRONIZED")); for (int i = 0; i < nSyncTextNum; i++) { diff --git a/src/content/js/datatypes.js b/src/content/js/datatypes.js index 5a09f8b1..e04df4d2 100755 --- a/src/content/js/datatypes.js +++ b/src/content/js/datatypes.js @@ -478,7 +478,7 @@ function AudioContent(data) { var result = native_.callSync('ContentManager_getLyrics', data); if (native_.isFailure(result)) { - console.log('Getting lyrics failed for ' + contentURI); + console.log('Getting lyrics failed for ' + data.contentURI); return; }