User:Ciprian.bacioiu
From MiOS
(Difference between revisions)
(Created page with "=== Useful scripts and tools === ==== Luvit server used to receive POST Recordings from HTTP POST enabled sercomm cameras ==== * Download [https://luvit.io/install.html luvit]...") |
(→Luvit server used to receive POST Recordings from HTTP POST enabled sercomm cameras) |
||
Line 1: | Line 1: | ||
=== Useful scripts and tools === | === Useful scripts and tools === | ||
==== Luvit server used to receive POST Recordings from HTTP POST enabled sercomm cameras ==== | ==== Luvit server used to receive POST Recordings from HTTP POST enabled sercomm cameras ==== | ||
+ | ===== Usage ===== | ||
+ | * Run the source from the cmd using luvit. If the file is name server.lua do a | ||
+ | <code>luvit server.lua</code> | ||
+ | * Go into the camera administrator page (usually [http://camera_ip/adm/config_trig.htm /adm/config_trig.htm]) | ||
+ | * Settup a Trigger for HTTP Post | ||
+ | * Go into the HTTP Post configuration page and place your IP address and port that the server is running on | ||
+ | * Generate a trigger event by accessing the [http://camera_ip/adm/http_trigger.cgi camera_ip/adm/http_trigger.cgi]. | ||
+ | * The server will tell you a POST event was received. Wait till <code>FILE saved ------------------ </code> is outputed. | ||
+ | |||
+ | |||
* Download [https://luvit.io/install.html luvit] | * Download [https://luvit.io/install.html luvit] | ||
Latest revision as of 12:43, 21 November 2016
[edit] Useful scripts and tools
[edit] Luvit server used to receive POST Recordings from HTTP POST enabled sercomm cameras
[edit] Usage
- Run the source from the cmd using luvit. If the file is name server.lua do a
luvit server.lua
- Go into the camera administrator page (usually /adm/config_trig.htm)
- Settup a Trigger for HTTP Post
- Go into the HTTP Post configuration page and place your IP address and port that the server is running on
- Generate a trigger event by accessing the camera_ip/adm/http_trigger.cgi.
- The server will tell you a POST event was received. Wait till
FILE saved ------------------
is outputed.
- Download luvit
local http = require("http") local https = require("https") local pathJoin = require('luvi').path.join local fs = require('fs') local function onRequest(req, res) local buffer = {} print(req.socket.options and "https" or "http", req.method, req.url) if req.method == "POST" then req:on('data', function(chunk) table.insert(buffer, chunk) if type(chunk) == "string" then end end) req:on('end', function() print("Saving video file -------------------------") file = io.open("vid-"..os.time()..".avi", "a") for i = 1, #buffer do print("Completion: "..i.."/"..#buffer.."") file:write(""..buffer[i].."") end file:close() print("File saved -------------------------------") end) end end http.createServer(onRequest):listen(8080) print("Server listening at http://localhost:8080/")