Got a basic working structure in place
This commit is contained in:
34
src/config.rs
Normal file
34
src/config.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
use serde_derive::Deserialize;
|
||||
use std::fs;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Config {
|
||||
pub transcoder: Transcoder,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn new(config_path: &str) -> Config {
|
||||
let resolved_path = shellexpand::tilde(config_path);
|
||||
let config_text = fs::read_to_string(&*resolved_path).unwrap();
|
||||
let c: Config = toml::from_str(&config_text).unwrap();
|
||||
return c;
|
||||
}
|
||||
|
||||
pub fn get_repository(&self) -> String {
|
||||
let resolved_path = shellexpand::tilde(&self.transcoder.repository);
|
||||
return String::from(&*resolved_path);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Transcoder {
|
||||
pub repository: String,
|
||||
pub interval: u16,
|
||||
pub video_format: String,
|
||||
pub video_codec: String,
|
||||
pub video_profile: String,
|
||||
pub video_resolution: String,
|
||||
pub video_framerate: u8,
|
||||
pub video_color: String,
|
||||
pub audio_codec: String,
|
||||
}
|
||||
Reference in New Issue
Block a user