updated
This commit is contained in:
19
main.lua
19
main.lua
@@ -100,6 +100,7 @@ local function runSafe()
|
||||
|
||||
startup();
|
||||
monitor.clear();
|
||||
monitor.setBackgroundColor(colors.black)
|
||||
-- local names = peripheral.getNames()
|
||||
-- for index, value in ipairs(names) do
|
||||
-- print(index, value)
|
||||
@@ -109,15 +110,15 @@ local function runSafe()
|
||||
end
|
||||
|
||||
local function run()
|
||||
runSafe()
|
||||
-- local success, err = pcall(runSafe)
|
||||
-- if not success then
|
||||
-- monitor.setTextColor(colors.red)
|
||||
-- monitor.write("Error: " .. err)
|
||||
-- isErrorState = true
|
||||
-- modem.open(500)
|
||||
-- modem.transmit(500, 500, "Error: " .. err)
|
||||
-- end
|
||||
local success, err = pcall(runSafe)
|
||||
if not success then
|
||||
monitor.setTextColor(colors.red)
|
||||
monitor.write("Error: " .. err)
|
||||
isErrorState = true
|
||||
modem.open(500)
|
||||
modem.transmit(500, 500, "Error: " .. err)
|
||||
os.reboot()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -49,44 +49,6 @@ local function playTTSFile(speakers, value)
|
||||
os.pullEvent("speaker_audio_empty")
|
||||
end
|
||||
end
|
||||
-- local ttsRoute = "https://ttsmp3.com/makemp3_new.php"
|
||||
-- local fileName = "tts.dfpwm"
|
||||
-- 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.post({
|
||||
-- url = ttsRoute,
|
||||
-- method = "POST",
|
||||
-- body = body,
|
||||
-- headers = headers,
|
||||
-- binary = false
|
||||
-- })
|
||||
|
||||
-- print("HTTP POST request successful" )
|
||||
-- local data = response.readAll()
|
||||
-- response.close()
|
||||
|
||||
-- local responseData = textutils.unserialiseJSON(data, { parse_null = true })
|
||||
-- local soundRequest = http.get({
|
||||
-- url = responseData.URL,
|
||||
-- binary = true
|
||||
-- })
|
||||
|
||||
-- local soundData = soundRequest.readAll()
|
||||
-- soundRequest.close()
|
||||
|
||||
-- local encodedData = encoder.encode(soundData)
|
||||
|
||||
-- local file = fs.open(fileName, "w")
|
||||
-- file.write(encodedData)
|
||||
-- file.close()
|
||||
|
||||
-- playSound(speakers, fileName)
|
||||
end
|
||||
|
||||
local function createSoundFile(fileName)
|
||||
|
||||
Reference in New Issue
Block a user