🎈 Sync 2026-10-01 00:56:18

This commit is contained in:
github-actions[bot] committed 2026-10-01 00:56:18 +08:00
1 parent 371aec8f83
commit fa5e40404d
3 files changed
+46 -12

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@ LUCI_DEPENDS:=+mpd-full +mpc +upmpdcli +alsa-utils \
PKG_NAME:=luci-app-dlna-player
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_MAINTAINER:=sakura-builder1 <sakura-builder1@users.noreply.github.com>
PKG_LICENSE:=GPL-3.0
@@ -127,7 +127,11 @@ return view.extend({
'.dlna-player-line { display:flex; align-items:center; gap:.75rem; flex-wrap:wrap; margin-bottom:.5rem; padding-left:1rem; }',
'.dlna-player-line > label { flex:0 0 8.5rem; max-width:8.5rem; text-align:left; }',
/* 列表也留出同样的左边距,视觉更整齐 */
'.dlna-player-row .dlna-player-list { margin-left:1rem; }'
'.dlna-player-row .dlna-player-list { margin-left:1rem; border:1px solid rgba(128,128,128,.35); border-radius:.3rem; }',
'.dlna-player-list .dlna-player-item { border-radius:.2rem; }',
'.dlna-player-list .dlna-player-item.is-playing { background:rgba(120,180,120,.35); }',
'.dlna-player-list .dlna-player-empty { padding:.8rem; text-align:center; opacity:.65; }',
'.dlna-player-count { margin-top:.2rem; font-size:.9em; opacity:.7; }'
]));
}
@@ -207,7 +211,7 @@ return view.extend({
fileRows.forEach(function (item) {
var on = (item.name === cur);
item.el.style.background = on ? '#e8f5e9' : '';
item.el.classList.toggle('is-playing', on);
item.el.style.fontWeight = on ? 'bold' : '';
});
});
@@ -258,13 +262,14 @@ return view.extend({
fileRows = [];
listFrame.innerHTML = '';
if (!fl.length) {
listFrame.appendChild(E('div', { 'style': 'padding:.8rem;color:#888;text-align:center' }, [
listFrame.appendChild(E('div', { 'class': 'dlna-player-empty' }, [
_('No matching music.')
]));
} else {
fl.forEach(function (f) {
var row = E('div', {
'style': 'display:flex;align-items:center;gap:.5rem;padding:.3rem .4rem;border-radius:.2rem'
'class': 'dlna-player-item',
'style': 'display:flex;align-items:center;gap:.5rem;padding:.3rem .4rem'
}, [
pbtn(_('Play'), 'action', function () { return playFile(f); }),
E('span', { 'class': 'dlna-player-name' }, [ f ]),
@@ -281,7 +286,7 @@ return view.extend({
fileRows.forEach(function (item) {
var on = (item.name === curFile);
item.el.style.background = on ? '#e8f5e9' : '';
item.el.classList.toggle('is-playing', on);
item.el.style.fontWeight = on ? 'bold' : '';
});
}
@@ -370,7 +375,7 @@ return view.extend({
'placeholder': _('type to filter...'),
'style': 'width:100%;max-width:22rem'
}, []),
E('div', { 'style': 'margin-top:.2rem;color:#666;font-size:.9em' }, [
E('div', { 'class': 'dlna-player-count' }, [
listCount = E('span', {}, [ '' ])
])
])
@@ -379,8 +384,7 @@ return view.extend({
/* 列表:只滚动,不翻页 */
listFrame = E('div', {
'class': 'dlna-player-list',
'style': 'border:1px solid #ccc;border-radius:.3rem;' +
'max-height:20rem;overflow-y:auto;overflow-x:hidden;background:#fff'
'style': 'max-height:20rem;overflow-y:auto;overflow-x:hidden'
}, [])
]);
@@ -19,21 +19,51 @@ refresh_web_cache() {
rm -f /tmp/luci-indexcache* 2>/dev/null
}
# ---------- 检测 HDMI 是否接了显示器/电视 ----------
hdmi_connected() {
local f
for f in /sys/class/drm/*/status; do
[ -f "$f" ] || continue
case "$f" in
*HDMI*|*DP*)
[ "$(cat "$f" 2>/dev/null)" = "connected" ] && return 0
;;
esac
done
return 1
}
# ---------- 自动探测声卡 ----------
detect_device() {
local dev
# 1) 优先选名字里带 Analog 的(板载模拟输出)
# 1) HDMI 已接显示设备 -> 优先 HDMI(电视/功放/显示器音响 ✓)
if hdmi_connected; then
dev=$(aplay -l 2>/dev/null \
| grep -i 'hdmi' \
| head -n1 \
| sed -n 's/^card \([0-9]*\): .*device \([0-9]*\):.*/hw:\1,\2/p')
[ -n "$dev" ] && { echo "$dev"; return 0; }
fi
# 2) 板载模拟输出
dev=$(aplay -l 2>/dev/null \
| grep -i 'analog' \
| head -n1 \
| sed -n 's/^card \([0-9]*\): .*device \([0-9]*\):.*/hw:\1,\2/p')
[ -n "$dev" ] && { echo "$dev"; return 0; }
# 2) 退而求其次:排除 Dummy / pcsp / HDMI,取第一个可播放设备
# 3) 有 HDMI 就退而用 HDMI(哪怕没检测到显示器 ✓)
dev=$(aplay -l 2>/dev/null \
| grep -i 'hdmi' \
| head -n1 \
| sed -n 's/^card \([0-9]*\): .*device \([0-9]*\):.*/hw:\1,\2/p')
[ -n "$dev" ] && { echo "$dev"; return 0; }
# 4) 兜底:排除 Dummy / pcsp / 数字回声设备
dev=$(aplay -l 2>/dev/null \
| grep '^card ' \
| grep -viE 'dummy|pcsp|hdmi|iec958' \
| grep -viE 'dummy|pcsp|iec958' \
| head -n1 \
| sed -n 's/^card \([0-9]*\): .*device \([0-9]*\):.*/hw:\1,\2/p')
[ -n "$dev" ] && { echo "$dev"; return 0; }