X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/52deb6911957f840a0191f73c8a9626bd9ff5086..945f220e022e69c1aeda0ee86558be26f19bdd40:/widgets/weather.lua diff --git a/widgets/weather.lua b/widgets/weather.lua index 741c9dc..fb37a52 100644 --- a/widgets/weather.lua +++ b/widgets/weather.lua @@ -78,9 +78,7 @@ local function worker(args) function weather.forecast_update() local cmd = string.format(forecast_call, city_id, units, lang, cnt) async.request(cmd, function(f) - j = f:read("*all") - f:close() - weather_now, pos, err = json.decode(j, 1, nil) + weather_now, pos, err = json.decode(f, 1, nil) if not err and weather_now ~= nil and tonumber(weather_now["cod"]) == 200 then weather.notification_text = '' @@ -110,9 +108,7 @@ local function worker(args) function weather.update() local cmd = string.format(current_call, city_id, units, lang) async.request(cmd, function(f) - j = f:read("*all") - f:close() - weather_now, pos, err = json.decode(j, 1, nil) + weather_now, pos, err = json.decode(f, 1, nil) if not err and weather_now ~= nil and tonumber(weather_now["cod"]) == 200 then weather.icon_path = icons_path .. weather_now["weather"][1]["icon"] .. ".png"