2021-01-20 04:20:18 +01:00
|
|
|
use {
|
|
|
|
std::{
|
|
|
|
path::Path,
|
|
|
|
time::Duration,
|
|
|
|
thread,
|
|
|
|
},
|
|
|
|
|
|
|
|
anyhow::{
|
|
|
|
anyhow,
|
|
|
|
Result,
|
|
|
|
},
|
|
|
|
|
|
|
|
libdvb::{
|
|
|
|
FeDevice,
|
|
|
|
FeStatus,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
pub fn start(fepath: &str) -> Result<()> {
|
|
|
|
let fepath = Path::new(fepath);
|
|
|
|
println!("Frontend: {}", fepath.display());
|
|
|
|
|
2021-01-22 00:31:55 +01:00
|
|
|
let fe = FeDevice::open_rd(fepath)?;
|
2021-01-20 04:20:18 +01:00
|
|
|
let mut status = FeStatus::default();
|
|
|
|
|
|
|
|
let delay = Duration::from_secs(1);
|
|
|
|
|
|
|
|
loop {
|
|
|
|
status.read(&fe)?;
|
2021-01-29 18:45:49 +01:00
|
|
|
println!("{}", &status);
|
2021-01-20 04:20:18 +01:00
|
|
|
thread::sleep(delay);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn main() -> Result<()> {
|
|
|
|
let mut args = std::env::args().skip(1);
|
|
|
|
if let Some(ref fepath) = args.next() {
|
|
|
|
start(fepath)
|
|
|
|
} else {
|
|
|
|
Err(anyhow!("Path to frontend not defined"))
|
|
|
|
}
|
|
|
|
}
|