luci-app-music-remote-center: DAAP remote control music server for iOS/Android

This commit is contained in:
lean 2020-04-06 14:03:52 +08:00 committed by CN_SZTL
parent b0565436b6
commit e0f19a717d
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
8 changed files with 233 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:=1
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,59 @@
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 "AirPlay 2 Receiver"
msgstr "AirPlay 2 音频接收器"
msgid "Respawn"
msgstr "进程守护"
msgid "Apple AirPlay 2 Receiver"
msgstr "Apple AirPlay 2 无损音频接收服务器"
msgid "Apple AirPlay 2 Receiver is a simple AirPlay server implementation"
msgstr "Apple AirPlay 2 是一个强大易用的无损音频服务器( iOS/MacOSX 原生支持)"
msgid "Airport Name"
msgstr "音频接收器名称"
msgid "Password Auth"
msgstr "开启密码认证"
msgid "Interpolation"
msgstr "音频重采样"
msgid "Internal Basic Resampler"
msgstr "内置"
msgid "High quality SoX Resampler"
msgstr "高质量 SoX 采样器需要强力的CPU"
msgid "Alsa Output Device"
msgstr "音频输出设备"
msgid "Alsa Mixer Control Name"
msgstr "硬件音量控制器名称"
msgid "1st Soundcard"
msgstr "第 1 张声卡"
msgid "2nd Soundcard"
msgstr "第 2 张声卡"
msgid "Alsa Output Rate"
msgstr "音频输出采样率"
msgid "Alsa Buffer Length"
msgstr "音频缓冲区长度"

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 = "/opt/forked-daapd-songs3.db"
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 2
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