refactor global config model
This commit is contained in:
parent
dcbd44a752
commit
4b322b500f
1 changed files with 4 additions and 17 deletions
|
@ -30,6 +30,10 @@ fn timestamp() -> i64 {
|
|||
UTC::now().timestamp()
|
||||
}
|
||||
|
||||
fn default_list() -> Vec<String> {
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Config {
|
||||
|
@ -37,12 +41,6 @@ pub struct Config {
|
|||
pub game_storage: String,
|
||||
#[serde(default)]
|
||||
pub movie_storage: String,
|
||||
#[serde(default = "default_map")]
|
||||
pub content: HashMap<String, u64>,
|
||||
#[serde(default = "default_map")]
|
||||
pub data: HashMap<String, u64>,
|
||||
#[serde(default = "default_map")]
|
||||
pub extras: HashMap<String, u64>,
|
||||
#[serde(default = "default_list")]
|
||||
pub os_filters: Vec<String>,
|
||||
#[serde(default = "default_list")]
|
||||
|
@ -55,22 +53,11 @@ pub struct Config {
|
|||
pub skip_games: bool,
|
||||
}
|
||||
|
||||
fn default_map() -> HashMap<String, u64> {
|
||||
HashMap::new()
|
||||
}
|
||||
|
||||
fn default_list() -> Vec<String> {
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn new() -> Config {
|
||||
Config {
|
||||
game_storage: String::from("."),
|
||||
movie_storage: String::from("."),
|
||||
content: HashMap::new(),
|
||||
data: HashMap::new(),
|
||||
extras: HashMap::new(),
|
||||
os_filters: Vec::new(),
|
||||
language_filters: Vec::new(),
|
||||
resolution_filters: Vec::new(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue