Ajout d'une commande pour faire des capture avec une seconde caméra
This commit is contained in:
parent
7fe522f1c0
commit
d5f7add8e3
27
index.js
27
index.js
@ -5,7 +5,8 @@ const port = 80;
|
|||||||
const http = require("http");
|
const http = require("http");
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
const SNAPSHOT_URL = "http://192.168.1.68/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=wuuPhkmUCeI9WG7C&user=admin&password=WX12cv06,"
|
const SNAPSHOT_SALON_URL = "http://192.168.1.68/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=wuuPhkmUCeI9WG7C&user=admin&password=WX12cv06,"
|
||||||
|
const SNAPSHOT_GARAGE_URL = "http://192.168.1.69/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=wuuPhkmUCeI9WG7C&user=admin&password=WX12cv06,"
|
||||||
|
|
||||||
function snapshotPath(){
|
function snapshotPath(){
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
@ -28,22 +29,38 @@ function snapshotPath(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function snapshot() {
|
function snapshotSalon() {
|
||||||
http.get(SNAPSHOT_URL, (res) => {
|
http.get(SNAPSHOT_SALON_URL, (res) => {
|
||||||
|
res.pipe(fs.createWriteStream(snapshotPath()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function snapshotGarage() {
|
||||||
|
http.get(SNAPSHOT_GARAGE_URL, (res) => {
|
||||||
res.pipe(fs.createWriteStream(snapshotPath()));
|
res.pipe(fs.createWriteStream(snapshotPath()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
app.get('/snapshot', (req, res) => {
|
app.get('/snapshot', (req, res) => {
|
||||||
try{
|
try{
|
||||||
snapshot();
|
snapshotSalon();
|
||||||
res.send('ok');
|
res.send('ok');
|
||||||
} catch(e)
|
} catch(e)
|
||||||
{
|
{
|
||||||
res.status(500).send(e);
|
res.status(500).send(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.get('/snapshotGarage', (req, res) => {
|
||||||
|
try{
|
||||||
|
snapshotGarage();
|
||||||
|
res.send('ok');
|
||||||
|
} catch(e)
|
||||||
|
{
|
||||||
|
res.status(500).send(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
app.get('/', (req, res) => {
|
app.get('/', (req, res) => {
|
||||||
res.send('Hello World!');
|
res.send('Hello World!');
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user