Added the watch and scheduler systems
This commit is contained in:
@@ -35,6 +35,9 @@ pub struct AppConfig {
|
||||
|
||||
#[serde(default)]
|
||||
pub metadata: MetadataConfig,
|
||||
|
||||
#[serde(default)]
|
||||
pub scheduling: SchedulingConfig,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@@ -130,6 +133,36 @@ pub struct MetadataConfig {
|
||||
pub fanart_api_key: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct SchedulingConfig {
|
||||
/// Enable automatic pipeline runs.
|
||||
#[serde(default)]
|
||||
pub pipeline_enabled: bool,
|
||||
|
||||
/// Hours between pipeline runs (after previous completion).
|
||||
#[serde(default = "default_pipeline_interval_hours")]
|
||||
pub pipeline_interval_hours: u32,
|
||||
|
||||
/// Enable automatic new release checking for monitored artists.
|
||||
#[serde(default)]
|
||||
pub monitor_enabled: bool,
|
||||
|
||||
/// Hours between monitor checks.
|
||||
#[serde(default = "default_monitor_interval_hours")]
|
||||
pub monitor_interval_hours: u32,
|
||||
}
|
||||
|
||||
impl Default for SchedulingConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
pipeline_enabled: true,
|
||||
pipeline_interval_hours: default_pipeline_interval_hours(),
|
||||
monitor_enabled: true,
|
||||
monitor_interval_hours: default_monitor_interval_hours(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Defaults ---
|
||||
|
||||
impl Default for AppConfig {
|
||||
@@ -145,6 +178,7 @@ impl Default for AppConfig {
|
||||
download: DownloadConfig::default(),
|
||||
indexing: IndexingConfig::default(),
|
||||
metadata: MetadataConfig::default(),
|
||||
scheduling: SchedulingConfig::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -272,6 +306,12 @@ fn default_lyrics_source() -> String {
|
||||
fn default_cover_art_source() -> String {
|
||||
"coverartarchive".to_string()
|
||||
}
|
||||
fn default_pipeline_interval_hours() -> u32 {
|
||||
3
|
||||
}
|
||||
fn default_monitor_interval_hours() -> u32 {
|
||||
12
|
||||
}
|
||||
fn default_cookie_refresh_hours() -> u32 {
|
||||
6
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ fn test_default_config() {
|
||||
assert!(!config.tagging.auto_tag);
|
||||
assert_eq!(config.download.format, "opus");
|
||||
assert_eq!(config.download.search_source, "ytmusic");
|
||||
assert_eq!(config.download.rate_limit, 450);
|
||||
assert_eq!(config.download.rate_limit, 250);
|
||||
assert_eq!(config.download.rate_limit_auth, 1800);
|
||||
assert_eq!(config.indexing.concurrency, 4);
|
||||
assert!(config.allowed_secondary_types.is_empty());
|
||||
|
||||
Reference in New Issue
Block a user