--[[
LuCI - Lua Configuration Interface
]]--
local taskd = require "luci.model.tasks"
local megamedia_model = require "luci.model.megamedia"
local m, s, o
m = taskd.docker_map("megamedia", "megamedia", "/usr/libexec/apps/megamedia/megamedia.sh",
translate("MegaMedia"),
translate("MEGA MEDIA SERVER is a bundle of the most popular media manager apps qbittorrent, jellyfin, jackett, raadarr, sonarr, lidarr, and prowlarr.")
.. translate("Official website:") .. ' https://docs.linuxserver.io/images/docker-lidarr/')
s = m:section(SimpleSection, translate("Service Status"), translate("MegaMedia status:"))
s:append(Template("megamedia/status"))
s = m:section(TypedSection, "megamedia", translate("Setup"), translate("Refresh to update settings."))
s.addremove=false
s.anonymous=true
o = s:option(Value, "port", translate("Port").."*")
o.rmempty = false
o.default = "9696"
o.datatype = "port"
o = s:option(Value, "image_name", translate("Image").."*")
o.rmempty = false
o.datatype = "string"
o:value("megamedia", "megamedia")
o.default = "megamedia"
local blocks = megamedia_model.blocks()
local home = megamedia_model.home()
o = s:option(Value, "config_path", translate("Root Dir Path").."*")
o.rmempty = false
o.datatype = "string"
o:value("/opt/docker2/compose/downloads", "/opt/docker2/compose/downloads")
o.default = "/opt/docker2/compose/downloads"
local paths, default_path = megamedia_model.find_paths(blocks, home, "Configs")
for _, val in pairs(paths) do
o:value(val, val)
end
o.default = default_path
return m