Major update

too lazy to describe
This commit is contained in:
2025-12-07 19:46:47 +02:00
parent 67a948bb66
commit a21295ecc8
24 changed files with 2143 additions and 1486 deletions

View File

@@ -1,5 +1,7 @@
use std::path::{Path, PathBuf};
use anyhow::anyhow;
#[cfg(test)]
pub mod tests;
@@ -59,12 +61,13 @@ impl<ST: store::BaseStore + Clone> Manifest<ST> {
}
pub fn get_song_as_path(&self, sid: uuid::Uuid) -> Result<PathBuf> {
let ext = &xmpd_settings::Settings::get()?.tooling.song_format;
let mut p = xmpd_cliargs::CLIARGS.cache_path().into_std_path_buf();
let settings = &xmpd_settings::Settings::get()?;
let ext = &settings.tooling.song_format;
let mut p = settings.cache_settings.cache_path.clone();
p.push("songs");
p.push(sid.to_string());
p.set_extension(ext);
Ok(p)
Ok(p.into_std_path_buf())
}
}

View File

@@ -83,8 +83,9 @@ impl Song {
}
}
#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize, PartialEq, PartialOrd)]
#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize, PartialEq, PartialOrd, Default)]
pub enum SourceType {
#[default]
Youtube,
Spotify,
Soundcloud,
@@ -94,7 +95,7 @@ pub enum SourceType {
}
impl SourceType {
fn from_url(url: &url::Url) -> Option<Self> {
pub fn from_url(url: &url::Url) -> Option<Self> {
match url.host_str() {
Some("youtube.com") | Some("youtu.be") =>
Some(Self::Youtube),