add is_close function

This commit is contained in:
jb-alvarado 2022-02-20 22:10:11 +01:00
parent cd9a4e0a7e
commit 5d607cabe0

View File

@ -15,14 +15,14 @@ mod playlist;
pub use arg_parse::get_args; pub use arg_parse::get_args;
pub use config::{get_config, Config}; pub use config::{get_config, Config};
// pub use folder::walk; // pub use folder::walk;
pub use json_reader::read_json; pub use json_reader::{read_json, Program};
pub use playlist::program; pub use playlist::program;
#[derive(Debug, Serialize, Deserialize, Clone)] #[derive(Debug, Serialize, Deserialize, Clone)]
pub struct MediaProbe { pub struct MediaProbe {
format: Option<Format>, pub format: Option<Format>,
audio_streams: Option<Vec<Stream>>, pub audio_streams: Option<Vec<Stream>>,
video_streams: Option<Vec<Stream>>, pub video_streams: Option<Vec<Stream>>,
} }
impl MediaProbe { impl MediaProbe {
@ -118,3 +118,11 @@ pub fn sec_to_time(sec: f64) -> String {
date_time.format("%H:%M:%S").to_string() date_time.format("%H:%M:%S").to_string()
} }
pub fn is_close(a: f64, b: f64, to: f64) -> bool {
if (a - b).abs() > to {
return true
}
false
}