feat(media server & broadcast): 新增/media接口并修复广播音频处理问题

- 新增/media GET接口,返回可用的媒体路由信息
- 为音频下载成功添加info日志,显示下载字节数
- 修正扬声器调用结果的条件判断逻辑
- 修复HQ扬声器音频提交失败的日志文案
This commit is contained in:
2026-07-31 20:25:00 +08:00
parent 3bcc04332a
commit 3f58d03d15
2 changed files with 16 additions and 3 deletions
+12
View File
@@ -115,6 +115,18 @@ app.get('/media/temp/:file', (req, res) => {
sendBinaryFile(res, path.join(tempBroadcastDir, name)); 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.use(express.static(path.join(__dirname, 'public')));
app.set('view engine', 'ejs'); app.set('view engine', 'ejs');
+4 -3
View File
@@ -708,6 +708,7 @@ local function playHqAudioItem(item)
Utils.log("ERROR", "Failed to download stream audio: " .. tostring(err)) Utils.log("ERROR", "Failed to download stream audio: " .. tostring(err))
return return
end end
Utils.log("INFO", "Downloaded stream audio: " .. tostring(#bytes) .. " bytes")
payload = bytes payload = bytes
if ext == "wav" then format = "wav" if ext == "wav" then format = "wav"
elseif ext == "mp3" then format = "mp3" elseif ext == "mp3" then format = "mp3"
@@ -730,7 +731,7 @@ local function playHqAudioItem(item)
return controller.speakFileAll(payload, CONFIG.AUDIO_VOLUME) return controller.speakFileAll(payload, CONFIG.AUDIO_VOLUME)
end end
end) end)
if ok and result ~= false then if ok and result then
called = true called = true
end end
end end
@@ -748,14 +749,14 @@ local function playHqAudioItem(item)
return sp.speakFile(payload, CONFIG.AUDIO_VOLUME) return sp.speakFile(payload, CONFIG.AUDIO_VOLUME)
end end
end) end)
if ok and result ~= false then if ok and result then
called = true called = true
end end
end end
end end
if not called then 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 return
end end