weather: introduce string g_settings.weather_postcode

Origin commit data
------------------
Commit: 46cf941937
Author: vanhofen <vanhofen@gmx.de>
Date: 2022-01-22 (Sat, 22 Jan 2022)

Origin message was:
------------------
- weather: introduce string g_settings.weather_postcode
This commit is contained in:
vanhofen
2022-01-22 00:47:10 +01:00
parent 0ef7810ebf
commit 5ecc7805bf
6 changed files with 9 additions and 10 deletions

View File

@@ -182,12 +182,9 @@ bool CWeather::GetWeatherDetails()
return false;
}
bool CWeather::FindCoords(int postcode, std::string country, int pc_len)
bool CWeather::FindCoords(std::string postcode, std::string country)
{
std::string pcode = to_string(postcode);
unsigned int number_of_zeros = pc_len - pcode.length();
pcode.insert(0, number_of_zeros, '0');
std::string data = "http://api.openweathermap.org/geo/1.0/zip?zip=" + pcode + "," + country + "&appid=" + key;
std::string data = "http://api.openweathermap.org/geo/1.0/zip?zip=" + postcode + "," + country + "&appid=" + key;
JSONCPP_STRING answer;
JSONCPP_STRING formattedErrors;
Json::CharReaderBuilder builder;