Added the watch and scheduler systems
This commit is contained in:
@@ -99,7 +99,9 @@ pub fn settings_page() -> Html {
|
||||
wasm_bindgen_futures::spawn_local(async move {
|
||||
match api::ytauth_login_stop().await {
|
||||
Ok(_) => {
|
||||
message.set(Some("YouTube login complete! Cookies exported.".into()));
|
||||
message.set(Some(
|
||||
"YouTube login complete! Cookies exported.".into(),
|
||||
));
|
||||
if let Ok(s) = api::get_ytauth_status().await {
|
||||
ytauth.set(Some(s));
|
||||
}
|
||||
@@ -123,7 +125,8 @@ pub fn settings_page() -> Html {
|
||||
</>
|
||||
}
|
||||
} else if status.authenticated {
|
||||
let age_text = status.cookie_age_hours
|
||||
let age_text = status
|
||||
.cookie_age_hours
|
||||
.map(|h| format!("cookies {h:.0}h old"))
|
||||
.unwrap_or_else(|| "authenticated".into());
|
||||
let on_refresh = {
|
||||
@@ -240,7 +243,10 @@ pub fn settings_page() -> Html {
|
||||
};
|
||||
|
||||
let ytdlp_version_html = if let Some(ref status) = *ytauth {
|
||||
let version = status.ytdlp_version.clone().unwrap_or_else(|| "not found".into());
|
||||
let version = status
|
||||
.ytdlp_version
|
||||
.clone()
|
||||
.unwrap_or_else(|| "not found".into());
|
||||
if status.ytdlp_update_available {
|
||||
let latest = status.ytdlp_latest.clone().unwrap_or_default();
|
||||
html! {
|
||||
@@ -266,7 +272,10 @@ pub fn settings_page() -> Html {
|
||||
};
|
||||
|
||||
let lastfm_key_html = {
|
||||
let key_set = ytauth.as_ref().map(|s| s.lastfm_api_key_set).unwrap_or(false);
|
||||
let key_set = ytauth
|
||||
.as_ref()
|
||||
.map(|s| s.lastfm_api_key_set)
|
||||
.unwrap_or(false);
|
||||
if key_set {
|
||||
html! {
|
||||
<p class="text-sm" style="margin: 0.25rem 0 0 0;">
|
||||
@@ -567,6 +576,60 @@ pub fn settings_page() -> Html {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
// Scheduling
|
||||
<div class="card">
|
||||
<h3>{ "Scheduling" }</h3>
|
||||
<p class="text-sm text-muted mb-1">{ "Automate pipeline runs and new release monitoring" }</p>
|
||||
<div class="form-group">
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" checked={c.scheduling.pipeline_enabled}
|
||||
onchange={let config = config.clone(); Callback::from(move |e: Event| {
|
||||
let input: HtmlInputElement = e.target_unchecked_into();
|
||||
let mut cfg = (*config).clone().unwrap();
|
||||
cfg.scheduling.pipeline_enabled = input.checked();
|
||||
config.set(Some(cfg));
|
||||
})} />
|
||||
{ " Automatically run full pipeline (sync, download, index, tag, organize)" }
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{ "Pipeline Interval (hours)" }</label>
|
||||
<input type="number" min="1" max="168" value={c.scheduling.pipeline_interval_hours.to_string()}
|
||||
oninput={let config = config.clone(); Callback::from(move |e: InputEvent| {
|
||||
let input: HtmlInputElement = e.target_unchecked_into();
|
||||
if let Ok(v) = input.value().parse() {
|
||||
let mut cfg = (*config).clone().unwrap();
|
||||
cfg.scheduling.pipeline_interval_hours = v;
|
||||
config.set(Some(cfg));
|
||||
}
|
||||
})} />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" checked={c.scheduling.monitor_enabled}
|
||||
onchange={let config = config.clone(); Callback::from(move |e: Event| {
|
||||
let input: HtmlInputElement = e.target_unchecked_into();
|
||||
let mut cfg = (*config).clone().unwrap();
|
||||
cfg.scheduling.monitor_enabled = input.checked();
|
||||
config.set(Some(cfg));
|
||||
})} />
|
||||
{ " Automatically check monitored artists for new releases" }
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{ "Monitor Interval (hours)" }</label>
|
||||
<input type="number" min="1" max="168" value={c.scheduling.monitor_interval_hours.to_string()}
|
||||
oninput={let config = config.clone(); Callback::from(move |e: InputEvent| {
|
||||
let input: HtmlInputElement = e.target_unchecked_into();
|
||||
if let Ok(v) = input.value().parse() {
|
||||
let mut cfg = (*config).clone().unwrap();
|
||||
cfg.scheduling.monitor_interval_hours = v;
|
||||
config.set(Some(cfg));
|
||||
}
|
||||
})} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
// Indexing
|
||||
<div class="card">
|
||||
<h3>{ "Indexing" }</h3>
|
||||
|
||||
Reference in New Issue
Block a user