Use nlohmann::json::count so it works with the version shipped in Debian 10
This commit is contained in:
parent
886e714873
commit
acfe00ef21
8
main.cpp
8
main.cpp
|
@ -410,19 +410,19 @@ int main()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(config.contains("apiKey") && config["apiKey"].is_string()) {
|
if(config.count("apiKey") && config["apiKey"].is_string()) {
|
||||||
yt_config.api_key = config["apiKey"];
|
yt_config.api_key = config["apiKey"];
|
||||||
} else {
|
} else {
|
||||||
tui_abort("A YouTube API key is required for this application to function.\n Please provide one in the config file.");
|
tui_abort("A YouTube API key is required for this application to function.\n Please provide one in the config file.");
|
||||||
}
|
}
|
||||||
if(config.contains("extraHeaders") && config["extraHeaders"].is_array()) {
|
if(config.count("extraHeaders") && config["extraHeaders"].is_array()) {
|
||||||
for(const json &elem: config["extraHeaders"]) {
|
for(const json &elem: config["extraHeaders"]) {
|
||||||
if(elem.contains("key") && elem["key"].is_string() && elem.contains("value") && elem["value"].is_string()) {
|
if(elem.count("key") && elem["key"].is_string() && elem.count("value") && elem["value"].is_string()) {
|
||||||
yt_config.extra_headers.emplace(elem["key"], elem["value"]);
|
yt_config.extra_headers.emplace(elem["key"], elem["value"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(config.contains("database") && config["database"].is_string()) {
|
if(config.count("database") && config["database"].is_string()) {
|
||||||
database_filename = config["database"];
|
database_filename = config["database"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
yt.cpp
2
yt.cpp
|
@ -217,7 +217,7 @@ void Channel::fetch_new_videos(sqlite3 *db, progress_info *info, std::optional<s
|
||||||
if(info)
|
if(info)
|
||||||
update_progress(info, processed, results);
|
update_progress(info, processed, results);
|
||||||
|
|
||||||
if(!abort && response.contains("nextPageToken")) {
|
if(!abort && response.count("nextPageToken")) {
|
||||||
params["pageToken"] = response["nextPageToken"];
|
params["pageToken"] = response["nextPageToken"];
|
||||||
//fprintf(stderr, "Processed %d. Next page...\r\n", processed);
|
//fprintf(stderr, "Processed %d. Next page...\r\n", processed);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue