diff --git a/assets/ffplayout.yml b/assets/ffplayout.yml index a363f3da..28936a2f 100644 --- a/assets/ffplayout.yml +++ b/assets/ffplayout.yml @@ -95,7 +95,8 @@ playlist: infinit: false storage: - help_text: 'filler' is for playing instead of a missing file or fill the end to reach 24 + help_text: > + 'filler' is for playing instead of a missing file or fill the end to reach 24 hours, can be a file or folder, it will loop when is necessary. 'extensions' search only files with this extension. Set 'shuffle' to 'true' to pick files randomly. path: "/var/lib/ffplayout/tv-media" diff --git a/ffplayout-engine/src/utils/mod.rs b/ffplayout-engine/src/utils/mod.rs index 3d77739a..f5ddcc4c 100644 --- a/ffplayout-engine/src/utils/mod.rs +++ b/ffplayout-engine/src/utils/mod.rs @@ -14,7 +14,8 @@ pub use arg_parse::Args; use ffplayout_lib::{ filter::Filters, utils::{ - get_sec, sec_to_time, time_to_sec, Media, OutputMode::*, PlayoutConfig, ProcessMode::*, + get_sec, parse_log_level_filter, sec_to_time, time_to_sec, Media, OutputMode::*, + PlayoutConfig, ProcessMode::*, }, vec_strings, }; @@ -86,10 +87,11 @@ pub fn get_config(args: Args) -> PlayoutConfig { } } - // TODO: implement this - // if let Some(level) = args.level { - // config.logging.level = LevelFilter::from(level); - // } + if let Some(level) = args.level { + if let Ok(filter) = parse_log_level_filter(&level) { + config.logging.level = filter; + } + } if args.infinit { config.playlist.infinit = args.infinit; diff --git a/lib/src/utils/mod.rs b/lib/src/utils/mod.rs index c0c4007e..c96913bb 100644 --- a/lib/src/utils/mod.rs +++ b/lib/src/utils/mod.rs @@ -883,6 +883,18 @@ pub fn get_date_range(date_range: &[String]) -> Vec { range } +pub fn parse_log_level_filter(s: &str) -> Result { + match s.to_lowercase().as_str() { + "debug" => Ok(LevelFilter::Debug), + "error" => Ok(LevelFilter::Error), + "info" => Ok(LevelFilter::Info), + "trace" => Ok(LevelFilter::Trace), + "warning" => Ok(LevelFilter::Warn), + "off" => Ok(LevelFilter::Off), + _ => Err("Error level not exists!"), + } +} + pub fn home_dir() -> Option { home_dir_inner() }