luci-app-qbittorrent: rename from luci-app-qbittorrent-simple

This commit is contained in:
coolsnowwolf 2023-12-12 12:17:55 +08:00
parent dc06d37193
commit e32bc26458
23 changed files with 66 additions and 1459 deletions

View File

@ -1,35 +0,0 @@
# Copyright (C) 2019 Openwrt.org
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-qbittorrent-simple
PKG_VERSION:=1.0.0
PKG_RELEASE:=3
LUCI_TITLE:=LuCI support for qBittorrent
LUCI_PKGARCH:=all
LUCI_DEPENDS:= \
+PACKAGE_luci-app-qbittorrent-simple_static:qBittorrent-static \
+PACKAGE_luci-app-qbittorrent-simple_dynamic:qbittorrent
define Package/$(PKG_NAME)/config
choice
prompt "Build Version Selection"
default PACKAGE_luci-app-qbittorrent-simple_dynamic
config PACKAGE_luci-app-qbittorrent-simple_static
bool "Static Build"
depends on arm||aarch64||x86_64
config PACKAGE_luci-app-qbittorrent-simple_dynamic
bool "Dynamic Build"
endchoice
endef
include ../../luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -1,24 +0,0 @@
module("luci.controller.qbittorrent", package.seeall)
function index()
if not nixio.fs.access("/etc/config/qbittorrent") then
return
end
entry({"admin", "nas", "qbittorrent"}, cbi("qbittorrent"), _("qBittorrent"), 20).dependent = true
entry({"admin", "nas", "qbittorrent_status"}, call("qbittorrent_status"))
end
function qbittorrent_status()
local sys = require "luci.sys"
local uci = require "luci.model.uci".cursor()
local port = tonumber(uci:get_first("qbittorrent", "qbittorrent", "port"))
local status = {
running = (sys.call("pidof qbittorrent-nox >/dev/null") == 0),
port = (port or 8080)
}
luci.http.prepare_content("application/json")
luci.http.write_json(status)
end

View File

@ -1,29 +0,0 @@
msgid "qBittorrent"
msgstr "qBittorrent"
msgid "Running state"
msgstr "运行状态"
msgid "Open Web Interface"
msgstr "打开管理页面"
msgid "qBittorrent is a cross-platform free and open-source BitTorrent client. Default username & password: admin / adminadmin"
msgstr "qBittorrent 是一个基于 QT 的跨平台的开源 BitTorrent 客户端。默认用户名 & 密码admin / adminadmin"
msgid "Global settings"
msgstr "全局设置"
msgid "WebUI Port"
msgstr "WebUI 监听端口"
msgid "Configuration files Path"
msgstr "配置文件路径"
msgid "RUNNING"
msgstr "运行中"
msgid "NOT RUNNING"
msgstr "未运行"
msgid "Collecting data..."
msgstr "收集数据..."

View File

@ -1,4 +0,0 @@
config qbittorrent
option 'enabled' '0'
option 'port' '8080'
option 'profile_dir' '/etc/qbittorrent'

View File

@ -1,36 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
PROG=/usr/bin/qbittorrent-nox
get_config() {
config_get_bool enabled $1 enabled 1
config_get port $1 port 8080
config_get profile_dir $1 profile_dir "/etc/qbittorrent"
}
start_service() {
config_load qbittorrent
config_foreach get_config qbittorrent
[ $enabled != 1 ] && return 1
if [ ! -f "$profile_dir/qBittorrent/config/qBittorrent.conf" ]; then
mkdir -p $profile_dir/qBittorrent/config/
cp /etc/qbittorrent/qBittorrent.conf.example $profile_dir/qBittorrent/config/qBittorrent.conf
fi
procd_open_instance
procd_set_param command $PROG
procd_append_param command --webui-port=$port --profile=$profile_dir
procd_set_param respawn
procd_close_instance
}
service_triggers() {
procd_add_reload_trigger "qbittorrent"
}
reload_service() {
stop
sleep 1
start
}

View File

@ -6,8 +6,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-qbittorrent
PKG_VERSION=1.0
PKG_RELEASE:=23
PKG_VERSION:=1.0.0
PKG_RELEASE:=3
LUCI_TITLE:=LuCI support for qBittorrent
LUCI_PKGARCH:=all
@ -18,8 +18,7 @@ LUCI_DEPENDS:= \
define Package/$(PKG_NAME)/config
choice
prompt "Build Version Selection"
default PACKAGE_luci-app-qbittorrent_static if arm||aarch64||x86_64
default PACKAGE_luci-app-qbittorrent_dynamic if !(arm||aarch64||x86_64)
default PACKAGE_luci-app-qbittorrent_dynamic
config PACKAGE_luci-app-qbittorrent_static
bool "Static Build"
@ -27,7 +26,7 @@ define Package/$(PKG_NAME)/config
config PACKAGE_luci-app-qbittorrent_dynamic
bool "Dynamic Build"
endchoice
endef

View File

@ -5,19 +5,20 @@ function index()
return
end
entry({"admin", "nas", "qBittorrent"}, alias("admin", "nas", "qBittorrent", "basic"), _("qBittorrent"), 30).dependent = true
entry({"admin", "nas", "qBittorrent", "basic"}, cbi("qbittorrent/basic"), _("Basic Settings"), 1).leaf = true
entry({"admin", "nas", "qBittorrent", "connection"}, cbi("qbittorrent/connection"), _("Connection Settings"), 2).leaf = true
entry({"admin", "nas", "qBittorrent", "downloads"}, cbi("qbittorrent/downloads"), _("Download Settings"), 3).leaf = true
entry({"admin", "nas", "qBittorrent", "bittorrent"}, cbi("qbittorrent/bittorrent"), _("Bittorrent Settings"), 4).leaf = true
entry({"admin", "nas", "qBittorrent", "webgui"}, cbi("qbittorrent/webgui"), _("WebUI Settings"), 5).leaf = true
entry({"admin", "nas", "qBittorrent", "advanced"}, cbi("qbittorrent/advanced"), _("Advance Settings"), 6).leaf = true
entry({"admin", "nas", "qBittorrent", "status"}, call("act_status")).leaf = true
entry({"admin", "nas", "qbittorrent"}, cbi("qbittorrent"), _("qBittorrent"), 20).dependent = true
entry({"admin", "nas", "qbittorrent_status"}, call("qbittorrent_status"))
end
function act_status()
local e = {}
e.running = luci.sys.call("pgrep qbittorrent-nox >/dev/null") == 0
function qbittorrent_status()
local sys = require "luci.sys"
local uci = require "luci.model.uci".cursor()
local port = tonumber(uci:get_first("qbittorrent", "qbittorrent", "port"))
local status = {
running = (sys.call("pidof qbittorrent-nox >/dev/null") == 0),
port = (port or 8080)
}
luci.http.prepare_content("application/json")
luci.http.write_json(e)
luci.http.write_json(status)
end

View File

@ -1,96 +0,0 @@
m = Map("qbittorrent")
s = m:section(NamedSection, "main", "qbittorrent")
o = s:option(Flag, "AnonymousMode", translate("Anonymous Mode"))
o.description = translate("When enabled, qBittorrent will take certain measures to try to mask its identity. Refer to the <a href=\"https://github.com/qbittorrent/qBittorrent/wiki/Anonymous-Mode\" target=\"_blank\">wiki</a>")
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Flag, "SuperSeeding", translate("Super Seeding"))
o.description = translate("The super seeding mode.")
o.enabled = "true"
o.disabled = "false"
o.default = o.disabled
o = s:option(Value, "configuration", translate("Profile Folder Suffix"))
o.description = translate("Suffix for profile folder, for example, <b>qBittorrent_[NAME]</b>.")
o = s:option(Flag, "IncludeOverhead", translate("Limit Overhead Usage"))
o.description = translate("The overhead usage is been limitted.")
o.enabled = "true"
o.disabled = "false"
o.default = o.disabled
o = s:option(Flag, "IgnoreLimitsLAN", translate("Ignore LAN Limit"))
o.description = translate("Ignore the speed limit to LAN.")
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Flag, "osCache", translate("Use os Cache"))
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Value, "OutgoingPortsMax", translate("Max Outgoing Port"))
o.description = translate("The max outgoing port.")
o.datatype = "port"
o = s:option(Value, "OutgoingPortsMin", translate("Min Outgoing Port"))
o.description = translate("The min outgoing port.")
o.datatype = "port"
o = s:option(ListValue, "SeedChokingAlgorithm", translate("Choking Algorithm"))
o.description = translate("The strategy of choking algorithm.")
o:value("RoundRobin", translate("Round Robin"))
o:value("FastestUpload", translate("Fastest Upload"))
o:value("AntiLeech", translate("Anti-Leech"))
o.default = "FastestUpload"
o = s:option(Flag, "AnnounceToAllTrackers", translate("Announce To All Trackers"))
o.enabled = "true"
o.disabled = "false"
o.default = o.disabled
o = s:option(Flag, "AnnounceToAllTiers", translate("Announce To All Tiers"))
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Flag, "Enabled", translate("Enable Log"))
o.description = translate("Enable logger to log file.")
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Value, "Path", translate("Log Path"))
o.description = translate("The path for qbittorrent log.")
o:depends("Enabled", "true")
o = s:option(Flag, "Backup", translate("Enable Backup"))
o.description = translate("Backup log file when oversize the given size.")
o:depends("Enabled", "true")
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Flag, "DeleteOld", translate("Delete Old Backup"))
o.description = translate("Delete the old log file.")
o:depends("Enabled", "true")
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Value, "MaxSizeBytes", translate("Log Max Size"))
o.description = translate("The max size for qbittorrent log (Unit: Bytes).")
o:depends("Enabled", "true")
o.placeholder = "66560"
o = s:option(Value, "SaveTime", translate("Log Saving Period"))
o.description = translate("The log file will be deteted after given time. 1d -- 1 day, 1m -- 1 month, 1y -- 1 year.")
o:depends("Enabled", "true")
o.datatype = "string"
return m

View File

@ -1,39 +0,0 @@
m = Map("qbittorrent")
m.title = translate("qBittorrent")
m.description = translate("qBittorrent is a cross-platform free and open-source BitTorrent client")
m:section(SimpleSection).template = "qbittorrent/qbittorrent_status"
s = m:section(NamedSection, "main", "qbittorrent")
o = s:option(Flag, "enabled", translate("Enabled"))
o.default = "1"
o = s:option(ListValue, "user", translate("Run daemon as user"))
local u
for u in luci.util.execi("cat /etc/passwd | cut -d ':' -f1") do
o:value(u)
end
o = s:option(Value, "profile", translate("Store configuration files in the Path"))
o.default = '/tmp'
o = s:option(Value, "SavePath", translate("Store download files in the Path"))
o.placeholder = "/tmp/download"
o = s:option(Value, "Port", translate("WEBUI listening port"))
o.datatype = "port"
o.placeholder = "8080"
o = s:option(Flag, "UseRandomPort", translate("Use Random Port"))
o.description = translate("Randomly assigns a different port every time qBittorrent starts up.")
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Value, "PortRangeMin", translate("Connection Port"))
o.description = translate("Incoming connection port.")
o:depends("UseRandomPort", false)
o.datatype = "range(1024,65535)"
return m

View File

@ -1,112 +0,0 @@
m = Map("qbittorrent")
s = m:section(NamedSection, "main", "qbittorrent")
o = s:option(Flag, "DHT", translate("Enable DHT"))
o.description = translate("Enable DHT (decentralized network) to find more peers.")
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Flag, "PeX", translate("Enable PeX"))
o.description = translate("Enable Peer Exchange (PeX) to find more peers.")
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Flag, "LSD", translate("Enable LSD"))
o.description = translate("Enable Local Peer Discovery to find more peers.")
o.enabled = "true"
o.disabled = "false"
o.default = o.disabled
o = s:option(Flag, "uTP_rate_limited", translate("uTP Rate Limit"))
o.description = translate("Apply rate limit to uTP protocol.")
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(ListValue, "Encryption", translate("Encryption Mode"))
o.description = translate("Enable DHT (decentralized network) to find more peers.")
o:value("0", translate("Prefer Encryption"))
o:value("1", translate("Require Encryption"))
o:value("2", translate("Disable Encryption"))
o.default = "0"
o = s:option(Value, "MaxConnecs", translate("Max Connections"))
o.description = translate("The max number of connections.")
o.datatype = "integer"
o.placeholder = "500"
o = s:option(Value, "MaxConnecsPerTorrent", translate("Max Connections Per Torrent"))
o.description = translate("The max number of connections per torrent.")
o.datatype = "integer"
o.placeholder = "100"
o = s:option(Value, "MaxUploads", translate("Max Uploads"))
o.description = translate("The max number of connected peers.")
o.datatype = "integer"
o.placeholder = "8"
o = s:option(Value, "MaxUploadsPerTorrent", translate("Max Uploads Per Torrent"))
o.description = translate("The max number of connected peers per torrent.")
o.datatype = "integer"
o.placeholder = "4"
o = s:option(Value, "MaxRatio", translate("Max Ratio"))
o.description = translate("The max ratio for seeding. -1 is to disable the seeding.")
o.datatype = "float"
o.placeholder = "-1"
o = s:option(ListValue, "MaxRatioAction", translate("Max Ratio Action"))
o.description = translate("The action when reach the max seeding ratio.")
o:value("0", translate("Pause them"))
o:value("1", translate("Remove them"))
o.defaule = "0"
o = s:option(Value, "GlobalMaxSeedingMinutes", translate("Max Seeding Minutes"))
o.description = translate("Units: minutes")
o.datatype = "integer"
s = m:section(NamedSection, "main", "qbittorrent")
s.title = translate("Queueing Setting")
o = s:option(Flag, "QueueingEnabled", translate("Enable Torrent Queueing"))
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Value, "MaxActiveDownloads", translate("Maximum Active Downloads"))
o.datatype = "integer"
o.placeholder = "3"
o = s:option(Value, "MaxActiveUploads", translate("Max Active Uploads"))
o.datatype = "integer"
o.placeholder = "3"
o = s:option(Value, "MaxActiveTorrents", translate("Max Active Torrents"))
o.datatype = "integer"
o.placeholder = "5"
o = s:option(Flag, "IgnoreSlowTorrents", translate("Ignore Slow Torrents"))
o.description = translate("Do not count slow torrents in these limits.")
o.enabled = "true"
o.disabled = "false"
o.default = o.disabled
o = s:option(Value, "SlowTorrentsDownloadRate", translate("Download rate threshold"))
o.description = translate("Units: KiB/s")
o.datatype = "integer"
o.placeholder = "2"
o = s:option(Value, "SlowTorrentsUploadRate", translate("Upload rate threshold"))
o.description = translate("Units: KiB/s")
o.datatype = "integer"
o.placeholder = "2"
o = s:option(Value, "SlowTorrentsInactivityTimer", translate("Torrent inactivity timer"))
o.description = translate("Units: seconds")
o.datatype = "integer"
o.placeholder = "60"
return m

View File

@ -1,41 +0,0 @@
m = Map("qbittorrent")
s = m:section(NamedSection, "main", "qbittorrent")
o = s:option(Flag, "UPnP", translate("Use UPnP for Connections"))
o.description = translate("Use UPnP/ NAT-PMP port forwarding from my router. Refer to the <a href=\"https://en.wikipedia.org/wiki/Port_forwarding\" target=\"_blank\">wiki</a>")
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Value, "GlobalDLLimit", translate("Global Download Speed"))
o.description = translate("Global Download Speed Limit(KiB/s).")
o.datatype = "float"
o.placeholder = "0"
o = s:option(Value, "GlobalUPLimit", translate("Global Upload Speed"))
o.description = translate("Global Upload Speed Limit(KiB/s).")
o.datatype = "float"
o.placeholder = "0"
o = s:option(Value, "GlobalDLLimitAlt", translate("Alternative Download Speed"))
o.description = translate("Alternative Download Speed Limit(KiB/s).")
o.datatype = "float"
o.placeholder = "10"
o = s:option(Value, "GlobalUPLimitAlt", translate("Alternative Upload Speed"))
o.description = translate("Alternative Upload Speed Limit(KiB/s).")
o.datatype = "float"
o.placeholder = "10"
o = s:option(ListValue, "BTProtocol", translate("Enabled protocol"))
o.description = translate("The protocol that was enabled.")
o:value("Both", translate("TCP and UTP"))
o:value("TCP", translate("TCP"))
o:value("UTP", translate("UTP"))
o.default = "Both"
o = s:option(Value, "InetAddress", translate("Inet Address"))
o.description = translate("The address that respond to the trackers.")
return m

View File

@ -1,87 +0,0 @@
m = Map("qbittorrent")
s = m:section(NamedSection, "main", "qbittorrent")
o = s:option(Flag, "CreateTorrentSubfolder", translate("Create Subfolder"))
o.description = translate("Create subfolder for torrents with multiple files.")
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Flag, "StartInPause", translate("Start In Pause"))
o.description = translate("Do not start the download automatically.")
o.enabled = "true"
o.disabled = "false"
o.default = o.disabled
o = s:option(Flag, "AutoDeleteAddedTorrentFile", translate("Auto Delete Torrent File"))
o.description = translate("The .torrent files will be deleted afterwards.")
o.enabled = "IfAdded"
o.disabled = "Never"
o.default = o.disabled
o = s:option(Flag, "PreAllocation", translate("Pre Allocation"))
o.description = translate("Pre-allocate disk space for all files.")
o.enabled = "true"
o.disabled = "false"
o.default = o.disabled
o = s:option(Flag, "UseIncompleteExtension", translate("Use Incomplete Extension"))
o.description = translate("The incomplete task will be added the extension of !qB.")
o.enabled = "true"
o.disabled = "false"
o.default = o.disabled
o = s:option(Flag, "TempPathEnabled", translate("Temp Path Enabled"))
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Value, "TempPath", translate("Temp Path"))
o.description = translate("The absolute and relative path can be set.")
o:depends("TempPathEnabled", "true")
o.placeholder = "temp/"
o = s:option(Value, "DiskWriteCacheSize", translate("Disk Cache Size (MiB)"))
o.description = translate("The value -1 is auto and 0 is disable. In default, it is set to 64MiB.")
o.datatype = "integer"
o.placeholder = "64"
o = s:option(Value, "DiskWriteCacheTTL", translate("Disk Cache TTL (s)"))
o.description = translate("In default, it is set to 60s.")
o.datatype = "integer"
o.placeholder = "60"
s = m:section(NamedSection, "main", "qbittorrent")
s.title = translate("Saving Management")
o = s:option(ListValue, "DisableAutoTMMByDefault", translate("Default Torrent Management Mode"))
o:value("true", translate("Manual"))
o:value("false", translate("Automaic"))
o.default = "true"
o = s:option(ListValue, "CategoryChanged", translate("Torrent Category Changed"))
o.description = translate("Choose the action when torrent category changed.")
o:value("true", translate("Switch torrent to Manual Mode"))
o:value("false", translate("Relocate torrent"))
o.default = "false"
o = s:option(ListValue, "DefaultSavePathChanged", translate("Default Save Path Changed"))
o.description = translate("Choose the action when default save path changed.")
o:value("true", translate("Switch affected torrent to Manual Mode"))
o:value("false", translate("Relocate affected torrent"))
o.default = "true"
o = s:option(ListValue, "CategorySavePathChanged", translate("Category Save Path Changed"))
o.description = translate("Choose the action when category save path changed.")
o:value("true", translate("Switch affected torrent to Manual Mode"))
o:value("false", translate("Relocate affected torrent"))
o.default = "true"
o = s:option(Value, "TorrentExportDir", translate("Torrent Export Dir"))
o.description = translate("The .torrent files will be copied to the target directory.")
o = s:option(Value, "FinishedTorrentExportDir", translate("Finished Torrent Export Dir"))
o.description = translate("The .torrent files for finished downloads will be copied to the target directory.")
return m

View File

@ -1,56 +0,0 @@
m = Map("qbittorrent")
s = m:section(NamedSection, "main", "qbittorrent")
o = s:option(Flag, "UseUPnP", translate("Use UPnP for WebUI"))
o.description = translate("Using the UPnP / NAT-PMP port of the router for connecting to WebUI.")
o.enabled = "true"
o.disabled = "false"
o.default = o.disabled
--o = s:option(Value, "Username", translate("Username"))
--o.description = translate("The login name for WebUI.")
--o.placeholder = "admin"
--o = s:option(Value, "Password", translate("Password"))
--o.description = translate("The login password for WebUI.")
--o.password = true
o = s:option(Value, "Locale", translate("Locale Language"))
o:value("en", translate("English"))
o:value("zh_CN", translate("Chinese"))
o.default = "en"
o = s:option(Flag, "CSRFProtection", translate("CSRF Protection"))
o.description = translate("Enable Cross-Site Request Forgery (CSRF) protection.")
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Flag, "ClickjackingProtection", translate("Clickjacking Protection"))
o.description = translate("Enable clickjacking protection.")
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Flag, "HostHeaderValidation", translate("Host Header Validation"))
o.description = translate("Validate the host header.")
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Flag, "LocalHostAuth", translate("Local Host Authentication"))
o.description = translate("Force authentication for clients on localhost.")
o.enabled = "true"
o.disabled = "false"
o.default = o.enabled
o = s:option(Flag, "AuthSubnetWhitelistEnabled", translate("Enable Subnet Whitelist"))
o.enabled = "true"
o.disabled = "false"
o.default = o.disabled
o = s:option(DynamicList, "AuthSubnetWhitelist", translate("Subnet Whitelist"))
o:depends("AuthSubnetWhitelistEnabled", "true")
return m

View File

@ -1,27 +0,0 @@
<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><input class="cbi-button-reload mar-10" type="button" value="<%:Open Web Interface%>" onclick="openwebui();" />';
tb.innerHTML = links;
} else {
tb.innerHTML = '<em><b><font color=red>qBittorrent <%:NOT RUNNING%></font></b></em>';
}
}
}
);
function openwebui(){
var url = window.location.host+":<%=luci.sys.exec("uci -q get qbittorrent.main.Port"):gsub("^%s*(.-)%s*$", "%1")%>";
window.open('http://'+url,'target','');
}
//]]>
</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>

View File

@ -1,18 +1,23 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: dingpengyu <dingpengyu06@gmail.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"X-Generator: Poedit 2.3.1\n"
msgid "qBittorrent"
msgstr "qBittorrent"
msgid "qbittorrent"
msgstr "qbittorrent"
msgid "Running state"
msgstr "运行状态"
msgid "Open Web Interface"
msgstr "打开管理页面"
msgid "qBittorrent is a cross-platform free and open-source BitTorrent client. Default username & password: admin / adminadmin"
msgstr "qBittorrent 是一个基于 QT 的跨平台的开源 BitTorrent 客户端。默认用户名 & 密码admin / adminadmin"
msgid "Global settings"
msgstr "全局设置"
msgid "WebUI Port"
msgstr "WebUI 监听端口"
msgid "Configuration files Path"
msgstr "配置文件路径"
msgid "RUNNING"
msgstr "运行中"
@ -20,551 +25,5 @@ msgstr "运行中"
msgid "NOT RUNNING"
msgstr "未运行"
msgid "Basic Settings"
msgstr "基本设置"
msgid "Enable"
msgstr "启用"
msgid "qBittorrent is a cross-platform free and open-source BitTorrent client"
msgstr "qBittorrent 是一个基于 QT 的跨平台的开源 BitTorrent 客户端"
msgid "profile_dir"
msgstr "配置文件目录"
msgid "Store configuration files in the Path"
msgstr "配置文件存放路径"
msgid "program_dir"
msgstr "程序目录"
msgid "library_dir"
msgstr "库目录"
msgid "Store Program files in the Path"
msgstr "程序文件存放路径"
msgid "Store Library in the Path"
msgstr "库文件存放路径"
msgid "Download Settings"
msgstr "下载设置"
msgid "download_dir"
msgstr "下载目录"
msgid "Store download files in the Path"
msgstr "下载文件存放目录"
msgid "WEBUI Settings"
msgstr "WEBUI 设置"
msgid "WEBUI listening port"
msgstr "WebUI 监听端口"
msgid "Use Random Port"
msgstr "使用随机端口"
msgid "Randomly assigns a different port every time qBittorrent starts up."
msgstr "在每次启动时使用不同的传入连接端口。"
msgid "Connection Port"
msgstr "连接端口"
msgid "Incoming connection port."
msgstr "推荐在防火墙 -> 流量规则 中,打开这个端口获得更好的下载速度( TCP+UDP )。"
msgid "Bittorrent Settings"
msgstr "Bittorrent 设置"
msgid "WebUI Settings"
msgstr "WebUI 设置"
msgid "Advance Settings"
msgstr "高级设置"
msgid "Run daemon as user"
msgstr "用户组"
msgid "Parent Path for Profile Folder"
msgstr "配置保存路径"
msgid "The path for storing profile folder using by command: <b>--profile [PATH]</b>."
msgstr "配置文件的保存路径,默认的配置文件夹在/tmp下。例如<code>/etc/config</code>。"
msgid "Profile Folder Suffix"
msgstr "配置目录后缀"
msgid "Suffix for profile folder, for example, <b>qBittorrent_[NAME]</b>."
msgstr "配置文件文件夹的后缀。例如: <b>qBittorrent_[NAME]</b>。"
msgid "Locale Language"
msgstr "WebUI 语言"
msgid "English"
msgstr "英文"
msgid "Chinese"
msgstr "中文"
msgid "Enable Log"
msgstr "启用日志"
msgid "Enable logger to log file."
msgstr "启用日志记录器以记录日志文件。"
msgid "Log Path"
msgstr "日志文件"
msgid "The path for qbittorrent log."
msgstr "日志文件自定义保存路径默认都在配置文件夹的data下。"
msgid "Enable Backup"
msgstr "启用备份"
msgid "Backup log file when oversize the given size."
msgstr "备份日志文件。"
msgid "Delete Old Backup"
msgstr "删除备份"
msgid "Delete the old log file."
msgstr "符合下列设定后将删除旧的日志文件。"
msgid "Log Max Size"
msgstr "日志保存大小"
msgid "Log Saving Period"
msgstr "日志保存期限"
msgid "The max size for qbittorrent log (Unit: Bytes)."
msgstr "设定日志文件的大小(单位:字节)"
msgid "The log file will be deteted after given time. 1d -- 1 day, 1m -- 1 month, 1y -- 1 year."
msgstr "设定日志文件的时间1d-1天,1m-1个月,1y-1年"
msgid "Connection Settings"
msgstr "连接设置"
msgid "Use UPnP for Connections"
msgstr "端口自动转发"
msgid "Use UPnP/ NAT-PMP port forwarding from my router."
msgstr "使用路由器的 UPnP/NAT-PMP 端口自动转发。"
msgid "Use different port on each startup voids the first"
msgstr "在每次启动时使用随机的端口,可能会使第一个启动无效"
msgid "Global Download Speed"
msgstr "全局下载速度限制"
msgid "Global Download Speed Limit(KiB/s)."
msgstr "全局下载速度限制(KiB/s)0为无限制。"
msgid "Global Upload Speed"
msgstr "全局上传速度限制"
msgid "Alternative Download Speed"
msgstr "备用下载速度限制"
msgid "Alternative Upload Speed"
msgstr "备用上传速度限制"
msgid "Global Upload Speed Limit(KiB/s)."
msgstr "全局上传速度限制(KiB/s)0为无限制。"
msgid "Alternative Download Speed Limit(KiB/s)."
msgstr "备用下载速度限制(KiB/s)0为无限制。"
msgid "Alternative Upload Speed Limit(KiB/s)."
msgstr "备用上传速度限制(KiB/s)0为无限制。"
msgid "Enabled protocol"
msgstr "启用的协议"
msgid "The protocol that was enabled."
msgstr "当前已启用的协议。"
msgid "TCP and UTP"
msgstr "TCP 和 UTP"
msgid "Inet Address"
msgstr "输入地址"
msgid "The address that respond to the trackers."
msgstr "响应跟踪器的地址。"
msgid "When adding seeds"
msgstr "当添加种子时"
msgid "Downloads Settings"
msgstr "下载设置"
msgid "Create Subfolder"
msgstr "创建目录"
msgid "Create subfolder for torrents with multiple files."
msgstr "为含多个文件的种子创建子文件夹。"
msgid "Start In Pause"
msgstr "开始暂停"
msgid "Do not start the download automatically."
msgstr "在下载任务添加后暂停。"
msgid "Auto Delete Torrent File"
msgstr "删除种子"
msgid "The .torrent files will be deleted afterwards."
msgstr "下载完成后自动删除这个种子文件。"
msgid "Pre Allocation"
msgstr "磁盘预分配"
msgid "Pre-allocate disk space for all files."
msgstr "为刚添加的文件预先分配磁盘空间。"
msgid "Use Incomplete Extension"
msgstr "使用扩展名"
msgid "The incomplete task will be added the extension of !qB."
msgstr "为不完整的文件添加后缀名 !qB"
msgid "Save Path"
msgstr "文件保存路径"
msgid "The path to save the download file. For example:<code>/mnt/sda1/download</code>"
msgstr "下载文件的保存路径。例如:<code>/mnt/sda1/download</code>"
msgid "Temp Path Enabled"
msgstr "启用临时目录"
msgid "Temp Path"
msgstr "临时路径"
msgid "The absolute and relative path can be set."
msgstr "可以设置绝对和相对路径。"
msgid "Disk Cache Size (MiB)"
msgstr "磁盘缓存"
msgid "The value -1 is auto and 0 is disable. In default, it is set to 64MiB."
msgstr "数值1是自动的0是禁用的。默认设置为64MiB。"
msgid "Disk Cache TTL (s)"
msgstr "磁盘缓存 TTL"
msgid "In default, it is set to 60s."
msgstr "默认设置为60秒。"
msgid "Saving Management"
msgstr "保存管理"
msgid "Default Torrent Management Mode"
msgstr "默认种子管理模式"
msgid "Manual"
msgstr "手动"
msgid "Automaic"
msgstr "自动"
msgid "Torrent Category Changed"
msgstr "当种子分类修改时"
msgid "Choose the action when torrent category changed."
msgstr "选择种子类别更改时的操作。"
msgid "Switch torrent to Manual Mode"
msgstr "将种子切换到手动模式"
msgid "Relocate torrent"
msgstr "重新定位种子"
msgid "Default Save Path Changed"
msgstr "当默认保存路径修改时"
msgid "Choose the action when default save path changed."
msgstr "选择默认保存路径更改时的操作。"
msgid "Switch affected torrent to Manual Mode"
msgstr "将受影响的种子切换到手动模式"
msgid "Relocate affected torrent"
msgstr "重新定位种子"
msgid "Category Save Path Changed"
msgstr "当分类保存路径修改时"
msgid "Choose the action when category save path changed."
msgstr "选择分类保存路径更改时的操作。"
msgid "Torrent Export Dir"
msgstr "种子导出目录"
msgid "The .torrent files will be copied to the target directory."
msgstr "种子文件将被复制到目标目录。例如:/etc/config"
msgid "Finished Torrent Export Dir"
msgstr "复制种子文件"
msgid "The .torrent files for finished downloads will be copied to the target directory."
msgstr "将已下载完成的种子文件复制到目标目录,例如:/etc/config"
msgid "Enable DHT"
msgstr "启用 DHT"
msgid "Enable DHT (decentralized network) to find more peers."
msgstr "启用 DHT(去中心化网络) 使 DHT分散网络能够找到更多的对等点。"
msgid "Enable PeX"
msgstr "启用 PeX"
msgid "Enable Peer Exchange (PeX) to find more peers."
msgstr "启用用户交换(PeX)以找到更多用户。"
msgid "Enable LSD"
msgstr "启用 LSD"
msgid "Enable Local Peer Discovery to find more peers."
msgstr "启用本地用户发现以找到更多用户。"
msgid "uTP Rate Limit"
msgstr "uTP 速度限制"
msgid "Apply rate limit to uTP protocol."
msgstr "针对 uTP 协议进行速度限制。"
msgid "Encryption Mode"
msgstr "加密模式"
msgid "Prefer Encryption"
msgstr "偏好加密"
msgid "Require Encryption"
msgstr "强制加密"
msgid "Disable Encryption"
msgstr "禁用加密"
msgid "Max Connections"
msgstr "连接数限制"
msgid "The max number of connections."
msgstr "全局最大连接数。"
msgid "Max Connections Per Torrent"
msgstr "种子连接数限制"
msgid "The max number of connections per torrent."
msgstr "每个种子的最大连接数。"
msgid "Max Uploads"
msgstr "最大上传数"
msgid "The max number of connected peers."
msgstr "全局最大上传线程数。"
msgid "Max Uploads Per Torrent"
msgstr "种子上传限制"
msgid "The max number of connected peers per torrent."
msgstr "每个种子上传线程最大值。"
msgid "Share rate limit"
msgstr "分享率限制"
msgid "Max Ratio"
msgstr "最大的分享率"
msgid "The max ratio for seeding. -1 is to disable the seeding."
msgstr "分享的最大比例设定。-1是禁用做种。"
msgid "Max Seeding Minutes"
msgstr "最大做种时间"
msgid "Units: minutes"
msgstr "做种最大比例设定。单位:分钟"
msgid "Max Ratio Action"
msgstr "达到后"
msgid "The action when reach the max seeding ratio."
msgstr "达到设定分享率和时间后的动作。"
msgid "Pause them"
msgstr "暂停"
msgid "Remove them"
msgstr "删除"
msgid "Queueing Setting"
msgstr "种子排队设置"
msgid "Enable Torrent Queueing"
msgstr "启用种子排队"
msgid "Maximum Active Downloads"
msgstr "最大活动的下载数"
msgid "Max Active Uploads"
msgstr "最大活动的上传数"
msgid "Max Active Torrents"
msgstr "最大活动的种子数"
msgid "Ignore Slow Torrents"
msgstr "忽略慢速的种子"
msgid "Do not count slow torrents in these limits."
msgstr "慢速的种子不包在括限制内。"
msgid "Download rate threshold"
msgstr "下载速度阈值"
msgid "Upload rate threshold"
msgstr "上传速度阈值"
msgid "Units: KiB/s"
msgstr "单位KiB/s"
msgid "Torrent inactivity timer"
msgstr "种子不活动时间"
msgid "Units: seconds"
msgstr "时间单位:分钟"
msgid "Username"
msgstr "用户名"
msgid "Password"
msgstr "密码"
msgid "Use UPnP for WebUI"
msgstr "WebUI 端口转发"
msgid "Using the UPnP / NAT-PMP port of the router for connecting to WebUI."
msgstr "使用路由器的 UPnP/NAT-PMP 端口转发到 WebUI。"
msgid "The login name for WebUI."
msgstr "WebUI 的登录用户名设置。"
msgid "The login password for WebUI."
msgstr "WebUI 用户的登录密码设置。"
msgid "The listening port for WebUI."
msgstr "WebUI 的登录端口设置默认端口8080。"
msgid "CSRF Protection"
msgstr "CSRF 保护"
msgid "Enable Cross-Site Request Forgery (CSRF) protection."
msgstr "启用跨站点请求伪造 (CSRF) 保护。"
msgid "Clickjacking Protection"
msgstr "劫持保护"
msgid "Enable clickjacking protection."
msgstr "启用点击劫持保护。"
msgid "Host Header Validation"
msgstr "主机标头验证"
msgid "Validate the host header."
msgstr "启用主机标头验证."
msgid "Local Host Authentication"
msgstr "本地主机认证"
msgid "Force authentication for clients on localhost."
msgstr "强制对本地主机上的客户端进行身份验证。"
msgid "Enable Subnet Whitelist"
msgstr "使子网白名单"
msgid "Subnet Whitelist"
msgstr "输入IP地址"
msgid "Skip authentication for clients in the IP subnet white list."
msgstr "对IP子网白名单中的客户端跳过身份验证."
msgid "Anonymous Mode"
msgstr "匿名模式"
msgid "When enabled, qBittorrent will take certain measures to try"
msgstr "启用后qBittorrent将采取某些措施隐藏其身份"
msgid "Super Seeding"
msgstr "超级种子"
msgid "The super seeding mode."
msgstr "超级种子模式。"
msgid "Limit Overhead Usage"
msgstr "开销限制"
msgid "The overhead usage is been limitted."
msgstr "对传送总开销进行速度限制。"
msgid "Ignore LAN Limit"
msgstr "LAN 限制"
msgid "Ignore the speed limit to LAN."
msgstr "忽略对 LAN 的速度限制。"
msgid "Use os Cache"
msgstr "使用 OS 操作系统缓存管理"
msgid "Max Outgoing Port"
msgstr "端口设置"
msgid "Min Outgoing Port"
msgstr "端口设置"
msgid "The max outgoing port."
msgstr "最大输出端口。"
msgid "The min outgoing port."
msgstr "最小输出端口。"
msgid "Choking Algorithm"
msgstr "数据传输算法"
msgid "The strategy of choking algorithm."
msgstr "数据传输算法的策略。"
msgid "Round Robin"
msgstr "负载均衡"
msgid "Fastest Upload"
msgstr "最快上传"
msgid "Anti-Leech"
msgstr "反吸血"
msgid "Announce To All Trackers"
msgstr "对所有 Trackers 宣告"
msgid "Announce To All Tiers"
msgstr "对所有 Tiers 宣告"
msgid "configuration file"
msgstr "配置文件"
msgid "Operation log"
msgstr "运行日志"
msgid "This page is the log document content of qbittorrent."
msgstr "本页是 qBittorrent 的日志文档内容。"
msgid "This page is the content of the configuration document under /etc/config/qbittorrent."
msgstr "本页是/etc/config/qbittorrent下的配置文档内容。"
msgid "Open Web Interface"
msgstr "打开管理页面"
msgid "Use UPnP/ NAT-PMP port forwarding from my router. Refer to the <a href=\"https://en.wikipedia.org/wiki/Port_forwarding\" target=\"_blank\">wiki</a>"
msgstr "使用路由器的 UPnP/NAT-PMP 端口转发,参考 <a href=\"https://en.wikipedia.org/wiki/Port_forwarding\" target=\"_blank\">wiki</a>"
msgid "When enabled, qBittorrent will take certain measures to try to mask its identity. Refer to the <a href=\"https://github.com/qbittorrent/qBittorrent/wiki/Anonymous-Mode\" target=\"_blank\">wiki</a>"
msgstr "启用后 qBittorrent 将采取某些措施来尝试掩盖其身份,参考<a href=\"https://github.com/qbittorrent/qBittorrent/wiki/Anonymous-Mode\" target=\"_blank\">wiki</a>"
msgid "Collecting data..."
msgstr "收集数据..."

View File

@ -1,23 +1,4 @@
config qbittorrent 'main'
option user 'root'
option Locale 'zh_CN'
option BTProtocol 'Both'
option DisableAutoTMMByDefault 'true'
option CategoryChanged 'false'
option DefaultSavePathChanged 'true'
option CategorySavePathChanged 'true'
option Encryption '0'
option MaxRatioAction '0'
option CSRFProtection 'false'
option SeedChokingAlgorithm 'FastestUpload'
option Enabled 'false'
option Port '8080'
option profile '/opt'
option UseRandomPort 'false'
option PortRangeMin '55555'
option TempPathEnabled 'false'
option enabled '0'
option AuthSubnetWhitelistEnabled 'true'
list AuthSubnetWhitelist '192.168.0.0/16'
config qbittorrent
option 'enabled' '0'
option 'port' '8080'
option 'profile_dir' '/opt/qbittorrent'

View File

@ -1,264 +1,36 @@
#!/bin/sh /etc/rc.common
# Licensed to the public under the Apache License 2.0.
# ubus call service list
START=99
USE_PROCD=1
PROG=/usr/bin/qbittorrent-nox
NAME=qbittorrent
args=/usr/bin/qbittorrent-nox
QBT_PID_FILE=/var/run/qbittorrent.pid
QBT_INI_FILE=/tmp/qBittorrent/config/qBittorrent.conf
QBT_INSTANCE=""
_info() {
logger -p daemon.info -t "$NAME" "$*"
}
_err() {
logger -p daemon.err -t "$NAME" "$*"
}
validate_QBT () {
uci_validate_section "$NAME" vlmcsd "$1" \
'enabled:bool:1' \
'user:string:root' \
'profile:string:/tmp' \
'configuration:string' \
'DHT:or("true","false"):true' \
'Encryption:or("0","1","2"):0' \
'LSD:or("true","false"):true' \
'MaxConnecs:integer' \
'MaxConnecsPerTorrent:integer' \
'MaxRatio:float' \
'MaxRatioAction:or("0","1")' \
'MaxUploads:integer' \
'MaxUploadsPerTorrent:integer' \
'PeX:or("true","false"):true' \
'uTP_rate_limited:or("true","false"):true' \
'PortRangeMin:port' \
'InetAddress:string' \
'UPnP:or("true","false"):true' \
'GlobalDLLimit:float' \
'GlobalDLLimitAlt:float' \
'GlobalUPLimit:float' \
'GlobalUPLimitAlt:float' \
'DiskWriteCacheSize:integer' \
'DiskWriteCacheTTL:integer' \
'FinishedTorrentExportDir:string' \
'PreAllocation:or("true","false"):false' \
'SavePath:string:/tmp/download' \
'StartInPause:or("true","false"):false' \
'TempPathEnabled:or("true","false"):true' \
'TempPath:string:temp/' \
'UseIncompleteExtension:or("true","false"):false' \
'TorrentExportDir:string' \
'Locale:string:en' \
'UseRandomPort:or("true","false"):true' \
'IgnoreSlowTorrents:or("true","false")' \
'MaxActiveDownloads:integer' \
'MaxActiveTorrents:integer' \
'MaxActiveUploads:integer' \
'QueueingEnabled:or("true","false")' \
'AuthSubnetWhitelist:string' \
'AuthSubnetWhitelistEnabled:or("true","false"):false' \
'ClickjackingProtection:or("true","false"):true' \
'CSRFProtection:or("true","false"):true' \
'HostHeaderValidation:or("true","false"):true' \
'LocalHostAuth:or("true","false"):true' \
'Password:string' \
'Port:port:8080' \
'Username:string' \
'UseUPnP:or("true","false"):false' \
'AnonymousMode:or("true","false"):true' \
'AnnounceToAllTrackers:or("true","false")' \
'IgnoreLimitsLAN:or("true","false"):true' \
'IncludeOverhead:or("true","false"):false' \
'osCache:or("true","false")' \
'OutgoingPortsMax:port' \
'OutgoingPortsMin:port' \
'AnnounceToAllTiers:or("true","false")' \
'BTProtocol:or("Both","TCP","UTP")' \
'CreateTorrentSubfolder:or("true","false"):true' \
'DisableAutoTMMByDefault:or("true","false"):true' \
'SuperSeeding:or("true","false"):false' \
'GlobalMaxSeedingMinutes:integer' \
'SeedChokingAlgorithm:or("RoundRobin","FastestUpload","AntiLeech")' \
'SlowTorrentsDownloadRate:integer' \
'SlowTorrentsInactivityTimer:integer' \
'SlowTorrentsUploadRate:integer' \
'CategoryChanged:or("true","false"):false' \
'CategorySavePathChanged:or("true","false"):true' \
'DefaultSavePathChanged:or("true","false"):true' \
'AutoDeleteAddedTorrentFile:or("Never","IfAdded"):Never' \
'Enabled:or("true","false")' \
'Path:string' \
'Backup:or("true","false")' \
'DeleteOld:or("true","false")' \
'MaxSizeBytes:integer' \
'SaveTime:string'
}
sed_options () {
local Anchor=$1
local category=$( echo $2 | sed 's/\s/\\\\/g' )
shift
shift
if [ $( sed -n '/^\['"$Anchor"'\]/p' $QBT_INI_FILE | wc -l ) -lt 1 ]; then
sed -i '$a\\n\['"$Anchor"'\]' "$QBT_INI_FILE"
fi
local o; local v; local ol
for o in "$@"; do
v=$( echo "$(eval echo "\$$o")" | sed 's/[\/\.]/\\&/g' )
[ -n "$category" ] && ol="$category\\\\$o" || ol="$o"
[ -n "$v" ] && {
if [ $( sed -n '/^'"$ol"'=/p' $QBT_INI_FILE | wc -l ) -lt 1 ]; then
sed -i '/'"$Anchor"'/a'"$ol"'='"$v" "$QBT_INI_FILE"
else
sed -i 's/'"$ol"'=.*/'"$ol"'='"$v"'/g' "$QBT_INI_FILE"
fi
} || {
sed -i '/'"$ol"'=.*/d' "$QBT_INI_FILE"
}
done
}
config_QBT () {
local Password_ha1="";local Age="";local AgeType=""
[ -n "$Password" ] && \
Password_ha1="@ByteArray($(echo -n $Password|md5sum|grep -oE '[a-z0-9]{32}'))"
[ -n "$SaveTime" ] && {
[ -n "$(echo $SaveTime | sed 's/[0-9dmyDMY]//g')" ] && { _err "Error save time setted."; return 1; }
Age="$(echo $SaveTime | sed 's/[dmyDMY]//g')"
AgeType="$(echo $SaveTime | sed 's/[0-9]//g' | sed 's/[dD]/0/g' | sed 's/[mM]/1/g' | sed 's/[yY]/2/g')"
}
[ -f "$QBT_INI_FILE" ] || {
cat>"$QBT_INI_FILE"<<EOF
[LegalNotice]
Accepted=true
[Network]
Cookies=@Invalid()
EOF
}
sed_options "Core" "" \
"AutoDeleteAddedTorrentFile"
sed_options "BitTorrent" "Session DisableAutoTMMTriggers" \
"CategoryChanged" "CategorySavePathChanged" "DefaultSavePathChanged"
sed_options "BitTorrent" "Session" \
"AnnounceToAllTiers" "BTProtocol" "CreateTorrentSubfolder" "DisableAutoTMMByDefault" "GlobalMaxSeedingMinutes" \
"SeedChokingAlgorithm" "SlowTorrentsDownloadRate" "SlowTorrentsInactivityTimer" "SlowTorrentsUploadRate"
sed_options "Preferences" "WebUI" \
"AuthSubnetWhitelistEnabled" "AuthSubnetWhitelist" "CSRFProtection" \
"ClickjackingProtection" "HostHeaderValidation" "LocalHostAuth" \
"Password_ha1" "Port" "Username" "UseUPnP"
sed_options "Preferences" "Queueing" \
"IgnoreSlowTorrents" "MaxActiveDownloads" "MaxActiveTorrents" "MaxActiveUploads" \
"QueueingEnabled"
sed_options "Preferences" "General" \
"Locale" "UseRandomPort"
sed_options "Preferences" "Downloads" \
"DiskWriteCacheSize" "DiskWriteCacheTTL" "FinishedTorrentExportDir" "PreAllocation" \
"SavePath" "StartInPause" "TempPathEnabled" "TempPath" "TorrentExportDir" \
"UseIncompleteExtension"
sed_options "Preferences" "Connection" \
"GlobalDLLimit" "GlobalDLLimitAlt" "GlobalUPLimit" "GlobalUPLimitAlt" \
"PortRangeMin" "InetAddress" "UPnP"
sed_options "Preferences" "Bittorrent" \
"DHT" "Encryption" "LSD" "MaxConnecs" "MaxConnecsPerTorrent" "MaxRatio" \
"MaxRatioAction" "MaxUploads" "MaxUploadsPerTorrent" "PeX" "uTP_rate_limited"
sed_options "Preferences" "Advanced" \
"AnnounceToAllTrackers" "AnonymousMode" "IgnoreLimitsLAN" "IncludeOverhead" "osCache" "OutgoingPortsMax" \
"OutgoingPortsMin" "SuperSeeding"
sed_options "Application" "FileLogger" \
"Enabled" "Path" "Backup" "DeleteOld" "MaxSizeBytes" "Age" "AgeType"
}
init_QBT(){
local section="$1"
QBT_INSTANCE="${NAME}.${section}"
validate_QBT "$section" || { _err "Validation failed."; return 1; }
[ x"$enabled" = x0 ] && {
_info "Instance \"${section}\" disabled.";
procd_kill "$NAME" "$QBT_INSTANCE" >/dev/null 2>&1;
return 1;
}
local confdir="qBittorrent"
[ -n "$configuration" ] && {
confdir="qBittorrent_$configuration"
}
[ -d "$profile/$confdir/config" ] || {
mkdir -m 0755 -p "$profile/$confdir/config"
}
[ "$user" != "root" ] && {
[ -d "$confdir" ] && {
local groupnow="$(ls -l $profile | grep $confdir | awk '{print $3})"
local usernow="$(ls -l $profile | grep $confdir | awk '{print $4})"
[ "$usernow" != "$user" ] && { _err "Permission denied!"; return 1; }
} || {
chmod -R g+w "$profile/$confdir"
chown -R "$user":"$user" "$profile/$confdir"
}
}
[ "$AuthSubnetWhitelistEnabled" = true ] && {
AuthSubnetWhitelist="$( echo $AuthSubnetWhitelist | sed 's/ /,/g')"
} || {
AuthSubnetWhitelist="@Invalid()"
}
QBT_INI_FILE="$profile/$confdir/config/qBittorrent.conf"
config_QBT
procd_open_instance $QBT_INSTANCE
procd_set_param command $args
procd_append_param command --profile="$profile"
[ -n "$configuration" ] && {
procd_append_param command --configuration="$configuration"
}
procd_set_param respawn
procd_set_param user $user
procd_set_param file $QBT_INI_FILE
procd_set_param pidfile $QBT_PID_FILE
procd_close_instance
}
service_triggers()
{
procd_add_reload_trigger "$NAME"
get_config() {
config_get_bool enabled $1 enabled 1
config_get port $1 port 8080
config_get profile_dir $1 profile_dir "/etc/qbittorrent"
}
start_service() {
config_load "$NAME"
config_foreach init_QBT "$NAME"
config_load qbittorrent
config_foreach get_config qbittorrent
[ $enabled != 1 ] && return 1
if [ ! -f "$profile_dir/qBittorrent/config/qBittorrent.conf" ]; then
mkdir -p $profile_dir/qBittorrent/config/
cp /etc/qbittorrent/qBittorrent.conf.example $profile_dir/qBittorrent/config/qBittorrent.conf
fi
procd_open_instance
procd_set_param command $PROG
procd_append_param command --webui-port=$port --profile=$profile_dir
procd_set_param respawn
procd_close_instance
}
service_triggers() {
procd_add_reload_trigger "qbittorrent"
}
reload_service() {
restart
}
restart() {
stop
sleep 2
sleep 1
start
}

View File

@ -7,5 +7,7 @@ uci -q batch <<-EOF >/dev/null
commit ucitrack
EOF
mkdir /opt
rm -f /tmp/luci-indexcache*
exit 0

View File

@ -1,21 +0,0 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@qbittorrent[-1]
add ucitrack qbittorrent
set ucitrack.@qbittorrent[-1].init=qbittorrent
commit ucitrack
EOF
if [ ."$(uci -q get qbittorrent.main)" != ."qbittorrent" ]; then
uci -q batch <<-EOF >/dev/null
add qbittorrent qbittorrent
rename qbittorrent.@qbittorrent[-1]="main"
set qbittorrent.main.enabled=0
set qbittorrent.main.profile="/tmp"
commit qbittorrent
EOF
fi
rm -f /tmp/luci-indexcache
exit 0