[+] Load encoders
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
use std::{env, fs};
|
||||||
|
use serde::{Deserialize};
|
||||||
|
use anyhow::{Result};
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug)]
|
||||||
|
pub struct Encoder {
|
||||||
|
name: String,
|
||||||
|
cmd: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug)]
|
||||||
|
pub struct Encoders {
|
||||||
|
processes: u32,
|
||||||
|
encoders: Vec<Encoder>
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Encoders {
|
||||||
|
pub fn load() -> Result<Encoders> {
|
||||||
|
let file = env::var("MEOW_ENCODING_FILE").unwrap_or("encoding.toml".to_string());
|
||||||
|
let content = fs::read_to_string(file)?;
|
||||||
|
Ok(toml::from_str(&*content)?)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user