mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-12-04 06:35:58 -05:00
track "assumed" filesystem usage (#89)
As described in #89, we need to refactor a bit before we can get the actual filesystem block size. Assuming 4096 for now. Small steps.
This commit is contained in:
@@ -326,8 +326,8 @@ fn edit_camera_dialog(db: &Arc<db::Database>, siv: &mut Cursive, item: &Option<i
|
||||
let u = if s.retain_bytes == 0 {
|
||||
"0 / 0 (0.0%)".to_owned()
|
||||
} else {
|
||||
format!("{} / {} ({:.1}%)", s.sample_file_bytes, s.retain_bytes,
|
||||
100. * s.sample_file_bytes as f32 / s.retain_bytes as f32)
|
||||
format!("{} / {} ({:.1}%)", s.fs_bytes, s.retain_bytes,
|
||||
100. * s.fs_bytes as f32 / s.retain_bytes as f32)
|
||||
};
|
||||
dialog.call_on_name(&format!("{}_rtsp_url", t.as_str()),
|
||||
|v: &mut views::EditView| v.set_content(s.rtsp_url.to_owned()));
|
||||
|
||||
@@ -290,11 +290,11 @@ fn edit_dir_dialog(db: &Arc<db::Database>, siv: &mut Cursive, dir_id: i32) {
|
||||
}
|
||||
streams.insert(id, Stream {
|
||||
label: format!("{}: {}: {}", id, c.short_name, s.type_.as_str()),
|
||||
used: s.sample_file_bytes,
|
||||
used: s.fs_bytes,
|
||||
record: s.record,
|
||||
retain: Some(s.retain_bytes),
|
||||
});
|
||||
total_used += s.sample_file_bytes;
|
||||
total_used += s.fs_bytes;
|
||||
total_retain += s.retain_bytes;
|
||||
}
|
||||
if streams.is_empty() {
|
||||
|
||||
@@ -106,6 +106,7 @@ pub struct Stream<'a> {
|
||||
pub max_end_time_90k: Option<i64>,
|
||||
pub total_duration_90k: i64,
|
||||
pub total_sample_file_bytes: i64,
|
||||
pub fs_bytes: i64,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(serialize_with = "Stream::serialize_days")]
|
||||
@@ -235,6 +236,7 @@ impl<'a> Stream<'a> {
|
||||
max_end_time_90k: s.range.as_ref().map(|r| r.end.0),
|
||||
total_duration_90k: s.duration.0,
|
||||
total_sample_file_bytes: s.sample_file_bytes,
|
||||
fs_bytes: s.fs_bytes,
|
||||
days: if include_days { Some(&s.days) } else { None },
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user