diff --git a/luci-app-msd_lite/Makefile b/luci-app-msd_lite/Makefile index 778a9862d..42d2d9b27 100644 --- a/luci-app-msd_lite/Makefile +++ b/luci-app-msd_lite/Makefile @@ -1,11 +1,19 @@ -# Copyright (C) 2022 ImmortalWrt.org +# +# Copyright (C) 2008-2022 The LuCI Team +# +# This is free software, licensed under the Apache License, Version 2.0. +# +# Converted by ximitech include $(TOPDIR)/rules.mk -LUCI_TITLE:=LuCI support for Multi stream daemon lite -LUCI_DEPENDS:=+msd_lite +PKG_VERSION:=20221214 +PKG_RELEASE:=1 + +LUCI_TITLE:=LuCI support for Multi Stream Daemon Lite +LUCI_DEPENDS:=+msd_lite +luci-compat LUCI_PKGARCH:=all include $(TOPDIR)/feeds/luci/luci.mk -# call BuildPackage - OpenWrt buildroot signature +# call BuildPackage - OpenWrt buildroot signature \ No newline at end of file diff --git a/luci-app-msd_lite/README.md b/luci-app-msd_lite/README.md new file mode 100644 index 000000000..99fe19dd1 --- /dev/null +++ b/luci-app-msd_lite/README.md @@ -0,0 +1 @@ +# msd_lite's lua luci app, use it with msd_lite package from ImmortalWrt. \ No newline at end of file diff --git a/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js b/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js deleted file mode 100644 index c0868ed51..000000000 --- a/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2022 ImmortalWrt.org */ - -'use strict'; -'require view'; -'require form'; -'require tools.widgets as widgets'; - -return view.extend({ - render: function () { - var m, s, o; - - m = new form.Map('msd_lite', _('Multi Stream daemon Lite'), - _('The lightweight version of Multi Stream daemon (msd) Program for organizing IP TV streaming on the network via HTTP.')); - - s = m.section(form.TypedSection, 'instance'); - s.anonymous = true; - s.addremove = true; - s.addbtntitle = _('Add instance'); - - o = s.option(form.Flag, 'enabled', _('Enable')); - o.default = o.disabled; - o.rmempty = false; - - o = s.option(form.DynamicList, 'address', _('Bind address')); - o.datatype = 'ipaddrport(1)'; - o.rmempty = false; - - o = s.option(widgets.DeviceSelect, 'interface', _('Source interface'), - _('For multicast receive.')); - o.noaliases = true; - o.nocreate = true; - o.optional = true; - - o = s.option(form.Value, 'threads', _('Worker threads'), - _('Leave 0 or empty to auto detect.')); - o.datatype = 'uinteger'; - o.default = '0'; - - o = s.option(form.Flag, 'bind_to_cpu', _('Bind threads to CPUs')); - o.default = o.disabled; - - o = s.option(form.Flag, 'drop_slow_clients', _('Disconnect slow clients')); - o.default = o.disabled; - - o = s.option(form.Value, 'precache_size', _('Pre cache size')); - o.datatype = 'uinteger'; - o.default = '4096'; - - o = s.option(form.Value, 'ring_buffer_size', _('Ring buffer size'), - _('Stream receive ring buffer size.')); - o.datatype = 'uinteger'; - o.default = '1024'; - - o = s.option(form.Value, 'multicast_recv_buffer_size', _('Receive buffer size'), - _('Multicast receive socket buffer size.')); - o.datatype = 'uinteger'; - o.default = '512'; - - o = s.option(form.Value, 'multicast_recv_timeout', _('Receive timeout'), - _('Multicast receive timeout.')); - o.datatype = 'uinteger'; - o.default = '2'; - - return m.render(); - } -}); diff --git a/luci-app-msd_lite/luasrc/controller/msd_lite.lua b/luci-app-msd_lite/luasrc/controller/msd_lite.lua new file mode 100644 index 000000000..607208091 --- /dev/null +++ b/luci-app-msd_lite/luasrc/controller/msd_lite.lua @@ -0,0 +1,25 @@ + +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 diff --git a/luci-app-msd_lite/luasrc/model/cbi/msd_lite.lua b/luci-app-msd_lite/luasrc/model/cbi/msd_lite.lua new file mode 100644 index 000000000..d4bcebbc4 --- /dev/null +++ b/luci-app-msd_lite/luasrc/model/cbi/msd_lite.lua @@ -0,0 +1,65 @@ +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:option(Flag, "enabled", translate("Enable")) +o.default = o.disabled +o.rmempty = false + +o = s:option(DynamicList, "address", translate("Bind address")) +o.datatype = "list(ipaddrport(1))" +o.rmempty = false + +o = s:option(ListValue, "interface", translate("Source interface")) +local interfaces = luci.sys.exec("ls -l /sys/class/net/ 2>/dev/null |awk '{print $9}' 2>/dev/null") +for interface in string.gmatch(interfaces, "%S+") do + o:value(interface) +end +o:value("", translate("Disable")) +o.default = "" +o.description = translate("For multicast receive.") + +o = s:option(Value, "threads", translate("Worker threads")) +o.datatype = "uinteger" +o.default = "0" +o.description = translate("0 = auto.") + +o = s:option(Flag, "bind_to_cpu", translate("Bind threads to CPUs")) +o.default = o.disabled + +o = s:option(Flag, "drop_slow_clients", translate("Disconnect slow clients")) +o.default = o.disabled + +o = s:option(Value, "precache_size", translate("Pre cache size")) +o.datatype = "uinteger" +o.default = "4096" + +o = s:option(Value, "ring_buffer_size", translate("Ring buffer size")) +o.datatype = "uinteger" +o.default = "1024" +o.description = translate("Stream receive ring buffer size.") + +o = s:option(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:option(Value, "multicast_recv_timeout", translate("Receive timeout")) +o.datatype = "uinteger" +o.default = "2" +o.description = translate("Multicast receive timeout.") + +return m diff --git a/luci-app-msd_lite/luasrc/view/msd_lite/msd_lite_status.htm b/luci-app-msd_lite/luasrc/view/msd_lite/msd_lite_status.htm new file mode 100644 index 000000000..3b1eab78a --- /dev/null +++ b/luci-app-msd_lite/luasrc/view/msd_lite/msd_lite_status.htm @@ -0,0 +1,24 @@ + + +
+

+ <%:Collecting data...%> +

+
\ No newline at end of file diff --git a/luci-app-msd_lite/po/templates/msd_lite.pot b/luci-app-msd_lite/po/templates/msd_lite.pot deleted file mode 100644 index 12e403e2a..000000000 --- a/luci-app-msd_lite/po/templates/msd_lite.pot +++ /dev/null @@ -1,81 +0,0 @@ -msgid "" -msgstr "Content-Type: text/plain; charset=UTF-8" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:18 -msgid "Add instance" -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:24 -msgid "Bind address" -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:39 -msgid "Bind threads to CPUs" -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:42 -msgid "Disconnect slow clients" -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:20 -msgid "Enable" -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:29 -msgid "For multicast receive." -msgstr "" - -#: applications/luci-app-msd_lite/root/usr/share/rpcd/acl.d/luci-app-msd_lite.json:3 -msgid "Grant UCI access for luci-app-msd_lite" -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:35 -msgid "Leave 0 or empty to auto detect." -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:12 -#: applications/luci-app-msd_lite/root/usr/share/luci/menu.d/luci-app-msd_lite.json:3 -msgid "Multi Stream daemon Lite" -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:55 -msgid "Multicast receive socket buffer size." -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:60 -msgid "Multicast receive timeout." -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:45 -msgid "Pre cache size" -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:54 -msgid "Receive buffer size" -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:59 -msgid "Receive timeout" -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:49 -msgid "Ring buffer size" -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:28 -msgid "Source interface" -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:50 -msgid "Stream receive ring buffer size." -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:13 -msgid "" -"The lightweight version of Multi Stream daemon (msd) Program for organizing " -"IP TV streaming on the network via HTTP." -msgstr "" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:34 -msgid "Worker threads" -msgstr "" diff --git a/luci-app-msd_lite/po/zh-cn b/luci-app-msd_lite/po/zh-cn deleted file mode 120000 index 8d69574dd..000000000 --- a/luci-app-msd_lite/po/zh-cn +++ /dev/null @@ -1 +0,0 @@ -zh_Hans \ No newline at end of file diff --git a/luci-app-msd_lite/po/zh-cn/msd_lite.po b/luci-app-msd_lite/po/zh-cn/msd_lite.po new file mode 100644 index 000000000..b77535ded --- /dev/null +++ b/luci-app-msd_lite/po/zh-cn/msd_lite.po @@ -0,0 +1,63 @@ + +msgid "NOT RUNNING" +msgstr "未运行" + +msgid "RUNNING" +msgstr "运行中" + +msgid "MultiSD_Lite" +msgstr "MultiSD_Lite" + +msgid "Multi Stream daemon Lite" +msgstr "组播转换 Lite" + +msgid "The lightweight version of Multi Stream daemon (msd) Program for organizing IP TV streaming on the network via HTTP." +msgstr "Multi Stream daemon (msd) 程序的轻量级版本,用于通过 HTTP 管理网络上的 IP TV 流。" + +msgid "Add instance" +msgstr "添加实例" + +msgid "Enable" +msgstr "启用" + +msgid "Bind address" +msgstr "绑定地址" + +msgid "Source interface" +msgstr "源接口" + +msgid "For multicast receive." +msgstr "用于接收组播流。" + +msgid "Worker threads" +msgstr "工作线程" + +msgid "0 = auto." +msgstr "保留为 0 以自动检测。" + +msgid "Bind threads to CPUs" +msgstr "绑定线程到 CPU" + +msgid "Disconnect slow clients" +msgstr "断开慢速客户端" + +msgid "Pre cache size" +msgstr "预缓存大小" + +msgid "Ring buffer size" +msgstr "环形缓冲区大小" + +msgid "Stream receive ring buffer size." +msgstr "流接收环形缓冲区大小。" + +msgid "Receive buffer size" +msgstr "接收缓冲区大小" + +msgid "Multicast receive socket buffer size." +msgstr "组播接收套接字缓冲区大小。" + +msgid "Receive timeout" +msgstr "接收超时" + +msgid "Multicast receive timeout." +msgstr "组播接收超时。" diff --git a/luci-app-msd_lite/po/zh_Hans b/luci-app-msd_lite/po/zh_Hans new file mode 120000 index 000000000..41451e4a1 --- /dev/null +++ b/luci-app-msd_lite/po/zh_Hans @@ -0,0 +1 @@ +zh-cn \ No newline at end of file diff --git a/luci-app-msd_lite/po/zh_Hans/msd_lite.po b/luci-app-msd_lite/po/zh_Hans/msd_lite.po deleted file mode 100644 index b9f45e22b..000000000 --- a/luci-app-msd_lite/po/zh_Hans/msd_lite.po +++ /dev/null @@ -1,90 +0,0 @@ -msgid "" -msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" -"Project-Id-Version: PACKAGE VERSION\n" -"Last-Translator: Automatically generated\n" -"Language-Team: none\n" -"Language: zh-Hans\n" -"MIME-Version: 1.0\n" -"Content-Transfer-Encoding: 8bit\n" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:18 -msgid "Add instance" -msgstr "添加实例" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:24 -msgid "Bind address" -msgstr "绑定地址" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:39 -msgid "Bind threads to CPUs" -msgstr "绑定线程到 CPU" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:42 -msgid "Disconnect slow clients" -msgstr "断开慢速客户端" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:20 -msgid "Enable" -msgstr "启用" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:29 -msgid "For multicast receive." -msgstr "用于接收组播流。" - -#: applications/luci-app-msd_lite/root/usr/share/rpcd/acl.d/luci-app-msd_lite.json:3 -msgid "Grant UCI access for luci-app-msd_lite" -msgstr "授予 luci-app-msd_lite 访问 UCI 配置的权限。" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:35 -msgid "Leave 0 or empty to auto detect." -msgstr "保留为 0 或留空以自动检测。" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:12 -#: applications/luci-app-msd_lite/root/usr/share/luci/menu.d/luci-app-msd_lite.json:3 -msgid "Multi Stream daemon Lite" -msgstr "组播转换 Lite" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:55 -msgid "Multicast receive socket buffer size." -msgstr "组播接收套接字缓冲区大小。" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:60 -msgid "Multicast receive timeout." -msgstr "组播接收超时。" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:45 -msgid "Pre cache size" -msgstr "预缓存大小" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:54 -msgid "Receive buffer size" -msgstr "接收缓冲区大小" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:59 -msgid "Receive timeout" -msgstr "接收超时" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:49 -msgid "Ring buffer size" -msgstr "环形缓冲区大小" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:28 -msgid "Source interface" -msgstr "源接口" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:50 -msgid "Stream receive ring buffer size." -msgstr "流接收环形缓冲区大小。" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:13 -msgid "" -"The lightweight version of Multi Stream daemon (msd) Program for organizing " -"IP TV streaming on the network via HTTP." -msgstr "" -"Multi Stream daemon (msd) 程序的轻量级版本,用于通过 HTTP 管理网络上的 IP TV " -"流。" - -#: applications/luci-app-msd_lite/htdocs/luci-static/resources/view/msd_lite.js:34 -msgid "Worker threads" -msgstr "工作线程" diff --git a/luci-app-msd_lite/root/etc/uci-defaults/40_luci-msd_lite b/luci-app-msd_lite/root/etc/uci-defaults/40_luci-msd_lite new file mode 100644 index 000000000..190db09a7 --- /dev/null +++ b/luci-app-msd_lite/root/etc/uci-defaults/40_luci-msd_lite @@ -0,0 +1,12 @@ +#!/bin/sh + +# needed for "Save and Apply" to restart msd_lite +uci -q batch <<-EOF >/dev/null + delete ucitrack.@msd_lite[-1] + add ucitrack msd_lite + set ucitrack.@msd_lite[-1].init=msd_lite + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/luci-app-msd_lite/root/usr/share/luci/menu.d/luci-app-msd_lite.json b/luci-app-msd_lite/root/usr/share/luci/menu.d/luci-app-msd_lite.json deleted file mode 100644 index a7e389d34..000000000 --- a/luci-app-msd_lite/root/usr/share/luci/menu.d/luci-app-msd_lite.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "admin/services/msd_lite": { - "title": "Multi Stream daemon Lite", - "action": { - "type": "view", - "path": "msd_lite" - }, - "depends": { - "acl": [ "luci-app-msd_lite" ], - "uci": { "msd_lite": true } - } - } -} diff --git a/luci-app-msd_lite/root/usr/share/rpcd/acl.d/luci-app-msd_lite.json b/luci-app-msd_lite/root/usr/share/rpcd/acl.d/luci-app-msd_lite.json deleted file mode 100644 index ef1c345eb..000000000 --- a/luci-app-msd_lite/root/usr/share/rpcd/acl.d/luci-app-msd_lite.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "luci-app-msd_lite": { - "description": "Grant UCI access for luci-app-msd_lite", - "read": { - "uci": [ "msd_lite" ] - }, - "write": { - "uci": [ "msd_lite" ] - } - } -}