1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! Configuration for cached transcodes in tests.
use crate::testing_prelude::*;
/// Configuration for a cached transcode output.
#[derive(Debug, Clone)]
pub struct TranscodeConfig {
/// The source album configuration.
pub album: AlbumConfig,
/// The target format for the transcode.
pub target: TargetFormat,
}
impl TranscodeConfig {
/// Create a new transcode configuration.
#[must_use]
pub fn new(album: AlbumConfig, target: TargetFormat) -> Self {
Self { album, target }
}
/// Directory name for the transcode output.
///
/// Format: `Artist - Album [Year] [WEB FORMAT]`
///
/// Note: This matches the naming convention used by [`TranscodeName`].
#[must_use]
pub fn dir_name(&self) -> String {
format!(
"{} - {} [{}] [WEB {}]",
self.album.artist,
self.album.album,
self.album.year,
self.target.get_name()
)
}
/// Full path to the cached transcode directory.
#[must_use]
pub fn transcode_dir(&self) -> PathBuf {
SAMPLE_TRANSCODES_DIR.join(self.dir_name())
}
/// Full path to the torrent file.
///
/// Note: Uses indexer suffix from [`SharedOptions::MOCK_INDEXER`].
#[must_use]
pub fn torrent_path(&self) -> PathBuf {
SAMPLE_TRANSCODES_DIR.join(format!(
"{}.{}.torrent",
self.dir_name(),
SharedOptions::MOCK_INDEXER
))
}
}