🐶 Sync 2025-11-02 14:26:26

This commit is contained in:
actions-user
2025-11-02 14:26:26 +08:00
parent 64bcc56c2a
commit ac011db799
1557 changed files with 746465 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
# Copyright (C) 2016 Openwrt.org
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-airplay2
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
LUCI_TITLE:=Luci for Apple Airplay2 Receiver
LUCI_DEPENDS:=+alsa-utils +airplay2-openssl
LUCI_PKGARCH:=all
PKG_MAINTAINER:=sbwml <admin@cooluc.com>
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@@ -0,0 +1,142 @@
'use strict';
'require form';
'require poll';
'require rpc';
'require uci';
'require view';
var callServiceList = rpc.declare({
object: 'service',
method: 'list',
params: ['name'],
expect: { '': {} }
});
var callExec = rpc.declare({
object: 'file',
method: 'exec',
params: ['command', 'params'],
expect: {}
});
function getServiceStatus() {
return L.resolveDefault(callServiceList('airplay2'), {}).then(function (res) {
var isRunning = false;
try {
isRunning = res['airplay2']['instances']['instance1']['running'];
} catch (e) { }
return isRunning;
});
}
function renderStatus(isRunning) {
var spanTemp = '<em><span style="color:%s"><strong>%s %s</strong></span></em>';
var renderHTML;
if (isRunning) {
renderHTML = spanTemp.format('green', 'Airplay2', _('RUNNING'));
} else {
renderHTML = spanTemp.format('red', 'Airplay2', _('NOT RUNNING'));
}
return renderHTML;
}
function getSoundCards() {
return callExec('/bin/cat', ['/proc/asound/cards']).then(function (res) {
var content = res && typeof res.stdout === 'string' ? res.stdout : '';
var cards = [];
if (content) {
var lines = content.split('\n');
lines.forEach(function (line) {
var match = line.match(/^\s*(\d+)\s+\[[^\]]+\]:\s*(.+)$/);
if (match) {
cards.push({
id: match[1],
desc: match[2]
});
}
});
}
return cards;
}).catch(function (e) {
return [];
});
}
return view.extend({
render: function () {
return getSoundCards().then(function (cards) {
var m = new form.Map('airplay2', _('Airplay 2'),
_('AirPlay 2 is a simple and easy-to-use AirPlay audio player.'));
var s = m.section(form.TypedSection);
s.anonymous = true;
s.render = function () {
poll.add(function () {
return L.resolveDefault(getServiceStatus()).then(function (res) {
var view = document.getElementById('service_status');
view.innerHTML = renderStatus(res);
});
});
return E('div', { class: 'cbi-section', id: 'status_bar' }, [
E('p', { id: 'service_status' }, _('Collecting data...'))
]);
};
s = m.section(form.NamedSection, '@airplay2[0]', 'airplay2');
s.anonymous = true;
var o;
o = s.option(form.Flag, 'enabled', _('Enabled'));
o.rmempty = false;
o = s.option(form.Value, 'name', _('Airplay Name'));
o.rmempty = false;
o = s.option(form.ListValue, 'interpolation', _('Interpolation'));
o.default = 'basic';
o.value('basic', _('Internal Basic Resampler'));
o.value('soxr', _('High quality SoX Resampler'));
o = s.option(form.Value, 'port', _('Port'));
o.default = '5050';
o.datatype = 'port';
var soundcardOpt = s.option(form.ListValue, 'alsa_output_device', _('Alsa Output Device'));
soundcardOpt.default = '';
soundcardOpt.value('', _('default'));
if (Array.isArray(cards)) {
cards.forEach(function (card) {
soundcardOpt.value('hw:' + card.id, card.desc + ' (hw:' + card.id + ')');
});
}
o = s.option(form.ListValue, 'alsa_mixer_control_name', _('Alsa Mixer Control Name'));
o.default = '';
o.value('', _('default (software volume)'));
o.value('PCM', _('PCM'));
o.value('Speaker', _('Speaker'));
o = s.option(form.ListValue, 'alsa_output_rate', _('Alsa Output Rate'));
o.default = 'auto';
o.value('auto', _('auto'));
o.value('44100', _('44.1kHz'));
o.value('88200', _('88.2kHz'));
o.value('176400', _('176.4kHz'));
o.value('352800', _('352.8kHz'));
o = s.option(form.Value, 'alsa_buffer_length', _('Alsa Buffer Length'));
o.default = '6615';
o = s.option(form.Value, 'sesctl_session_timeout', _('Session timeout'));
o.default = '120';
o = s.option(form.ListValue, 'sesctl_session_interruption', _('Allow session interruption'));
o.default = 'no';
o.value('no', _('Not allow'));
o.value('yes', _('Allow'));
return m.render();
});
}
});

1
luci-app-airplay2/po/zh-cn Symbolic link
View File

@@ -0,0 +1 @@
zh_Hans

View File

@@ -0,0 +1,69 @@
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"
msgid "AirPlay 2"
msgstr ""
msgid "AirPlay 2 is a simple and easy-to-use AirPlay audio player."
msgstr "AirPlay 2 是一款简单易用的 AirPlay 音频播放器。"
msgid "Enabled"
msgstr "启用"
msgid "Airplay Name"
msgstr "Airplay 名称"
msgid "Interpolation"
msgstr "音频重采样"
msgid "Internal Basic Resampler"
msgstr "内置"
msgid "High quality SoX Resampler"
msgstr "高质量 SoX 采样器"
msgid "Alsa Output Device"
msgstr "音频输出设备"
msgid "Alsa Mixer Control Name"
msgstr "硬件音量控制器名称"
msgid "default (software volume)"
msgstr "缺省(使用软件音量调整)"
msgid "1st Soundcard (hw:0)"
msgstr "第 1 张声卡 (hw:0)"
msgid "2nd Soundcard (hw:1)"
msgstr "第 2 张声卡 (hw:1)"
msgid "3rd Soundcard (hw:2)"
msgstr "第 3 张声卡 (hw:2)"
msgid "1st Soundcard 4th device (hw:0,3)"
msgstr "第 1 张声卡的第 4 设备(hw:0,3)"
msgid "Alsa Output Rate"
msgstr "音频输出采样率"
msgid "Alsa Buffer Length"
msgstr "音频缓冲区长度"
msgid "Session timeout"
msgstr "会话超时"
msgid "Allow session interruption"
msgstr "允许会话中断"
msgid "Not allow"
msgstr "不允许"
msgid "Allow"
msgstr "允许"

View File

@@ -0,0 +1,13 @@
#!/bin/sh
[ -f "/etc/config/ucitrack" ] && {
uci -q batch <<-EOF >/dev/null
delete ucitrack.@airplay2[-1]
add ucitrack airplay2
set ucitrack.@airplay2[-1].init=airplay2
commit ucitrack
EOF
}
rm -rf /tmp/luci-indexcache*
exit 0

View File

@@ -0,0 +1,13 @@
{
"admin/services/airplay2": {
"title": "Airplay 2",
"action": {
"type": "view",
"path": "airplay2"
},
"depends": {
"acl": [ "luci-app-airplay2" ],
"uci": { "airplay2": true }
}
}
}

View File

@@ -0,0 +1,18 @@
{
"luci-app-airplay2": {
"description": "Grant UCI access for luci-app-airplay2",
"read": {
"file": {
"/bin/cat": [ "exec" ],
"/proc/asound/cards": [ "read" ]
},
"ubus": {
"service": [ "list" ]
},
"uci": [ "airplay2" ]
},
"write": {
"uci": [ "airplay2" ]
}
}
}

View File

@@ -0,0 +1,4 @@
{
"config": "airplay2",
"init": "airplay2"
}