selene-core 0.3.1

selene-core is the backend for Selene, a local-first music player
Documentation
use std::{
    fs, io,
    path::{Path, PathBuf},
};

use crate::{config::common::LoudnormConfig, library::track::Track};

impl Track {
    pub(crate) fn set_loudnorm(&mut self, with_options: LoudnormConfig) {
        self.applied_loudnorm = Some(with_options);
    }

    pub(crate) fn set_source_file(&mut self, path: PathBuf) {
        self.src_container.set_path(path);
    }

    pub(crate) fn ensure_parent_dirs(&self, library_dir: impl AsRef<Path>) -> io::Result<()> {
        let mut library_dir = library_dir.as_ref().join(&self.relative_library_path);
        library_dir.pop();
        fs::create_dir_all(library_dir)
    }
}