update jellyfin
This commit is contained in:
parent
d0fd007ea9
commit
2ae5258fc5
@ -3,8 +3,8 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-jellyfin
|
PKG_NAME:=luci-app-jellyfin
|
||||||
PKG_VERSION:=1.0.0
|
PKG_VERSION:=1.0.1
|
||||||
PKG_RELEASE:=20210912
|
PKG_RELEASE:=20211011
|
||||||
|
|
||||||
LUCI_TITLE:=LuCI support for jellyfin
|
LUCI_TITLE:=LuCI support for jellyfin
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
|
@ -11,12 +11,14 @@ function index()
|
|||||||
entry({"admin", "services", "jellyfin","start"}, call("start_container"))
|
entry({"admin", "services", "jellyfin","start"}, call("start_container"))
|
||||||
entry({"admin", "services", "jellyfin","install"}, call("install_container"))
|
entry({"admin", "services", "jellyfin","install"}, call("install_container"))
|
||||||
entry({"admin", "services", "jellyfin","uninstall"}, call("uninstall_container"))
|
entry({"admin", "services", "jellyfin","uninstall"}, call("uninstall_container"))
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local sys = require "luci.sys"
|
local sys = require "luci.sys"
|
||||||
local uci = require "luci.model.uci".cursor()
|
local uci = require "luci.model.uci".cursor()
|
||||||
local keyword = "jellyfin"
|
local keyword = "jellyfin"
|
||||||
local util = require("luci.util")
|
local util = require("luci.util")
|
||||||
|
local docker = require "luci.model.docker"
|
||||||
|
|
||||||
function container_status()
|
function container_status()
|
||||||
local docker_path = util.exec("which docker")
|
local docker_path = util.exec("which docker")
|
||||||
@ -55,10 +57,60 @@ function start_container()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function install_container()
|
function install_container()
|
||||||
luci.sys.call('sh /usr/share/jellyfin/install.sh')
|
|
||||||
container_status()
|
docker:write_status("jellyfin installing\n")
|
||||||
|
local dk = docker.new()
|
||||||
|
local images = dk.images:list().body
|
||||||
|
local image = "jjm2473/jellyfin-rtk:v10.7"
|
||||||
|
local pull_image = function(image)
|
||||||
|
docker:append_status("Images: " .. "pulling" .. " " .. image .. "...\n")
|
||||||
|
local res = dk.images:create({query = {fromImage=image}}, docker.pull_image_show_status_cb)
|
||||||
|
if res and res.code and res.code == 200 and (res.body[#res.body] and not res.body[#res.body].error and res.body[#res.body].status and (res.body[#res.body].status == "Status: Downloaded newer image for ".. image or res.body[#res.body].status == "Status: Image is up to date for ".. image)) then
|
||||||
|
docker:append_status("done\n")
|
||||||
|
else
|
||||||
|
res.code = (res.code == 200) and 500 or res.code
|
||||||
|
docker:append_status("code:" .. res.code.." ".. (res.body[#res.body] and res.body[#res.body].error or (res.body.message or res.message)).. "\n")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local install_jellyfin = function()
|
||||||
|
local os = require "os"
|
||||||
|
local fs = require "nixio.fs"
|
||||||
|
local c = "sh /usr/share/jellyfin/install.sh >/tmp/log/jellyfin.stdout 2>/tmp/log/jellyfin.stderr"
|
||||||
|
local r = os.execute(c)
|
||||||
|
local e = fs.readfile("/tmp/log/jellyfin.stderr")
|
||||||
|
local o = fs.readfile("/tmp/log/jellyfin.stdout")
|
||||||
|
|
||||||
|
fs.unlink("/tmp/log/jellyfin.stderr")
|
||||||
|
fs.unlink("/tmp/log/jellyfin.stdout")
|
||||||
|
|
||||||
|
docker:append_status("r:\n" .. r .. "\n")
|
||||||
|
if r == 0 then
|
||||||
|
docker:write_status(o)
|
||||||
|
else
|
||||||
|
docker:write_status( e )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local exist_image = false
|
||||||
|
if image then
|
||||||
|
for _, v in ipairs (images) do
|
||||||
|
if v.RepoTags and v.RepoTags[1] == image then
|
||||||
|
exist_image = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not exist_image then
|
||||||
|
pull_image(image)
|
||||||
|
install_jellyfin()
|
||||||
|
else
|
||||||
|
install_jellyfin()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function uninstall_container()
|
function uninstall_container()
|
||||||
local status = container_status()
|
local status = container_status()
|
||||||
local container_id = status.container_id
|
local container_id = status.container_id
|
||||||
|
@ -1,11 +1,22 @@
|
|||||||
local m, s
|
local m, s
|
||||||
local uci = luci.model.uci.cursor()
|
local uci = luci.model.uci.cursor()
|
||||||
local sys = require 'luci.sys'
|
local sys = require 'luci.sys'
|
||||||
|
local docker = require "luci.model.docker"
|
||||||
|
|
||||||
m = Map("jellyfin", translate("Jellyfin"), translate("Jellyfin is the volunteer-built media solution that puts you in control of your media. Stream to any device from your own server, with no strings attached. Your media, your server, your way. ")
|
m = SimpleForm("jellyfin", translate("Jellyfin"), translate("Jellyfin is the volunteer-built media solution that puts you in control of your media. Stream to any device from your own server, with no strings attached. Your media, your server, your way. ")
|
||||||
.. translatef("For further information "
|
.. translatef("For further information "
|
||||||
.. "<a href=\"%s\" target=\"_blank\">"
|
.. "<a href=\"%s\" target=\"_blank\">"
|
||||||
.. "访问官网</a>", "https://jellyfin.org/"))
|
.. "访问官网</a>", "https://jellyfin.org/"))
|
||||||
|
m.submit=false
|
||||||
|
m.reset=false
|
||||||
|
|
||||||
|
s = m:section(SimpleSection)
|
||||||
|
s.template = "dockerman/apply_widget"
|
||||||
|
s.err = docker:read_status()
|
||||||
|
s.err = s.err and s.err:gsub("\n","<br>"):gsub(" "," ")
|
||||||
|
if s.err then
|
||||||
|
docker:clear_status()
|
||||||
|
end
|
||||||
|
|
||||||
-- s = m:section(TypedSection, 'MySection', translate('基本设置'))
|
-- s = m:section(TypedSection, 'MySection', translate('基本设置'))
|
||||||
-- s.anonymous = true
|
-- s.anonymous = true
|
||||||
@ -14,7 +25,8 @@ m = Map("jellyfin", translate("Jellyfin"), translate("Jellyfin is the volunteer-
|
|||||||
-- o.version = sys.exec('uci get jd-dailybonus.@global[0].version')
|
-- o.version = sys.exec('uci get jd-dailybonus.@global[0].version')
|
||||||
-- o.template = 'jellyfin/service'
|
-- o.template = 'jellyfin/service'
|
||||||
|
|
||||||
m:section(SimpleSection).template = "jellyfin/jellyfin"
|
s=m:section(SimpleSection)
|
||||||
|
s.template = "jellyfin/jellyfin"
|
||||||
|
|
||||||
-- s=m:section(TypedSection, "linkease", translate("Global settings"))
|
-- s=m:section(TypedSection, "linkease", translate("Global settings"))
|
||||||
-- s.anonymous=true
|
-- s.anonymous=true
|
||||||
@ -22,4 +34,23 @@ m:section(SimpleSection).template = "jellyfin/jellyfin"
|
|||||||
-- s:option(Flag, "enabled", translate("Enable")).rmempty=false
|
-- s:option(Flag, "enabled", translate("Enable")).rmempty=false
|
||||||
|
|
||||||
-- s:option(Value, "port", translate("Port")).rmempty=false
|
-- s:option(Value, "port", translate("Port")).rmempty=false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--下面学会怎么控制弹窗事件,如何判断提交按钮点击,在hml中如何调用model的方法。最后把命令输出显示到弹框上
|
||||||
|
|
||||||
|
-- 依次获取命令输出,结果太长无法显示完整,不能滚动
|
||||||
|
-- m.handle = function(self, state, data)
|
||||||
|
-- if state ~= FORM_VALID then
|
||||||
|
-- return
|
||||||
|
-- end
|
||||||
|
-- docker:clear_status()
|
||||||
|
-- docker:append_status(state .. "\n")
|
||||||
|
-- docker:append_status("done\n")
|
||||||
|
-- docker:append_status("done\n")
|
||||||
|
-- docker:append_status("done\n")
|
||||||
|
-- docker:append_status("done\n")
|
||||||
|
-- luci.http.redirect(luci.dispatcher.build_url("admin/services/jellyfin"))
|
||||||
|
-- end
|
||||||
|
|
||||||
return m
|
return m
|
@ -75,8 +75,9 @@
|
|||||||
|
|
||||||
function install_container(x) {
|
function install_container(x) {
|
||||||
|
|
||||||
|
uci_confirm_docker()
|
||||||
XHR.get(INSTALL_URL, { container_id: x }, (x, d) => {
|
XHR.get(INSTALL_URL, { container_id: x }, (x, d) => {
|
||||||
// alert(" 安装容器'" + d.container_id + "' ");
|
location.reload()
|
||||||
});
|
});
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -23,4 +23,4 @@ docker run --restart=unless-stopped -d \
|
|||||||
-v /var/tmp/vowb:/var/tmp/vowb \
|
-v /var/tmp/vowb:/var/tmp/vowb \
|
||||||
--pid=host \
|
--pid=host \
|
||||||
--dns=172.17.0.1 \
|
--dns=172.17.0.1 \
|
||||||
-p 8096:8096 -v /root/jellyfin/config:/config -v /mnt/sda3/media:/media --name myjellyfin-rtk-10.7 jjm2473/jellyfin-rtk:v10.7
|
-p 8096:8096 -v /root/jellyfin/config:/config -v /mnt/sda1/media:/media --name myjellyfin-rtk-10.7 jjm2473/jellyfin-rtk:v10.7
|
||||||
|
Loading…
x
Reference in New Issue
Block a user