use crate::options::SharedOptions;
use crate::utils::{AlbumConfig, SAMPLE_TRANSCODES_DIR, TargetFormat};
use std::path::PathBuf;
#[derive(Debug, Clone)]
pub struct TranscodeConfig {
pub album: AlbumConfig,
pub target: TargetFormat,
}
impl TranscodeConfig {
#[must_use]
pub fn new(album: AlbumConfig, target: TargetFormat) -> Self {
Self { album, target }
}
#[must_use]
pub fn dir_name(&self) -> String {
format!(
"{} - {} [{}] [WEB {}]",
self.album.artist,
self.album.album,
self.album.year,
self.target.get_name()
)
}
#[must_use]
pub fn transcode_dir(&self) -> PathBuf {
SAMPLE_TRANSCODES_DIR.join(self.dir_name())
}
#[must_use]
pub fn torrent_path(&self) -> PathBuf {
SAMPLE_TRANSCODES_DIR.join(format!(
"{}.{}.torrent",
self.dir_name(),
SharedOptions::MOCK_INDEXER
))
}
}