From 7d1ac56eaea7b9a116f1eb010d228c354f42d18c Mon Sep 17 00:00:00 2001 From: obma Date: Mon, 5 Oct 2015 20:19:14 +0200 Subject: [PATCH] p: updating openweather_: replaced fgrep, tr, cut with expr Use expr to extract values and names from the OpenWeather API xml instead of the - when using a city with spaces in its name not correctly working - fgrep | tr | cut construct. --- plugins/weather/openweather_ | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) mode change 100644 => 100755 plugins/weather/openweather_ diff --git a/plugins/weather/openweather_ b/plugins/weather/openweather_ old mode 100644 new mode 100755 index bbd3c7a4..a7eea886 --- a/plugins/weather/openweather_ +++ b/plugins/weather/openweather_ @@ -19,15 +19,13 @@ # env.apikey XYZ query_string=$(printf '%s' "${0#*_}" | tr '_' '=') -TMPFILE=$(mktemp) -trap 'rm -f $TMPFILE' EXIT +OWAPI=$( curl -s "http://api.openweathermap.org/data/2.5/weather?mode=xml&${query_string}") # API returns temp in K, we have to convert it in C +# &units=metric would change that ;-) KELVIN_BIAS=273 -curl -s "http://api.openweathermap.org/data/2.5/weather?mode=xml&${query_string}&APPID=${apikey}" > $TMPFILE - -CITY=$(fgrep "