make first runnable version

This commit is contained in:
2026-06-06 18:01:59 +02:00
parent 6a3817d835
commit 94e4de8051
21 changed files with 1664 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
use std::path::PathBuf;
pub fn base_dir() -> PathBuf {
let mut p = dirs::home_dir().unwrap();
p.push(".sjn/music");
p
}
pub fn songs_dir() -> PathBuf {
let mut p = base_dir();
p.push("songs");
p
}
pub fn song_path(name: &str) -> String {
let safe: String = name
.chars()
.map(|c| {
if c.is_alphanumeric() || c == ' ' {
c
} else {
'_'
}
})
.collect();
let mut p = songs_dir();
p.push(format!("{safe}.mp3"));
p.to_string_lossy().to_string()
}
pub fn db_path() -> String {
let mut p = base_dir();
p.push("songs.db");
p.to_string_lossy().to_string()
}