use buffer::Buffer;
use yencode::Yencode;
use fmt::*;
+use time::Time;
pub const MEMORY_SIZE: usize = 2 << 20;
const SECTOR_SIZE: usize = 4 << 10;
self.write_buffer_offset += num_bytes_written;
}
+ ///
+ /// Write a listing of the stored recordings to @p tx_buf.
+ pub fn list_recordings(&mut self, tx_buf: &mut Buffer) {
+ for index in self.sector_header_iter().rev() {
+ let sector_header = &self.sector_header[index as usize];
+
+ if !sector_header.starts_recording() {
+ continue;
+ }
+
+ let mut date_time_s = [b' '; 19];
+
+ if let Some(tm) = Time::from_unix_time(sector_header.start_time) {
+ tm.fmt_date(&mut date_time_s[0..]);
+ tm.fmt_time(&mut date_time_s[11..]);
+ }
+
+ let mut recording_id_s = [b'0'; 9];
+ let recording_id_s_len =
+ fmt_u32_pad(&mut recording_id_s,
+ sector_header.recording_id as u32,
+ 8, b' ');
+
+ tx_buf.write(&date_time_s);
+ tx_buf.write(b" ");
+ tx_buf.write(&recording_id_s[0..recording_id_s_len]);
+ tx_buf.write(b"\n");
+
+ tx_buf.flush();
+ }
+ }
+
///
/// Check whether or not recording @p recording_id exists.
pub fn has_recording(&mut self, recording_id: u16) -> bool {