enhance TTS file handling with additional logging for request and response
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user