diff --git a/openwrt-app-actions/applications/luci-app-lanraragi/Makefile b/openwrt-app-actions/applications/luci-app-lanraragi/Makefile index bc3f710c0..797c12e98 100644 --- a/openwrt-app-actions/applications/luci-app-lanraragi/Makefile +++ b/openwrt-app-actions/applications/luci-app-lanraragi/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=1.0.0-20221117 +PKG_VERSION:=1.0.0-20221119 PKG_RELEASE:= LUCI_TITLE:=LuCI support for LANraragi diff --git a/openwrt-app-actions/applications/luci-app-lanraragi/luasrc/model/lanraragi.lua b/openwrt-app-actions/applications/luci-app-lanraragi/luasrc/model/lanraragi.lua index 7697b0652..1c459419f 100644 --- a/openwrt-app-actions/applications/luci-app-lanraragi/luasrc/model/lanraragi.lua +++ b/openwrt-app-actions/applications/luci-app-lanraragi/luasrc/model/lanraragi.lua @@ -37,7 +37,7 @@ lanraragi.find_paths = function(blocks, home_dirs, path_name) local configs = {} if #blocks == 0 then - return + return configs, default_path else if path_name == "Public" then appname = "/Comics" diff --git a/openwrt-app-actions/applications/luci-app-navidrome/Makefile b/openwrt-app-actions/applications/luci-app-navidrome/Makefile index 87bb6de60..9977dc432 100644 --- a/openwrt-app-actions/applications/luci-app-navidrome/Makefile +++ b/openwrt-app-actions/applications/luci-app-navidrome/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=1.0.0-20221117 +PKG_VERSION:=1.0.0-20221119 PKG_RELEASE:= LUCI_TITLE:=LuCI support for Navidrome diff --git a/openwrt-app-actions/applications/luci-app-navidrome/luasrc/model/navidrome.lua b/openwrt-app-actions/applications/luci-app-navidrome/luasrc/model/navidrome.lua index e15ab7ec0..baaab3de0 100644 --- a/openwrt-app-actions/applications/luci-app-navidrome/luasrc/model/navidrome.lua +++ b/openwrt-app-actions/applications/luci-app-navidrome/luasrc/model/navidrome.lua @@ -37,7 +37,7 @@ navidrome.find_paths = function(blocks, home_dirs, path_name) local configs = {} if #blocks == 0 then - return + return configs, default_path else if path_name == "Public" then appname = "/Music" diff --git a/openwrt-app-actions/applications/luci-app-owntone/Makefile b/openwrt-app-actions/applications/luci-app-owntone/Makefile new file mode 100644 index 000000000..ede50896f --- /dev/null +++ b/openwrt-app-actions/applications/luci-app-owntone/Makefile @@ -0,0 +1,18 @@ + + +include $(TOPDIR)/rules.mk + +PKG_VERSION:=1.0.0-20221119 +PKG_RELEASE:= + +LUCI_TITLE:=LuCI support for Owntone +LUCI_PKGARCH:=all +LUCI_DEPENDS:=+docker +luci-lib-taskd + +define Package/luci-app-owntone/conffiles +/etc/config/owntone +endef + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/openwrt-app-actions/applications/luci-app-owntone/luasrc/controller/owntone.lua b/openwrt-app-actions/applications/luci-app-owntone/luasrc/controller/owntone.lua new file mode 100755 index 000000000..e26ba5512 --- /dev/null +++ b/openwrt-app-actions/applications/luci-app-owntone/luasrc/controller/owntone.lua @@ -0,0 +1,7 @@ + +module("luci.controller.owntone", package.seeall) + +function index() + entry({"admin", "services", "owntone"}, alias("admin", "services", "owntone", "config"), _("Owntone"), 30).dependent = true + entry({"admin", "services", "owntone", "config"}, cbi("owntone")) +end diff --git a/openwrt-app-actions/applications/luci-app-owntone/luasrc/model/cbi/owntone.lua b/openwrt-app-actions/applications/luci-app-owntone/luasrc/model/cbi/owntone.lua new file mode 100644 index 000000000..63eae7d10 --- /dev/null +++ b/openwrt-app-actions/applications/luci-app-owntone/luasrc/model/cbi/owntone.lua @@ -0,0 +1,50 @@ +--[[ +LuCI - Lua Configuration Interface +]]-- + +local taskd = require "luci.model.tasks" +local owntone_model = require "luci.model.owntone" +local m, s, o + +m = taskd.docker_map("owntone", "owntone", "/usr/libexec/istorec/owntone.sh", + translate("Owntone"), + translate("OwnTone is an open source (audio) media server which allows sharing and streaming your media library to iTunes (DAAP1), Roku (RSP), AirPlay devices (multiroom), Chromecast and also supports local playback.") + .. translate("Official website:") .. ' https://owntone.github.io/owntone-server/') + +s = m:section(SimpleSection, translate("Service Status"), translate("Owntone status:")) +s:append(Template("owntone/status")) + +s = m:section(TypedSection, "main", translate("Setup"), translate("The following parameters will only take effect during installation or upgrade:")) +s.addremove=false +s.anonymous=true + +o = s:option(Value, "image_name", translate("Image").."*", translate("Owntone only works in host network")) +o.rmempty = false +o.datatype = "string" +o:value("lscr.io/linuxserver/daapd:latest", "lscr.io/linuxserver/daapd:latest") +o:value("lscr.io/linuxserver/daapd:28.5.20221103", "lscr.io/linuxserver/daapd:28.5.20221103") +o.default = "lscr.io/linuxserver/daapd:latest" + +local blocks = owntone_model.blocks() +local home = owntone_model.home() + +o = s:option(Value, "config_path", translate("Config path").."*") +o.rmempty = false +o.datatype = "string" + +local paths, default_path = owntone_model.find_paths(blocks, home, "Configs") +for _, val in pairs(paths) do + o:value(val, val) +end +o.default = default_path + +o = s:option(Value, "music_path", translate("Music path").."*") +o.rmempty = false +o.datatype = "string" +local paths, default_path = owntone_model.find_paths(blocks, home, "Public") +for _, val in pairs(paths) do + o:value(val, val) +end +o.default = default_path + +return m diff --git a/openwrt-app-actions/applications/luci-app-owntone/luasrc/model/owntone.lua b/openwrt-app-actions/applications/luci-app-owntone/luasrc/model/owntone.lua new file mode 100644 index 000000000..ab93c5195 --- /dev/null +++ b/openwrt-app-actions/applications/luci-app-owntone/luasrc/model/owntone.lua @@ -0,0 +1,54 @@ +local util = require "luci.util" +local jsonc = require "luci.jsonc" + +local owntone = {} + +owntone.blocks = function() + local f = io.popen("lsblk -s -f -b -o NAME,FSSIZE,MOUNTPOINT --json", "r") + local vals = {} + if f then + local ret = f:read("*all") + f:close() + local obj = jsonc.parse(ret) + for _, val in pairs(obj["blockdevices"]) do + local fsize = val["fssize"] + if fsize ~= nil and string.len(fsize) > 10 and val["mountpoint"] then + -- fsize > 1G + vals[#vals+1] = val["mountpoint"] + end + end + end + return vals +end + +owntone.home = function() + local uci = require "luci.model.uci".cursor() + local home_dirs = {} + home_dirs["main_dir"] = uci:get_first("quickstart", "main", "main_dir", "/root") + home_dirs["Configs"] = uci:get_first("quickstart", "main", "conf_dir", home_dirs["main_dir"].."/Configs") + home_dirs["Public"] = uci:get_first("quickstart", "main", "pub_dir", home_dirs["main_dir"].."/Public") + home_dirs["Caches"] = uci:get_first("quickstart", "main", "tmp_dir", home_dirs["main_dir"].."/Caches") + return home_dirs +end + +owntone.find_paths = function(blocks, home_dirs, path_name) + local appname = '/Owntone' + local default_path = '' + local configs = {} + + if #blocks == 0 then + return configs, default_path + else + if path_name == "Public" then + appname = "/Music" + end + for _, val in pairs(blocks) do + table.insert(configs, val .. "/" .. path_name .. appname) + end + default_path = configs[1] + end + + return configs, default_path +end + +return owntone diff --git a/openwrt-app-actions/applications/luci-app-owntone/luasrc/view/owntone/status.htm b/openwrt-app-actions/applications/luci-app-owntone/luasrc/view/owntone/status.htm new file mode 100644 index 000000000..cc120ece7 --- /dev/null +++ b/openwrt-app-actions/applications/luci-app-owntone/luasrc/view/owntone/status.htm @@ -0,0 +1,31 @@ +<% +local util = require "luci.util" +local container_status = util.trim(util.exec("/usr/libexec/istorec/owntone.sh status")) +local container_install = (string.len(container_status) > 0) +local container_running = container_status == "running" +-%> +