修改speakerlib的创建方式

This commit is contained in:
nnwang
2026-02-22 05:20:35 +08:00
parent 13ec00766e
commit 50a74935f1

View File

@@ -74,7 +74,8 @@ print("task_id: " .. task_id)
-- 用于记录已打印的日志数量,避免重复打印 -- 用于记录已打印的日志数量,避免重复打印
local total_logs_printed = 0 local total_logs_printed = 0
speakerrun = true local speakerrun = true
while true do while true do
@@ -106,9 +107,17 @@ while true do
total_logs_printed = total_logs_printed + #task_info.new_logs total_logs_printed = total_logs_printed + #task_info.new_logs
end end
local main_audio_url = server_url .. task_info.result.audio_urls.audio_dfpwm_url
local left_audio_url = server_url .. task_info.result.audio_urls.audio_dfpwm_left_url
local right_audio_url = server_url .. task_info.result.audio_urls.audio_dfpwm_right_url
if task_info.result.audio_urls and speakerrun then if task_info.result.audio_urls and speakerrun then
speakerrun = false speakerrun = false
shell.run("bg speakerlib play ".. server_url .. task_info.result.audio_urls.audio_dfpwm_url .." ".. server_url .. task_info.result.audio_urls.audio_dfpwm_left_url .." ".. server_url .. task_info.result.audio_urls.audio_dfpwm_right_url) local new_tab_id = shell.openTab(mypath.."/speakerlib","play",main_audio_url,left_audio_url,right_audio_url)
local tab_id = multishell.getCurrent()
-- 切换一次进程,让其可以自然关闭
multishell.setFocus(new_tab_id)
multishell.setFocus(tab_id)
end end
-- 检查是否完成 -- 检查是否完成
@@ -132,18 +141,11 @@ videoInfo.fps = 20
videoInfo.frame_urls = {} videoInfo.frame_urls = {}
-- /frames/20116713/frame_000001.png
for i = 1, videoInfo.total_frames - 10 do for i = 1, videoInfo.total_frames - 10 do
videoInfo.frame_urls[i] = "/frames/"..task_id.."/frame_" .. string.format("%06d", i) .. ".png" videoInfo.frame_urls[i] = "/frames/"..task_id.."/frame_" .. string.format("%06d", i) .. ".png"
end end
-- 播放音频 单通道
--shell.run("bg speaker play", server_url .. videoInfo.audio_dfpwm_url)
-- server_url .. videoInfo.audio_urls.audio_dfpwm_url -- 音频单通道文件 URL
-- server_url .. videoInfo.audio_urls.audio_dfpwm_right_url -- 音频右通道文件 URL
-- server_url .. videoInfo.audio_urls.audio_dfpwm_left_url -- 音频左通道文件 URL
-- 下载和播放函数 -- 下载和播放函数
frames = {} frames = {}
local frameCount = 0 local frameCount = 0