local fs = require "nixio.fs" local util = require "nixio.util" local running=(luci.sys.call("pidof EmbedThunderManager > /dev/null") == 0) local button="" local xunleiinfo="" local tblXLInfo={} local detailInfo = "
启动后会看到类似如下信息:

[ 0, 1, 1, 0, “7DHS94”,1, “201_2.1.3.121”, “shdixang”, 1 ]

其中有用的几项为:

第一项: 0表示返回结果成功;

第二项: 1表示检测网络正常,0表示检测网络异常;

第四项: 1表示已绑定成功,0表示未绑定;

第五项: 未绑定的情况下,为绑定的需要的激活码;

第六项: 1表示磁盘挂载检测成功,0表示磁盘挂载检测失败。" if running then xunleiinfo = luci.sys.exec("wget-ssl http://127.0.0.1:9000/getsysinfo -O - 2>/dev/null") m = Map("xunlei", translate("Xware"), translate("迅雷远程下载 运行中")) string.gsub(string.sub(xunleiinfo, 2, -2),'[^,]+',function(w) table.insert(tblXLInfo, w) end) detailInfo = [[

启动信息:]] .. xunleiinfo .. [[

]] if tonumber(tblXLInfo[1]) == 0 then detailInfo = detailInfo .. [[

状态正常

]] else detailInfo = detailInfo .. [[

执行异常

]] end if tonumber(tblXLInfo[2]) == 0 then detailInfo = detailInfo .. [[

网络异常

]] else detailInfo = detailInfo .. [[

网络正常

]] end if tonumber(tblXLInfo[4]) == 0 then detailInfo = detailInfo .. [[

未绑定]].. [[  激活码:]].. tblXLInfo[5] ..[[

]] else detailInfo = detailInfo .. [[

已绑定

]] end if tonumber(tblXLInfo[6]) == 0 then detailInfo = detailInfo .. [[

磁盘挂载检测失败

]] else detailInfo = detailInfo .. [[

磁盘挂载检测成功

]] end else m = Map("xunlei", translate("Xware"), translate("迅雷远程下载 未运行")) end ----------- --Xware-- ----------- s = m:section(TypedSection, "xunlei","Xware 设置") s.anonymous = true s:tab("basic", translate("Settings")) enable = s:taboption("basic", Flag, "enable", "启用 迅雷远程下载") enable.rmempty = false vod = s:taboption("basic", Flag, "vod", "删除迅雷VOD服务器", "删除迅雷VOD服务器,减少上传流量。") vod.rmempty = false s:taboption("basic", DummyValue,"opennewwindow" ,"

", detailInfo) s:taboption("basic", DummyValue,"opennewwindow" ,"

", "
打开迅雷远程下载页面。首次运行将激活码填进网页即可绑定。") s:tab("editconf_etm", translate("Xware 配置")) editconf_etm = s:taboption("editconf_etm", Value, "_editconf_etm", translate("Xware 配置:"), translate("注释用“ ; ”")) editconf_etm.template = "cbi/tvalue" editconf_etm.rows = 20 editconf_etm.wrap = "off" function editconf_etm.cfgvalue(self, section) return fs.readfile("/tmp/etc/etm.cfg") or "" end function editconf_etm.write(self, section, value2) if value2 then value2 = value2:gsub("\r\n?", "\n") fs.writefile("/tmp/etm.cfg", value2) if (luci.sys.call("cmp -s /tmp/etm.cfg /tmp/etc/etm.cfg") == 1) then fs.writefile("/tmp/etc/etm.cfg", value2) end fs.remove("/tmp/etm.cfg") end end s:tab("editconf_download", translate("下载配置")) editconf_download = s:taboption("editconf_download", Value, "_editconf_download", translate("下载配置"), translate("注释用“ ; ”")) editconf_download.template = "cbi/tvalue" editconf_download.rows = 20 editconf_download.wrap = "off" function editconf_download.cfgvalue(self, section) return fs.readfile("/tmp/etc/download.cfg") or "" end function editconf_download.write(self, section, value3) if value3 then value3 = value3:gsub("\r\n?", "\n") fs.writefile("/tmp/download.cfg", value3) if (luci.sys.call("cmp -s /tmp/download.cfg /tmp/etc/download.cfg") == 1) then fs.writefile("/tmp/etc/download.cfg", value3) end fs.remove("/tmp/download.cfg") end end return m