Claude Multicam (a)
This commit is contained in:
@@ -12,12 +12,20 @@ const { readJpegWidth } = require('./cameraSwitch');
|
||||
// GET /api/snapshot/cam0/hires → HD-JPEG (1280): Schalter pausiert Live kurz
|
||||
// GET /api/stream/cam0 → MJPEG multipart/x-mixed-replace (Live)
|
||||
|
||||
function createSnapshotRouter(switches) {
|
||||
function createSnapshotRouter(switches, cameras) {
|
||||
const router = express.Router();
|
||||
|
||||
// cameras = camsMeta aus server.js: [{id, name, position, stream, hires, note}]
|
||||
router.get('/', (_req, res) => {
|
||||
res.json({
|
||||
cameras: Object.keys(switches).map((id) => ({ id, url: `/api/snapshot/${id}` })),
|
||||
cameras: cameras.map((c) => ({
|
||||
id: c.id,
|
||||
name: c.name,
|
||||
position: c.position,
|
||||
stream: c.stream,
|
||||
hires: c.hires,
|
||||
url: `/api/snapshot/${c.id}`,
|
||||
})),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -118,4 +126,15 @@ function createStreamRouter(switches) {
|
||||
return router;
|
||||
}
|
||||
|
||||
module.exports = { createSnapshotRouter, createStreamRouter };
|
||||
// GET /api/cameras → vollständige Kamera-Metadaten (ohne device-Pfad)
|
||||
function createCamerasRouter(cameras) {
|
||||
const router = express.Router();
|
||||
router.get('/', (_req, res) => {
|
||||
res.json({
|
||||
cameras: cameras.map(({ device: _d, ...rest }) => rest),
|
||||
});
|
||||
});
|
||||
return router;
|
||||
}
|
||||
|
||||
module.exports = { createSnapshotRouter, createStreamRouter, createCamerasRouter };
|
||||
|
||||
Reference in New Issue
Block a user