Added defaults

This commit is contained in:
seanomik 2022-06-19 14:36:57 -05:00 committed by SeanOMik
parent de98219200
commit 83bfec3ddb
Signed by: SeanOMik
GPG Key ID: 568F326C7EB33ACB
1 changed files with 10 additions and 0 deletions

View File

@ -28,14 +28,17 @@ pub struct Config {
/// The output path of the torrents. /// The output path of the torrents.
output_path: Option<String>, output_path: Option<String>,
/// Whether or not to strip public trackers from cross-seed torrents. /// Whether or not to strip public trackers from cross-seed torrents.
#[serde(default)]
strip_public: bool, strip_public: bool,
/// When running as script we exit the program after finishing. In daemon mode we run it at set intervals. /// When running as script we exit the program after finishing. In daemon mode we run it at set intervals.
run_mode: RunMode, run_mode: RunMode,
/// When running as inject we inject torrents cross-seed has found directly into the client, when running as search we populate the output folder. /// When running as inject we inject torrents cross-seed has found directly into the client, when running as search we populate the output folder.
torrent_mode: TorrentMode, torrent_mode: TorrentMode,
/// Whether to cache using an external db (ie regis) or don't cache. /// Whether to cache using an external db (ie regis) or don't cache.
#[serde(default)]
use_cache: bool, use_cache: bool,
/// Whether to keep the original torrent file and create a new one for cross-seed or delete original and upload cross-seed /// Whether to keep the original torrent file and create a new one for cross-seed or delete original and upload cross-seed
#[serde(default)]
replace_torrents: bool, replace_torrents: bool,
//pub indexers: HashMap<String, Indexer>, //pub indexers: HashMap<String, Indexer>,
@ -124,4 +127,11 @@ impl Config {
pub fn output_path_str(&self) -> Option<&String> { pub fn output_path_str(&self) -> Option<&String> {
self.output_path.as_ref() self.output_path.as_ref()
} }
pub fn run_mode(&self) -> RunMode {
self.run_mode.unwrap_or(RunMode::Script)
}
pub fun torrent_mode(&self) -> TorrentMode {
self.torrent_mode.unwrap_or(TorrentMode::Search)
}
} }