mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-11-28 21:18:11 -05:00
json-based config for cameras and streams
for #155 The config interface code for changing cameras is quite messy but seems to work for now.
This commit is contained in:
@@ -63,7 +63,7 @@ impl<C: Clocks + Clone> TestDb<C> {
|
||||
Self::new_with_flush_if_sec(clocks, 0)
|
||||
}
|
||||
|
||||
pub(crate) fn new_with_flush_if_sec(clocks: C, flush_if_sec: i64) -> Self {
|
||||
pub(crate) fn new_with_flush_if_sec(clocks: C, flush_if_sec: u32) -> Self {
|
||||
let tmpdir = tempfile::Builder::new()
|
||||
.prefix("moonfire-nvr-test")
|
||||
.tempdir()
|
||||
@@ -82,18 +82,23 @@ impl<C: Clocks + Clone> TestDb<C> {
|
||||
TEST_CAMERA_ID,
|
||||
l.add_camera(db::CameraChange {
|
||||
short_name: "test camera".to_owned(),
|
||||
description: "".to_owned(),
|
||||
onvif_host: "test-camera".to_owned(),
|
||||
username: Some("foo".to_owned()),
|
||||
password: Some("bar".to_owned()),
|
||||
config: crate::json::CameraConfig::default(),
|
||||
//description: "".to_owned(),
|
||||
//onvif_host: "test-camera".to_owned(),
|
||||
//username: Some("foo".to_owned()),
|
||||
//password: Some("bar".to_owned()),
|
||||
streams: [
|
||||
db::StreamChange {
|
||||
sample_file_dir_id: Some(sample_file_dir_id),
|
||||
rtsp_url: Some(url::Url::parse("rtsp://test-camera/main").unwrap()),
|
||||
record: true,
|
||||
flush_if_sec,
|
||||
config: crate::json::StreamConfig {
|
||||
url: Some(url::Url::parse("rtsp://test-camera/main").unwrap()),
|
||||
mode: crate::json::STREAM_MODE_RECORD.to_owned(),
|
||||
flush_if_sec,
|
||||
..Default::default()
|
||||
},
|
||||
},
|
||||
Default::default(),
|
||||
Default::default(),
|
||||
],
|
||||
})
|
||||
.unwrap()
|
||||
|
||||
Reference in New Issue
Block a user