From 3f58d03d15c177269cbf87394ed126a604562d01 Mon Sep 17 00:00:00 2001 From: HenryDu8133 <813367384@qq.com> Date: Fri, 31 Jul 2026 20:25:00 +0800 Subject: [PATCH] =?UTF-8?q?feat(media=20server=20&=20broadcast):=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E/media=E6=8E=A5=E5=8F=A3=E5=B9=B6=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=B9=BF=E6=92=AD=E9=9F=B3=E9=A2=91=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增/media GET接口,返回可用的媒体路由信息 - 为音频下载成功添加info日志,显示下载字节数 - 修正扬声器调用结果的条件判断逻辑 - 修复HQ扬声器音频提交失败的日志文案 --- CloudServer/server.js | 12 ++++++++++++ station_broadcast.lua | 7 ++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CloudServer/server.js b/CloudServer/server.js index 0023401..5a19c08 100644 --- a/CloudServer/server.js +++ b/CloudServer/server.js @@ -115,6 +115,18 @@ app.get('/media/temp/:file', (req, res) => { sendBinaryFile(res, path.join(tempBroadcastDir, name)); }); +app.get('/media', (req, res) => { + res.json({ + success: true, + message: 'Use a concrete media path', + routes: [ + '/media/audio/general/:file', + '/media/audio/station/:file', + '/media/temp/:file' + ] + }); +}); + app.use(express.static(path.join(__dirname, 'public'))); app.set('view engine', 'ejs'); diff --git a/station_broadcast.lua b/station_broadcast.lua index b217250..c159c1b 100644 --- a/station_broadcast.lua +++ b/station_broadcast.lua @@ -708,6 +708,7 @@ local function playHqAudioItem(item) Utils.log("ERROR", "Failed to download stream audio: " .. tostring(err)) return end + Utils.log("INFO", "Downloaded stream audio: " .. tostring(#bytes) .. " bytes") payload = bytes if ext == "wav" then format = "wav" elseif ext == "mp3" then format = "mp3" @@ -730,7 +731,7 @@ local function playHqAudioItem(item) return controller.speakFileAll(payload, CONFIG.AUDIO_VOLUME) end end) - if ok and result ~= false then + if ok and result then called = true end end @@ -748,14 +749,14 @@ local function playHqAudioItem(item) return sp.speakFile(payload, CONFIG.AUDIO_VOLUME) end end) - if ok and result ~= false then + if ok and result then called = true end end end if not called then - Utils.log("ERROR", "HQ speaker API not available for format " .. format) + Utils.log("ERROR", "HQ speaker did not accept audio for format " .. format) return end