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