From 115fe1033e4f2fae6e12e73e9305d8124d551b51 Mon Sep 17 00:00:00 2001 From: HKXluo Date: Sun, 13 Apr 2025 15:02:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8D=A2=E8=A1=8C=E7=AC=A6?= =?UTF-8?q?=EF=BC=8C=E8=AE=A9=E6=98=BE=E7=A4=BA=E6=9B=B4=E7=9B=B4=E8=A7=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Demo/FFmpegApi-Demo/demo1.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Demo/FFmpegApi-Demo/demo1.lua b/Demo/FFmpegApi-Demo/demo1.lua index 502756a..ab041d7 100644 --- a/Demo/FFmpegApi-Demo/demo1.lua +++ b/Demo/FFmpegApi-Demo/demo1.lua @@ -23,7 +23,7 @@ local function convertAndPlay() -- ===== 3. 错误处理 / Error handling ===== -- 网络错误 / Network error if not response then - printError("HTTP request failed: " .. (err or "unknown error")) + printError("\nHTTP request failed: " .. (err or "unknown error")) return end @@ -34,27 +34,27 @@ local function convertAndPlay() -- HTTP状态码检查 / HTTP status check local statusCode = response.getResponseCode() if statusCode ~= 200 then - printError("API error (status "..statusCode..")") + printError("\nAPI error (status "..statusCode..")") return end -- ===== 4. 解析JSON / Parse JSON ===== local responseData = textutils.unserializeJSON(responseBody) if not responseData then - printError("Invalid API response (bad JSON)") + printError("\nInvalid API response (bad JSON)") return end -- API业务错误 / API logic error if responseData.status ~= "success" then - printError("Conversion failed: "..(responseData.error or "no error info")) + printError("\nConversion failed: "..(responseData.error or "no error info")) return end -- ===== 5. 播放音频 / Play audio ===== - print("Conversion successful! Download URL:") + print("\nConversion successful! Download URL:") print(responseData.download_url) - print("Playing...") + print("\nPlaying...") shell.run("speaker play "..responseData.download_url) end