[Content] - Fixing problem wit the function getLyrics()
authorAndrzej Popowski <a.popowski@samsung.com>
Mon, 6 Jul 2015 12:52:30 +0000 (14:52 +0200)
committerAndrzej Popowski <a.popowski@samsung.com>
Mon, 6 Jul 2015 12:52:30 +0000 (14:52 +0200)
Change-Id: I90a6fab6a9b605f1d0d99264cda5152b5139205e
Signed-off-by: Andrzej Popowski <a.popowski@samsung.com>
src/content/content_manager.cc
src/content/js/datatypes.js

index 0c8800cbcca16fc0d0803755ec7f0aa0239452b0..eece346c5480665b66e1d0fd1190313585e94d2f 100755 (executable)
@@ -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++) {
index 5a09f8b1323fc114c74c7d8574254f8786ddb8f7..e04df4d23f6215ce3bafd7079d0e2a29c97ec066 100755 (executable)
@@ -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;
     }