enhance TTS file handling with additional logging for request and response

This commit is contained in:
2025-06-15 22:19:58 -04:00
parent 36b373ce53
commit f5de4c3a5b

View File

@@ -38,11 +38,12 @@ local function playTTSFile(value)
local ttsRoute = "https://ttsmp3.com/makemp3_new.php"
local fileName = "tts"
local encodedValue = textutils.urlEncode(value)
print("Encoded TTS value: " .. encodedValue)
local body = "msg=" .. encodedValue .. "&lang=Gwyneth&source=ttsmp3"
local headers = {
["Content-Type"] = "application/x-www-form-urlencoded"
}
print("Sending HTTP POST request")
local response = http.request({
url = ttsRoute,
method = "POST",
@@ -60,6 +61,7 @@ local function playTTSFile(value)
return
end
until event == "http_success" and resUrl == url
print("HTTP POST request successful" )
-- Read and parse response
local data = handle.readAll()
print(data)