Use parseJsonFromString() for parsing json data in

- CMoviePlayerGui::luaGetUrl()
    - CTimerList::RemoteBoxChanExists()
    - CTimerList::RemoteBoxTimerList()
    - CTimerList::paintItem()
    - cTmdb::GetMovieDetails()
    - cYTFeedParser::parseFeedJSON()
    - cYTFeedParser::parseFeedDetailsJSON()
This commit is contained in:
M. Liebmann
2017-09-19 21:39:59 +02:00
parent 05d8ed4105
commit 25ae929523
4 changed files with 36 additions and 33 deletions

View File

@@ -35,6 +35,7 @@
#include "system/settings.h"
#include "system/helpers.h"
#include <system/helpers-json.h>
#include "system/set_threadname.h"
#include "gui/widget/hintbox.h"
@@ -197,12 +198,12 @@ bool cTmdb::GetMovieDetails(std::string lang)
if (!getUrl(url, answer))
return false;
string errMsg = "";
Json::Value root;
Json::Reader reader;
bool parsedSuccess = reader.parse(answer, root, false);
if (!parsedSuccess) {
bool ok = parseJsonFromString(answer, &root, &errMsg);
if (!ok) {
printf("Failed to parse JSON\n");
printf("%s\n", reader.getFormattedErrorMessages().c_str());
printf("%s\n", errMsg.c_str());
return false;
}
@@ -219,10 +220,11 @@ bool cTmdb::GetMovieDetails(std::string lang)
answer.clear();
if (!getUrl(url, answer))
return false;
parsedSuccess = reader.parse(answer, root, false);
if (!parsedSuccess) {
ok = parseJsonFromString(answer, &root, &errMsg);
if (!ok) {
printf("Failed to parse JSON\n");
printf("%s\n", reader.getFormattedErrorMessages().c_str());
printf("%s\n", errMsg.c_str());
return false;
}