|
|
先说设备:电犀牛的R68S
环境如下(cat /etc/openwrt_release):
DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='23.05.0'
DISTRIB_TARGET='rockchip/rk35xx'
DISTRIB_ARCH='aarch64_generic'
DISTRIB_TAINTS='no-all override'
DISTRIB_REVISION='R25.3.3'
DISTRIB_DESCRIPTION='QWRT '
接下来是步骤:
1、安装软件源自带的msd_lite.ipk(可以图形界面操作也可以命令行操作)
2、vi /usr/lib/lua/luci/controller/msd_lite.lua 内容为:(esc后输入wq按回车为保存,这个应该知道吧,后面也一样)
module("luci.controller.msd_lite", package.seeall)
function index()
if not nixio.fs.access("/etc/config/msd_lite") then
return
end
local page
page = entry({"admin", "services", "msd_lite"}, cbi("msd_lite"), _("MultiSD_Lite"), 60)
page.dependent = true
page = entry({"admin", "services", "msd_lite", "status"}, call("act_status"))
page.leaf = true
end
local function is_running()
return luci.sys.call("pidof msd_lite >/dev/null") == 0
end
function act_status()
local e = {}
e.running = is_running()
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
3、vi /usr/lib/lua/luci/model/cbi/msd_lite.lua 内容为:
require ("nixio.fs")
require ("luci.sys")
require ("luci.http")
require ("luci.dispatcher")
require "luci.model.uci".cursor()
m = Map("msd_lite")
m.title = translate("Multi Stream daemon Lite")
m.description = translate("The lightweight version of Multi Stream daemon (msd) Program for organizing IP TV streaming on the network via HTTP.")
m:section(SimpleSection).template = "msd_lite/msd_lite_status"
s = m:section(TypedSection, "instance")
s.addremove = true
s.anonymous = false
s.addbtntitle = translate("Add instance")
o = s ption(Flag, "enabled", translate("Enable"))
o.default = o.disabled
o.rmempty = false
o = s ption(DynamicList, "address", translate("Bind address"))
o.datatype = "list(ipaddrport(1))"
o.rmempty = false
o = s ption(ListValue, "network", translate("Source interface"))
local x = luci.model.uci.cursor()
local net = x:get_all("network")
for interface, config in pairs(net) do
if interface ~= "loopback" and config.proto ~= nil then
o:value(interface)
end
end
o:value("", translate("Disable"))
o.default = ""
o.description = translate("For multicast receive.")
o = s ption(Value, "threads", translate("Worker threads"))
o.datatype = "uinteger"
o.default = "0"
o.description = translate("0 = auto.")
o = s ption(Flag, "bind_to_cpu", translate("Bind threads to CPUs"))
o.default = o.disabled
o = s ption(Flag, "drop_slow_clients", translate("Disconnect slow clients"))
o.default = o.disabled
o = s ption(Value, "precache_size", translate(" re cache size"))
o.datatype = "uinteger"
o.default = "4096"
o = s ption(Value, "ring_buffer_size", translate("Ring buffer size"))
o.datatype = "uinteger"
o.default = "1024"
o.description = translate("Stream receive ring buffer size.")
o = s ption(Value, "multicast_recv_buffer_size", translate("Receive buffer size"))
o.datatype = "uinteger"
o.default = "512"
o.description = translate("Multicast receive socket buffer size.")
o = s ption(Value, "multicast_recv_timeout", translate("Receive timeout"))
o.datatype = "uinteger"
o.default = "2"
o.description = translate("Multicast receive timeout.")
o = s ption(Value, "rejoin_time", translate("IGMP/MLD rejoin time"))
o.datatype = "uinteger"
o.default = "0"
o.description = translate("Do IGMP/MLD leave+join every X seconds. Leave <em>0</em> to disable.")
return m
4、vi /usr/lib/lua/luci/view/msd_lite/msd_lite_status.htm 内容为:
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=luci.dispatcher.build_url("admin", "services", "msd_lite", "status")%>', null,
function(x, data) {
var tb = document.getElementById('msd_lite_status');
if (data && tb) {
var links = "";
if (data.running) {
links = '<b><font color=green>msd_lite - <%:RUNNING%></font></b></em>';
} else {
links = '<b><font color=red>msd_lite - <%:NOT RUNNING%></font></b>';
}
tb.innerHTML = links;
}
}
);
//]]>
</script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<p id="msd_lite_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>
5、此时已经可以正常用了,如果你觉得英文看着不爽,那就安装适配你设备的luci-app-msd_lite和luci-i18n语言包,再刷新就成了中文了(先装上luci-app,然后才能安装语言包,用英文的忽略此步骤)。
6、hotplug脚本可以通过关键字搜索,论坛上面有脚本文件。
发帖注意事项
请勿胡乱发帖:https://www.right.com.cn/forum/thread-8307840-1-1.html
账户手机验证:https://www.right.com.cn/forum/home.php?mod=spacecp&ac=plugin&id=jzsjiale_sms:home
|
|