更新 speakerlib.lua
This commit is contained in:
@@ -62,7 +62,7 @@ end
|
|||||||
|
|
||||||
local function get_total_duration(url)
|
local function get_total_duration(url)
|
||||||
if _G.Playprint then printlog("Calculating duration...") end
|
if _G.Playprint then printlog("Calculating duration...") end
|
||||||
local handle, err = http.get(url)
|
local handle, err = http.get(url,{["Content-Type"] = "application/json"}, true)
|
||||||
if not handle then
|
if not handle then
|
||||||
error(url .. "Could not get duration: " .. (err or "Unknown error"))
|
error(url .. "Could not get duration: " .. (err or "Unknown error"))
|
||||||
end
|
end
|
||||||
@@ -152,21 +152,21 @@ elseif cmd == "play" then
|
|||||||
local mono_httpfile, left_httpfile, right_httpfile
|
local mono_httpfile, left_httpfile, right_httpfile
|
||||||
|
|
||||||
if mono_url and #speakerlist.main > 0 then
|
if mono_url and #speakerlist.main > 0 then
|
||||||
mono_httpfile = http.get(mono_url)
|
mono_httpfile = http.get(mono_url,{["Content-Type"] = "application/json"}, true)
|
||||||
if not mono_httpfile then
|
if not mono_httpfile then
|
||||||
error("Could not open mono audio stream")
|
error("Could not open mono audio stream")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if left_url and #speakerlist.left > 0 then
|
if left_url and #speakerlist.left > 0 then
|
||||||
left_httpfile = http.get(left_url)
|
left_httpfile = http.get(left_url,{["Content-Type"] = "application/json"}, true)
|
||||||
if not left_httpfile then
|
if not left_httpfile then
|
||||||
error("Could not open left audio stream")
|
error("Could not open left audio stream")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if right_url and #speakerlist.right > 0 then
|
if right_url and #speakerlist.right > 0 then
|
||||||
right_httpfile = http.get(right_url)
|
right_httpfile = http.get(right_url,{["Content-Type"] = "application/json"}, true)
|
||||||
if not right_httpfile then
|
if not right_httpfile then
|
||||||
error("Could not open right audio stream")
|
error("Could not open right audio stream")
|
||||||
end
|
end
|
||||||
@@ -211,17 +211,17 @@ elseif cmd == "play" then
|
|||||||
if right_httpfile then right_httpfile.close() end
|
if right_httpfile then right_httpfile.close() end
|
||||||
|
|
||||||
if mono_url and #speakerlist.main > 0 then
|
if mono_url and #speakerlist.main > 0 then
|
||||||
mono_httpfile = http.get(mono_url)
|
mono_httpfile = http.get(mono_url,{["Content-Type"] = "application/json"}, true)
|
||||||
if not mono_httpfile then error("Could not reopen mono stream") end
|
if not mono_httpfile then error("Could not reopen mono stream") end
|
||||||
end
|
end
|
||||||
|
|
||||||
if left_url and #speakerlist.left > 0 then
|
if left_url and #speakerlist.left > 0 then
|
||||||
left_httpfile = http.get(left_url)
|
left_httpfile = http.get(left_url,{["Content-Type"] = "application/json"}, true)
|
||||||
if not left_httpfile then error("Could not reopen left stream") end
|
if not left_httpfile then error("Could not reopen left stream") end
|
||||||
end
|
end
|
||||||
|
|
||||||
if right_url and #speakerlist.right > 0 then
|
if right_url and #speakerlist.right > 0 then
|
||||||
right_httpfile = http.get(right_url)
|
right_httpfile = http.get(right_url,{["Content-Type"] = "application/json"}, true)
|
||||||
if not right_httpfile then error("Could not reopen right stream") end
|
if not right_httpfile then error("Could not reopen right stream") end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user