Merge Lean's source

This commit is contained in:
CN_SZTL 2020-04-06 19:37:54 +08:00
commit a2095b16f1
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
8 changed files with 210 additions and 0 deletions

View File

@ -0,0 +1,18 @@
#
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=Luci for Music Remote Center
LUCI_DEPENDS:=+alsa-utils +forked-daapd
LUCI_PKGARCH:=all
PKG_VERSION:=1
PKG_RELEASE:=3
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,21 @@
module("luci.controller.forked-daapd", package.seeall)
function index()
if not nixio.fs.access("/etc/config/forked-daapd") then
return
end
entry({"admin", "nas", "forked-daapd"}, cbi("forked-daapd"), _("Music Remote Center")).dependent = true
entry({"admin","nas","forked-daapd","run"},call("act_status")).leaf=true
end
function act_status()
local e={}
e.running=luci.sys.call("pgrep forked-daapd >/dev/null")==0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end

View File

@ -0,0 +1,31 @@
-- Copyright 2020 Lean <coolsnowwolf@gmail.com>
-- Licensed to the public under the Apache License 2.0.
m = Map("forked-daapd", translate("Music Remote Center"), translate("Music Remote Center is a DAAP (iTunes Remote), MPD (Music Player Daemon) and RSP (Roku) media server."))
m:section(SimpleSection).template = "forked-daapd/forked-daapd_status"
s = m:section(TypedSection, "forked-daapd")
s.addremove = false
s.anonymous = true
enable=s:option(Flag, "enabled", translate("Enabled"))
enable.default = "0"
enable.rmempty = false
port=s:option(Value, "port", translate("Port"))
port.rmempty = false
port.datatype = "port"
db_path=s:option(Value, "db_path", translate("Database File Path"))
db_path.default = "/opt/forked-daapd-songs3.db"
db_path.rmempty = false
directories=s:option(Value, "directories", translate("Music Directorie Path"))
directories.default = "/opt/music"
directories.rmempty = false
readme=s:option(DummyValue,"readme",translate("Readme"))
readme.description=translate("About iOS Remote Pairing: <br />1. Open the web interface <br /> 2. Start iPhone Remote APP, go to Settings, Add Library<br />3. Enter the pair code in the web interface")
return m

View File

@ -0,0 +1,22 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[nas]], [[forked-daapd]], [[run]])%>', null,
function(x, data) {
var tb = document.getElementById('forked-daapd_status');
if (data && tb) {
if (data.running) {
var links = "<em><b><font color=green>Music Remote Center <%:RUNNING%></font></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=button value='<%:Open Web Interface%>' onclick=window.open('http://'+window.location.hostname+':3689') /></em>";
tb.innerHTML = links;
} else {
tb.innerHTML = '<em><b><font color=red>Music Remote Center <%:NOT RUNNING%></font></b></em>';
}
}
}
);
//]]>
</script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<p id="forked-daapd_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

View File

@ -0,0 +1,36 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-23 20:16+0800\n"
"PO-Revision-Date: 2015-06-23 20:17+0800\n"
"Last-Translator: coolsnowwolf <coolsnowwolf@gmail.com>\n"
"Language-Team: PandoraBox Team\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 1.8.1\n"
"X-Poedit-SourceCharset: UTF-8\n"
msgid "Music Remote Center"
msgstr "PCHiFi 数字转盘遥控"
msgid "Open Web Interface"
msgstr "打开 Web 管理界面"
msgid "Music Remote Center is a DAAP (iTunes Remote), MPD (Music Player Daemon) and RSP (Roku) media server."
msgstr "PCHiFi 数字转盘遥控是一个基于 DAAP (iTunes Remote), MPD (Music Player Daemon) 和 RSP (Roku) media server 的服务器端播放器<br />后端输出支持 路由器本机声卡输出 /Airplay/ Chromecast"
msgid "Database File Path"
msgstr "数据库文件路径"
msgid "Music Directorie Path"
msgstr "音频文件文件夹路径"
msgid "Readme"
msgstr "使用须知"
msgid "About iOS Remote Pairing: <br />1. Open the web interface <br /> 2. Start iPhone Remote APP, go to Settings, Add Library<br />3. Enter the pair code in the web interface"
msgstr "关于 iOS 设备匹配: <br />1. 先打开 Web 管理界面,在 Setting 里面找到 Remotes & Outputs <br /> 2. 安装 iTunes 遥控器, 点击 手动连接,获取匹配码<br />3. 在 Remote Pairing 输入刚才获取的匹配码即可"

View File

@ -0,0 +1,7 @@
config forked-daapd
option port '3689'
option directories '/opt/music'
option enabled '0'
option db_path '/opt/songs.db'

View File

@ -0,0 +1,64 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2020 OpenWrt.org
START=99
BIN=/usr/sbin/forked-daapd
PID=/var/run/forked-daapd.pid
SSD=start-stop-daemon
NAME=forked-daapd
uci_get_by_name() {
local ret=$(uci get $NAME.$1.$2 2>/dev/null)
echo ${ret:=$3}
}
uci_get_by_type() {
local ret=$(uci get $NAME.@$1[0].$2 2>/dev/null)
echo ${ret:=$3}
}
gen_config_file() {
cat <<-EOF >/var/etc/forked-daapd.conf
general {
uid = "root"
db_path = "$(uci_get_by_type forked-daapd db_path)"
logfile = "/var/log/forked-daapd.log"
loglevel = log
ipv6 = no
cache_path = "/var/forked-daapd-cache.db"
}
library {
name = "My Music on OpenWrt"
port = $(uci_get_by_type forked-daapd port 3689)
directories = { "$(uci_get_by_type forked-daapd directories)" }
podcasts = { "/Podcasts" }
audiobooks = { "/Audiobooks" }
compilations = { "/Compilations" }
compilation_artist = "Various Artists"
}
audio {
nickname = "Local Audio Output"
type = "alsa"
}
EOF
}
start() {
gen_config_file
local enabled=$(uci_get_by_type forked-daapd enabled 0)
[ "$enabled" == "0" ] && return 1
$SSD -p $PID -S -x $BIN -- -P $PID -c /var/etc/forked-daapd.conf
}
stop() {
$SSD -p $PID -K -s SIGINT >/dev/null
}
restart() {
stop
sleep 3
start
}

View File

@ -0,0 +1,11 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@forked-daapd[-1]
add ucitrack forked-daapd
set ucitrack.@forked-daapd[-1].init=forked-daapd
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0