reorganization

This commit is contained in:
Evgeny
2021-08-06 14:43:34 +03:00
parent 372ec8578d
commit 1e9b33eaea
52 changed files with 1044 additions and 20 deletions

38
ru/holydays-ru-widget.lua Normal file
View File

@@ -0,0 +1,38 @@
-- name = "Праздники"
-- description = "Виджет отображает предстоящие праздники."
-- data_source = "https://date.nager.at/"
-- type = "widget"
-- author = "Andrey Gavrilov"
-- version = "1.0"
--API--
local api_url = "https://date.nager.at/api/v3/NextPublicHolidays/RU"
--Настройка автосворачивания виджета--
local auto_folding = false
local lines = {}
local json = require "json"
local sx = require "pl.stringx"
function on_resume()
if auto_folding then
ui:set_folding_flag(true)
ui:show_lines(lines)
end
end
function on_alarm()
http:get(api_url)
end
function on_network_result(result)
local t = json.decode(result)
for i = 1, #t, 1 do
local date = sx.replace(t[i].date, "-", ".")
local name = t[i].localName
lines[i] = date.." - "..name
end
ui:show_lines(lines)
end