From 93990298e8235dd578d05d6e6ab4940306e344e1 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Sat, 27 Aug 2022 08:49:29 +0300 Subject: [PATCH] community scripts refactoring and cleanup --- community/apps-widget.lua | 1 + community/calllog-ru-root-widget.lua | 4 +- ...ile-explorer.lua => cloud-file-widget.lua} | 1 + community/conversations-widget.lua | 3 + community/currency-widget-ru.lua | 2 +- community/fifteen-widget.lua | 6 +- community/horoscope-widget.lua | 1 + .../{net-file.lua => net-file-widget.lua} | 3 + ...rogress.lua => period-progress-widget.lua} | 67 +++++++++---------- community/public-ip-search.lua | 4 +- community/{qr-code.lua => qr-code-search.lua} | 0 ...ion-search-ru.lua => region-ru-search.lua} | 14 +++- community/rss-widget.lua | 2 +- .../{share-menu.lua => share-menu-search.lua} | 0 community/sudoku-widget.lua | 6 +- 15 files changed, 72 insertions(+), 42 deletions(-) rename community/{cloud-file-explorer.lua => cloud-file-widget.lua} (95%) rename community/{net-file.lua => net-file-widget.lua} (71%) rename community/{period_progress.lua => period-progress-widget.lua} (96%) rename community/{qr-code.lua => qr-code-search.lua} (100%) rename community/{region-search-ru.lua => region-ru-search.lua} (91%) rename community/{share-menu.lua => share-menu-search.lua} (100%) diff --git a/community/apps-widget.lua b/community/apps-widget.lua index 72989f8..91f6de0 100644 --- a/community/apps-widget.lua +++ b/community/apps-widget.lua @@ -1,4 +1,5 @@ -- name = "My apps" +-- description = "Simple apps widget" -- type = "widget" -- version = "1.0" -- author = "Andrey Gavrilov" diff --git a/community/calllog-ru-root-widget.lua b/community/calllog-ru-root-widget.lua index 368c6bf..c6dfc41 100644 --- a/community/calllog-ru-root-widget.lua +++ b/community/calllog-ru-root-widget.lua @@ -1,8 +1,10 @@ -- name = "История вызовов" +-- description = "Скрипт показывает историю вызов через прямое чтение базы звонков" -- type = "widget" -- author = "Andrey Gavrilov" -- version = "1.0" --- root = "yes" +-- lang = "ru" +-- root = "true" local types = {"Входящие","Исходящие","Пропущенные","Отменённые","Отклонённые","Заблокированные","Все"} diff --git a/community/cloud-file-explorer.lua b/community/cloud-file-widget.lua similarity index 95% rename from community/cloud-file-explorer.lua rename to community/cloud-file-widget.lua index 2431a95..737dcf4 100644 --- a/community/cloud-file-explorer.lua +++ b/community/cloud-file-widget.lua @@ -1,4 +1,5 @@ -- name = "File Explorer" +-- description = "Dropbox file explorer. Shows only AIO Launcher subdirectory" -- type = "widget" -- version = "1.0" -- author = "Andrey Gavrilov" diff --git a/community/conversations-widget.lua b/community/conversations-widget.lua index 75d6069..13b2420 100644 --- a/community/conversations-widget.lua +++ b/community/conversations-widget.lua @@ -1,4 +1,7 @@ -- name = "Conversations" +-- description = "Dialogs widget anologue" +-- author = "Evgeny Zobnin (zobnin@gmail.com)" +-- version = "1.0" local first_launch = true diff --git a/community/currency-widget-ru.lua b/community/currency-widget-ru.lua index 3414967..78466a0 100644 --- a/community/currency-widget-ru.lua +++ b/community/currency-widget-ru.lua @@ -4,7 +4,7 @@ -- type = "widget" -- author = "Andrey Gavrilov" -- version = "2.0" --- language = "ru" +-- lang = "ru" local json = require "json" local color = require "md_colors" diff --git a/community/fifteen-widget.lua b/community/fifteen-widget.lua index 7b17775..a7aca2a 100644 --- a/community/fifteen-widget.lua +++ b/community/fifteen-widget.lua @@ -1,4 +1,8 @@ -ui:set_title("15 puzzle") +-- name = "15 Puzzle" +-- description = "Game" +-- type = "widget" +-- author = "Andrey Gavrilov" +-- version = "1.0" local json = require "json" local folded = "15 puzzle" diff --git a/community/horoscope-widget.lua b/community/horoscope-widget.lua index e44452d..eadecde 100644 --- a/community/horoscope-widget.lua +++ b/community/horoscope-widget.lua @@ -1,4 +1,5 @@ -- name = "Horoscope" +-- description = "Horoscope for a given day" -- arguments_default = "scorpio today en" -- type = "widget" -- version = "1.0" diff --git a/community/net-file.lua b/community/net-file-widget.lua similarity index 71% rename from community/net-file.lua rename to community/net-file-widget.lua index ef13005..f292415 100644 --- a/community/net-file.lua +++ b/community/net-file-widget.lua @@ -1,4 +1,7 @@ -- name = "Network file" +-- description = "Shows the contents of any file on the Internet" +-- author = "Evgeny Zobnin (zobnin@gmail.com)" +-- version = "1.0" function on_resume() local args = settings:get() diff --git a/community/period_progress.lua b/community/period-progress-widget.lua similarity index 96% rename from community/period_progress.lua rename to community/period-progress-widget.lua index eac3ef8..8be2091 100644 --- a/community/period_progress.lua +++ b/community/period-progress-widget.lua @@ -1,34 +1,33 @@ --- name = "Period progress" --- description = "Shows period progress" --- type = "widget" --- author = "Nikolai Galashev" --- version = "1.0" --- arguments_help = "Enter the title and the start and end date in this format: Title 2021 01 31 2021 09 25" - - -function on_resume() - if (next(settings:get()) == nil) then - ui:show_text("Tap to enter date") - return - end - - local params = settings:get() - start_period = get_time(params[2], params[3], params[4]); - end_period = get_time(params[5], params[6], params[7]); - name_period = params[1] - current_time = os.time() - init_progressbar() -end - -function on_click() - settings:show_dialog() -end - -function get_time(y,m,d) - return os.time{day=d,month=m,year=y} -end - -function init_progressbar() - percent = math.floor((current_time - start_period) / ((end_period - start_period) / 100)) - ui:show_progress_bar(name_period..": "..percent.."%", current_time - start_period, end_period - start_period, "#7069f0ae") -end +-- name = "Period progress" +-- description = "Shows period progress" +-- type = "widget" +-- author = "Nikolai Galashev" +-- version = "1.0" +-- arguments_help = "Enter the title and the start and end date in this format: Title 2021 01 31 2021 09 25" + +function on_resume() + if (next(settings:get()) == nil) then + ui:show_text("Tap to enter date") + return + end + + local params = settings:get() + start_period = get_time(params[2], params[3], params[4]); + end_period = get_time(params[5], params[6], params[7]); + name_period = params[1] + current_time = os.time() + init_progressbar() +end + +function on_click() + settings:show_dialog() +end + +function get_time(y,m,d) + return os.time{day=d,month=m,year=y} +end + +function init_progressbar() + percent = math.floor((current_time - start_period) / ((end_period - start_period) / 100)) + ui:show_progress_bar(name_period..": "..percent.."%", current_time - start_period, end_period - start_period, "#7069f0ae") +end diff --git a/community/public-ip-search.lua b/community/public-ip-search.lua index 5c57821..febd5b2 100644 --- a/community/public-ip-search.lua +++ b/community/public-ip-search.lua @@ -11,14 +11,14 @@ local red = md_colors.red_500 local ip = "" function on_search(input) - if input:lower():find(string.lower("^ip$")) then + if input:lower():find("^ip$") then get_ip() end end function on_click() system:copy_to_clipboard(ip) -end +end function get_ip() http:get("https://api.ipify.org") diff --git a/community/qr-code.lua b/community/qr-code-search.lua similarity index 100% rename from community/qr-code.lua rename to community/qr-code-search.lua diff --git a/community/region-search-ru.lua b/community/region-ru-search.lua similarity index 91% rename from community/region-search-ru.lua rename to community/region-ru-search.lua index 8b2b174..491118e 100644 --- a/community/region-search-ru.lua +++ b/community/region-ru-search.lua @@ -2,7 +2,7 @@ -- description = "Поиск по кодам автомобильных номеров России" -- lang = "ru" -- type = "search" --- author = "Evgeny Zobnin (zobnin@gmail.com) +-- author = "Evgeny Zobnin (zobnin@gmail.com)" -- version = "1.0" function on_search(str) @@ -19,6 +19,7 @@ codes = { ["02"] = "Республика Башкортостан", ["102"] = "Республика Башкортостан", ["03"] = "Республика Бурятия", + ["103"] = "Республика Бурятия", ["04"] = "Республика Алтай (Горный Алтай)", ["05"] = "Республика Дагестан", ["06"] = "Республика Ингушетия", @@ -43,6 +44,7 @@ codes = { ["23"] = "Краснодарский край", ["93"] = "Краснодарский край", ["123"] = "Краснодарский край", + ["193"] = "Краснодарский край", ["24"] = "Красноярский край", ["84"] = "Красноярский край", ["88"] = "Красноярский край", @@ -50,6 +52,7 @@ codes = { ["25"] = "Приморский край", ["125"] = "Приморский край", ["26"] = "Ставропольский край", + ["126"] = "Ставропольский край", ["27"] = "Хабаровский край", ["28"] = "Амурская область", ["29"] = "Архангельская область", @@ -61,14 +64,17 @@ codes = { ["134"] = "Волгоградская область", ["35"] = "Вологодская область", ["36"] = "Воронежская область", + ["136"] = "Воронежская область", ["37"] = "Ивановская область", ["38"] = "Иркутская область", + ["138"] = "Иркутская область", ["85"] = "Иркутская область", ["39"] = "Калининградская область", ["91"] = "Калининградская область", ["40"] = "Калужская область", ["41"] = "Камчатский край", ["42"] = "Кемеровская область", + ["142"] = "Кемеровская область", ["43"] = "Кировская область", ["44"] = "Костромская область", ["45"] = "Курганская область", @@ -79,12 +85,15 @@ codes = { ["50"] = "Московская область", ["90"] = "Московская область", ["150"] = "Московская область", + ["750"] = "Московская область", ["190"] = "Московская область", + ["790"] = "Московская область", ["51"] = "Мурманская область", ["52"] = "Нижегородская область", ["152"] = "Нижегородская область", ["53"] = "Новгородская область", ["54"] = "Новосибирская область", + ["154"] = "Новосибирская область", ["55"] = "Омская область", ["56"] = "Оренбургская область", ["57"] = "Орловская область", @@ -98,11 +107,13 @@ codes = { ["62"] = "Рязанская область", ["63"] = "Самарская область", ["163"] = "Самарская область", + ["763"] = "Самарская область", ["64"] = "Саратовская область", ["164"] = "Саратовская область", ["65"] = "Сахалинская область", ["66"] = "Свердловская область", ["96"] = "Свердловская область", + ["196"] = "Свердловская область", ["67"] = "Смоленская область", ["68"] = "Тамбовская область", ["69"] = "Тверская область", @@ -123,6 +134,7 @@ codes = { ["197"] = "Москва", ["199"] = "Москва", ["777"] = "Москва", + ["797"] = "Москва", ["799"] = "Москва", ["78"] = "Санкт-Петербург", ["98"] = "Санкт-Петербург", diff --git a/community/rss-widget.lua b/community/rss-widget.lua index c01a7b0..6124711 100644 --- a/community/rss-widget.lua +++ b/community/rss-widget.lua @@ -6,7 +6,7 @@ -- version = "1.0" -- settings -local feed = "https://news.yandex.ru/index.rss" +local feed = "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml" local lines_num = 5 local auto_folding = false diff --git a/community/share-menu.lua b/community/share-menu-search.lua similarity index 100% rename from community/share-menu.lua rename to community/share-menu-search.lua diff --git a/community/sudoku-widget.lua b/community/sudoku-widget.lua index edc3e42..96bb643 100644 --- a/community/sudoku-widget.lua +++ b/community/sudoku-widget.lua @@ -1,4 +1,8 @@ -ui:set_title("Sudoku") +-- name = "Sudoku" +-- description = "Sudoku games" +-- type = "Game" +-- author = "Andrey Gavrilov" +-- version = "1.0" local json = require "json" local folded = "Sudoku"