Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- by MKlegoman357
- if _G.term.record then
- printError("Recorder is already recording, exit the program (shell) to stop recording.")
- return
- end
- local whitelist = {
- ["write"] = "a";
- ["setCursorPos"] = "b";
- ["setCursorBlink"] = "c";
- ["setTextColor"] = "d";
- ["setBackgroundColor"] = "e";
- ["setTextColour"] = "f";
- ["setBackgroundColour"] = "g";
- ["clear"] = "h";
- ["clearLine"] = "i";
- ["scroll"] = "j";
- }
- local program = {...}
- program[1] = program[1] or "rom/programs/advanced/multishell"
- local clock = os.clock
- local prevTerm = term.current()
- local actions = ""
- local termObject = {}
- for name, func in pairs(term.native()) do
- termObject[name] = function (...)
- if whitelist[name] then
- actions = actions .. whitelist[name] .. "|" .. clock() .. "|"
- for i, v in pairs({...}) do
- actions = actions .. textutils.serialize(v) .. "|"
- end
- actions = actions .. "\n"
- end
- return prevTerm[name](...)
- end
- end
- _G.term.record = true
- term.redirect(termObject)
- shell.run(unpack(program))
- term.redirect(prevTerm)
- _G.term.record = nil
- local key = "0ec2eb25b6166c0c27a394ae118ad829" -- Extracted from 'pastebin' program
- -- Taken from 'pastebin' program
- local response = http.post(
- "http://pastebin.com/api/api_post.php",
- "api_option=paste&"..
- "api_dev_key="..key.."&"..
- "api_paste_format=lua&"..
- "api_paste_name=Screenrecord&"..
- "api_paste_code="..textutils.urlEncode(actions)
- )
- if response then
- print("Success.")
- local sResponse = response.readAll()
- response.close()
- local sCode = string.match(sResponse, "[^/]+$")
- print("Uploaded as "..sResponse)
- else
- _G.term.recording = actions
- print("Failed to upload the video.")
- print("The video was saved in _G.term.recording (a string).")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement