luci-app-qbittorrent: update luci
This commit is contained in:
parent
c235f68028
commit
51eead14e8
@ -10,7 +10,7 @@ LUCI_DEPENDS:=+qBittorrent
|
|||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
PKG_NAME:=luci-app-qbittorrent
|
PKG_NAME:=luci-app-qbittorrent
|
||||||
PKG_VERSION=1.0
|
PKG_VERSION=1.0
|
||||||
PKG_RELEASE:=4
|
PKG_RELEASE:=8
|
||||||
|
|
||||||
include $(TOPDIR)/feeds/luci/luci.mk
|
include $(TOPDIR)/feeds/luci/luci.mk
|
||||||
|
|
||||||
|
@ -1,4 +1,16 @@
|
|||||||
module("luci.controller.qbittorrent",package.seeall)
|
module("luci.controller.qbittorrent",package.seeall)
|
||||||
|
|
||||||
function index()
|
function index()
|
||||||
entry({"admin","nas","qbittorrent"},cbi("qbittorrent"),_("qbittorrent"))
|
if not nixio.fs.access("/etc/config/qbittorrent")then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
entry({"admin","nas","qBittorrent"},cbi("qbittorrent"),_("qbittorrent"))
|
||||||
|
entry({"admin","nas","qBittorrent","status"},call("act_status")).leaf=true
|
||||||
|
end
|
||||||
|
|
||||||
|
function act_status()
|
||||||
|
local e={}
|
||||||
|
e.running=luci.sys.call("pgrep qbittorrent-nox >/dev/null")==0
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json(e)
|
||||||
end
|
end
|
||||||
|
@ -1,44 +1,32 @@
|
|||||||
require("luci.sys")
|
|
||||||
local e=require"luci.model.uci".cursor()
|
local e=require"luci.model.uci".cursor()
|
||||||
local o=e:get_first("qbittorrent","Preferences","port")or 8080
|
local o=e:get_first("qbittorrent","Preferences","port") or 8080
|
||||||
|
|
||||||
local a=(luci.sys.call("pidof qbittorrent-nox > /dev/null")==0)
|
local a=(luci.sys.call("pidof qbittorrent-nox > /dev/null")==0)
|
||||||
|
|
||||||
local t=""
|
local t=""
|
||||||
local e=""
|
|
||||||
if a then
|
if a then
|
||||||
t=" <input class=\"cbi-button cbi-button-apply\" type=\"submit\" value=\" "..translate("Open Web Interface").." \" onclick=\"window.open('http://'+window.location.hostname+':"..o.."')\"/>"
|
t="<br /><br /><input class=\"cbi-button cbi-button-apply\" type=\"submit\" value=\" "..translate("Open Web Interface").." \" onclick=\"window.open('http://'+window.location.hostname+':"..o.."')\"/>"
|
||||||
end
|
|
||||||
if a then
|
|
||||||
e="<b><font color=\"green\">"..translate("Running").."</font></b>"
|
|
||||||
else
|
|
||||||
e="<b><font color=\"red\">"..translate("Not running").."</font></b>"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
m = Map("qbittorrent", translate("qbittorrent"), translate("A BT/PT downloader base on Qt")..t
|
m = Map("qbittorrent", translate("qBittorrent"), translate("qBittorrent is a cross-platform free and open-source BitTorrent client")..t)
|
||||||
.."<br/><br/>"..translate("qbittorrent Run Status").." : "..e.."<br/>")
|
|
||||||
|
m:section(SimpleSection).template="qbittorrent/qbittorrent_status"
|
||||||
|
|
||||||
s_basic = m:section(TypedSection, "basic", translate("Basic Settings"))
|
s_basic = m:section(TypedSection, "basic", translate("Basic Settings"))
|
||||||
s_basic.anonymous = true
|
s_basic.anonymous = true
|
||||||
|
|
||||||
enable = s_basic:option(Flag, "enable", translate("Enable"))
|
enable = s_basic:option(Flag, "enable", translate("Enable"))
|
||||||
profile_dir = s_basic:option(Value,"profile_dir",translate("profile_dir"),translate("Store configuration files in the Path"))
|
profile_dir = s_basic:option(Value,"profile_dir",translate("profile_dir"),translate("Store configuration files in the Path"))
|
||||||
profile_dir.default = "/tmp"
|
profile_dir.default = "/root"
|
||||||
program_dir = s_basic:option(Value,"program_dir",translate("program_dir"),translate("Store Program files in the Path"))
|
|
||||||
program_dir.default = "/usr/bin"
|
|
||||||
library_dir = s_basic:option(Value,"library_dir",translate("library_dir"),translate("Store Library in the Path"))
|
|
||||||
library_dir.default = "/usr/lib"
|
|
||||||
|
|
||||||
s_download = m:section(TypedSection, "Preferences", translate("Download Settings"))
|
s_download = m:section(TypedSection, "Preferences", translate("Download Settings"))
|
||||||
s_download.anonymous = true
|
s_download.anonymous = true
|
||||||
download_dir = s_download:option(Value,"download_dir",translate("download_dir"),translate("Store download files in the Path"))
|
download_dir = s_download:option(Value,"download_dir",translate("download_dir"),translate("Store download files in the Path"))
|
||||||
download_dir.default = "/tmp/download"
|
download_dir.default = "/root/download"
|
||||||
|
|
||||||
s_webui = m:section(TypedSection, "Preferences", translate("WEBUI Settings"))
|
s_webui = m:section(TypedSection, "Preferences", translate("WEBUI Settings"))
|
||||||
s_webui.anonymous = true
|
s_webui.anonymous = true
|
||||||
port = s_webui:option(Value,"port",translate("port"),translate("WEBUI listening port"))
|
port = s_webui:option(Value,"port",translate("port"),translate("WEBUI listening port"))
|
||||||
port.default = "8080"
|
port.default = "8080"
|
||||||
|
|
||||||
local apply = luci.http.formvalue("cbi.apply")
|
|
||||||
if apply then
|
|
||||||
io.popen("/etc/init.d/qbittorrent restart")
|
|
||||||
end
|
|
||||||
|
|
||||||
return m
|
return m
|
@ -0,0 +1,22 @@
|
|||||||
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
XHR.poll(3, '<%=url([[admin]], [[nas]], [[qBittorrent]], [[status]])%>', null,
|
||||||
|
function(x, data) {
|
||||||
|
var tb = document.getElementById('qBittorrent_status');
|
||||||
|
if (data && tb) {
|
||||||
|
if (data.running) {
|
||||||
|
var links = '<em><b><font color=green>qBittorrent <%:RUNNING%></font></b></em>';
|
||||||
|
tb.innerHTML = links;
|
||||||
|
} else {
|
||||||
|
tb.innerHTML = '<em><b><font color=red>qBittorrent <%:NOT RUNNING%></font></b></em>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||||
|
<fieldset class="cbi-section">
|
||||||
|
<p id="qBittorrent_status">
|
||||||
|
<em><%:Collecting data...%></em>
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
@ -1,5 +1,5 @@
|
|||||||
msgid "qbittorrent"
|
msgid "qbittorrent"
|
||||||
msgstr "BT下载器-qb"
|
msgstr "qbittorrent"
|
||||||
|
|
||||||
msgid "Running"
|
msgid "Running"
|
||||||
msgstr "运行中"
|
msgstr "运行中"
|
||||||
@ -16,8 +16,8 @@ msgstr "基本设置"
|
|||||||
msgid "Enable"
|
msgid "Enable"
|
||||||
msgstr "启用"
|
msgstr "启用"
|
||||||
|
|
||||||
msgid "A BT/PT downloader base on Qt"
|
msgid "qBittorrent is a cross-platform free and open-source BitTorrent client"
|
||||||
msgstr "一个基于QT的BT/PT下载器"
|
msgstr "qBittorrent是一个基于 QT 的跨平台的开源 BitTorrent 客户端"
|
||||||
|
|
||||||
msgid "profile_dir"
|
msgid "profile_dir"
|
||||||
msgstr "配置文件目录"
|
msgstr "配置文件目录"
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
|
||||||
config basic
|
config basic
|
||||||
|
option program_dir '/usr/bin'
|
||||||
|
option library_dir '/usr/lib'
|
||||||
|
option profile_dir '/root'
|
||||||
|
option enable '0'
|
||||||
|
|
||||||
config Preferences
|
config Preferences
|
||||||
|
option download_dir '/root/download'
|
||||||
|
option port '8080'
|
||||||
|
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
START=99
|
START=99
|
||||||
|
|
||||||
|
get_config()
|
||||||
|
{
|
||||||
|
config_get_bool enable $1 enable 0
|
||||||
|
}
|
||||||
|
|
||||||
config_qbittorrent()
|
config_qbittorrent()
|
||||||
{
|
{
|
||||||
local download_dir
|
local download_dir
|
||||||
@ -24,9 +29,11 @@ Accepted=true
|
|||||||
Cookies=@Invalid()
|
Cookies=@Invalid()
|
||||||
|
|
||||||
[Preferences]
|
[Preferences]
|
||||||
|
General\Locale=zh
|
||||||
Downloads\SavePath=$download_dir
|
Downloads\SavePath=$download_dir
|
||||||
General\Locale=zh
|
General\Locale=zh
|
||||||
WebUI\Port=$port
|
WebUI\Port=$port
|
||||||
|
WebUI\CSRFProtection=false
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -55,13 +62,16 @@ run_qbittorrent()
|
|||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
|
stop
|
||||||
local profile_path
|
local profile_path
|
||||||
config_load 'qbittorrent'
|
config_load 'qbittorrent'
|
||||||
|
config_foreach get_config basic
|
||||||
|
[ $enable -eq 0 ] && exit 0
|
||||||
config_foreach run_qbittorrent 'basic'
|
config_foreach run_qbittorrent 'basic'
|
||||||
}
|
}
|
||||||
|
|
||||||
stop()
|
stop()
|
||||||
{
|
{
|
||||||
killall qbittorrent-nox
|
killall qbittorrent-nox >/dev/null 2>&1
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
12
package/lean/luci-app-qbittorrent/root/etc/uci-defaults/qbittorrent
Executable file
12
package/lean/luci-app-qbittorrent/root/etc/uci-defaults/qbittorrent
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
uci -q batch <<-EOF >/dev/null
|
||||||
|
delete ucitrack.@qbittorrent[-1]
|
||||||
|
add ucitrack qbittorrent
|
||||||
|
set ucitrack.@qbittorrent[-1].init=qbittorrent
|
||||||
|
commit ucitrack
|
||||||
|
EOF
|
||||||
|
|
||||||
|
/etc/init.d/qbittorrent stop
|
||||||
|
rm -f /tmp/luci-indexcache
|
||||||
|
exit 0
|
Loading…
x
Reference in New Issue
Block a user