diff --git a/config.json b/config.json new file mode 100644 index 0000000..6c0b34e --- /dev/null +++ b/config.json @@ -0,0 +1,13 @@ +{ + "ytdlp": { + "path": "/usr/bin/yt-dlp", + "is_python": false + }, + "spotdl": { + "path": "/home/mcorange/.local/bin/spotdl", + "is_python": false + }, + "python": { + "path": "" + } +} \ No newline at end of file diff --git a/music_mgr/src/config/mod.rs b/music_mgr/src/config/mod.rs index 4fc54c9..524daa5 100644 --- a/music_mgr/src/config/mod.rs +++ b/music_mgr/src/config/mod.rs @@ -58,6 +58,7 @@ impl ConfigWrapper { impl Config { pub async fn parse(cli: &CliArgs) -> Result { if !cli.config.exists() { + log::info!("Config doesnt exist"); return Self::setup_config(&cli).await; } @@ -127,6 +128,14 @@ impl Config { } } + + s.save(cli.config.clone().into_std_path_buf())?; Ok(s) } + + fn save(&self, path: PathBuf) -> anyhow::Result<()> { + let data = serde_json::to_string_pretty(self)?; + std::fs::write(path, data)?; + Ok(()) + } }