xmpd/xmpd-settings/src/tooling.rs

43 lines
1.2 KiB
Rust
Raw Normal View History

2024-11-19 12:35:33 +00:00
use std::str::FromStr;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Tooling {
#[serde(default="Tooling::default_ytdlp_path")]
pub ytdlp_path: camino::Utf8PathBuf,
#[serde(default="Tooling::default_spotdl_path")]
pub spotdl_path: camino::Utf8PathBuf,
#[serde(default="Tooling::default_ffmpeg_path")]
pub ffmpeg_path: camino::Utf8PathBuf,
#[serde(default="Tooling::default_song_format")]
pub song_format: String,
}
impl Default for Tooling {
fn default() -> Self {
Self {
ytdlp_path: Self::default_ytdlp_path(),
spotdl_path: Self::default_spotdl_path(),
ffmpeg_path: Self::default_ffmpeg_path(),
song_format: Self::default_song_format(),
}
}
}
impl Tooling {
fn default_ytdlp_path() -> camino::Utf8PathBuf {
camino::Utf8PathBuf::from_str("yt-dlp").unwrap()
}
fn default_spotdl_path() -> camino::Utf8PathBuf {
camino::Utf8PathBuf::from_str("spotdl").unwrap()
}
fn default_ffmpeg_path() -> camino::Utf8PathBuf {
camino::Utf8PathBuf::from_str("ffmpeg").unwrap()
}
fn default_song_format() -> String {
String::from("flac")
}
}