diff options
| author | tslil <tslil@posteo.de> | 2026-07-14 20:22:56 +0100 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-07-14 21:25:04 +0100 |
| commit | fc5789e026473ea82237be847672ecb350e64479 (patch) | |
| tree | 6210659eb424124b55bd67a63397a37931e50b5f /src/config.rs | |
| parent | 156cbfe2b0383521f540109682d98d35c88d65f8 (diff) | |
license, simplify code, add README, lose "learner" naming
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/config.rs b/src/config.rs index 15b449a..67721b4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,13 +1,13 @@ use directories::{ProjectDirs, UserDirs}; use serde::{Deserialize, Serialize}; -use std::fs; +use std::{collections::HashSet, fs}; use expanduser::expanduser; #[derive(Serialize, Deserialize)] pub struct Config { pub music_root: String, - pub audio_exts: Vec<String>, + pub audio_exts: HashSet<String>, pub skip_window_secs: u64, pub temperature: f32, pub low_weight: f32, @@ -19,7 +19,12 @@ pub struct Config { fn default_config_path() -> String { let name = "mood.json"; ProjectDirs::from("qualifier", "organisation", "mood") - .and_then(|pd| pd.config_dir().join(name).to_str().map(std::string::ToString::to_string)) + .and_then(|pd| { + pd.config_dir() + .join(name) + .to_str() + .map(std::string::ToString::to_string) + }) .unwrap_or(format!("~/.config/mood/{name}")) } @@ -50,7 +55,7 @@ impl Default for Config { .and_then(|p| p.to_str().map(std::string::ToString::to_string)) }) .unwrap_or("~/Music".to_string()), - audio_exts: [".mp3", ".flac", ".wav", ".m4a", ".ogg", ".vorbis"] + audio_exts: ["mp3", "flac", "wav", "m4a", "ogg", "vorbis", "mp4"] .into_iter() .map(String::from) .collect(), |
