mirror of https://github.com/lcpz/lain.git
#546: satisfy review requests
This commit is contained in:
parent
4382f5efdd
commit
14d9c637ab
|
@ -25,7 +25,7 @@ local function factory(args)
|
||||||
|
|
||||||
local weather = { widget = args.widget or wibox.widget.textbox() }
|
local weather = { widget = args.widget or wibox.widget.textbox() }
|
||||||
local APPID = args.APPID -- mandatory api key
|
local APPID = args.APPID -- mandatory api key
|
||||||
local timeout = args.timeout or 60 * 15 -- 15 min
|
local timeout = args.timeout or 900 -- 15 min
|
||||||
local current_call = args.current_call or "curl -s 'https://api.openweathermap.org/data/2.5/weather?lat=%s&lon=%s&APPID=%s&units=%s&lang=%s'"
|
local current_call = args.current_call or "curl -s 'https://api.openweathermap.org/data/2.5/weather?lat=%s&lon=%s&APPID=%s&units=%s&lang=%s'"
|
||||||
local forecast_call = args.forecast_call or "curl -s 'https://api.openweathermap.org/data/2.5/forecast?lat=%s&lon=%s&APPID=%s&cnt=%s&units=%s&lang=%s'"
|
local forecast_call = args.forecast_call or "curl -s 'https://api.openweathermap.org/data/2.5/forecast?lat=%s&lon=%s&APPID=%s&cnt=%s&units=%s&lang=%s'"
|
||||||
local lat = args.lat or 0 -- placeholder
|
local lat = args.lat or 0 -- placeholder
|
||||||
|
@ -89,6 +89,7 @@ local function factory(args)
|
||||||
|
|
||||||
function weather.forecast_update()
|
function weather.forecast_update()
|
||||||
local cmd = string.format(forecast_call, lat, lon, APPID, cnt, units, lang)
|
local cmd = string.format(forecast_call, lat, lon, APPID, cnt, units, lang)
|
||||||
|
|
||||||
helpers.async(cmd, function(f)
|
helpers.async(cmd, function(f)
|
||||||
local err
|
local err
|
||||||
weather_now, _, err = json.decode(f, 1, nil)
|
weather_now, _, err = json.decode(f, 1, nil)
|
||||||
|
@ -133,7 +134,6 @@ local function factory(args)
|
||||||
weather.widget:set_markup(weather_na_markup)
|
weather.widget:set_markup(weather_na_markup)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
weather.icon:set_image(weather.icon_path)
|
weather.icon:set_image(weather.icon_path)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue