mirror of
https://github.com/BetterCorp/BetterFrame.git
synced 2026-05-26 19:06:34 +00:00
revert(bundle): restore type==='rtsp' gate on stream fallback
ONVIF cams legitimately have multiple streams (main+sub) stored in camera_streams. Dropping the type gate synthesized a single "main" row for ONVIF cams that lacked rows, hiding the multi-stream design the kiosk's pick_stream relies on (area >= 0.2 → main, else sub). The "(no stream)" symptom is a partial-import bug to chase separately; the bundle fallback is for single-URL RTSP cams only. Also drop the backfill migration that did the same insert at the DB layer.
This commit is contained in:
parent
281c0adf44
commit
28ff450d35
2 changed files with 1 additions and 15 deletions
|
|
@ -867,18 +867,4 @@ export const MIGRATIONS: readonly MigrationEntry[] = [
|
||||||
addColumnIfNotExists(db, "displays", "actual_power_state_at", "TEXT");
|
addColumnIfNotExists(db, "displays", "actual_power_state_at", "TEXT");
|
||||||
},
|
},
|
||||||
|
|
||||||
// Backfill any camera type with a direct RTSP URL. Earlier backfill only
|
|
||||||
// covered type=rtsp, but ONVIF imports can also retain rtsp_url.
|
|
||||||
(db: DatabaseSync) => {
|
|
||||||
db.exec(`
|
|
||||||
INSERT INTO camera_streams (camera_id, role, name, rtsp_uri, is_discovered)
|
|
||||||
SELECT c.id, 'main', 'Main', c.rtsp_url, 0
|
|
||||||
FROM cameras c
|
|
||||||
WHERE c.rtsp_url IS NOT NULL
|
|
||||||
AND c.rtsp_url != ''
|
|
||||||
AND NOT EXISTS (
|
|
||||||
SELECT 1 FROM camera_streams s WHERE s.camera_id = c.id
|
|
||||||
)
|
|
||||||
`);
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ export function generateBundle(
|
||||||
const bundleCameras: BundleCamera[] = cameras.map((cam) => {
|
const bundleCameras: BundleCamera[] = cameras.map((cam) => {
|
||||||
const streams = repo.listCameraStreams(cam.id);
|
const streams = repo.listCameraStreams(cam.id);
|
||||||
const effectiveStreams = streams.length > 0 ? streams : (
|
const effectiveStreams = streams.length > 0 ? streams : (
|
||||||
cam.rtsp_url
|
cam.type === "rtsp" && cam.rtsp_url
|
||||||
? [{
|
? [{
|
||||||
id: 0,
|
id: 0,
|
||||||
role: "main" as const,
|
role: "main" as const,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue