feat(media server & broadcast): 新增/media接口并修复广播音频处理问题
- 新增/media GET接口,返回可用的媒体路由信息 - 为音频下载成功添加info日志,显示下载字节数 - 修正扬声器调用结果的条件判断逻辑 - 修复HQ扬声器音频提交失败的日志文案
This commit is contained in:
@@ -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');
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user