Schedule pickers, and target progress at one row
"Check feeds every" becomes a number plus a unit dropdown in both global and per-feed settings; parse_interval gained weeks to back it. The per-feed dropdown can select the global default, clearing the override. Fixes progress painting every pending row: the event carried no enclosure id, so the handler had nothing to target and set the width on all of them. Adding a feed looked like it was downloading everything. Progress, DownloadDone and DownloadError now carry the enclosure id. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AdXho5tTkjFLeUXKbEjKBh
This commit is contained in:
@@ -158,7 +158,8 @@ impl General {
|
||||
|
||||
/// Parses a check interval into minutes.
|
||||
///
|
||||
/// Accepts "every 30m", "30m", "4h", "1d", "every 4 hours", or a bare number of minutes.
|
||||
/// Accepts "every 30m", "30m", "4h", "1d", "2w", "every 4 hours", or a bare number of
|
||||
/// minutes.
|
||||
/// Returns None for anything it cannot read, or for zero.
|
||||
pub fn parse_interval(s: &str) -> Option<u64> {
|
||||
let s = s.trim().to_lowercase();
|
||||
@@ -178,6 +179,7 @@ pub fn parse_interval(s: &str) -> Option<u64> {
|
||||
"" | "m" | "min" | "mins" | "minute" | "minutes" => n,
|
||||
"h" | "hr" | "hrs" | "hour" | "hours" => n.checked_mul(60)?,
|
||||
"d" | "day" | "days" => n.checked_mul(1440)?,
|
||||
"w" | "week" | "weeks" => n.checked_mul(10080)?,
|
||||
_ => return None,
|
||||
};
|
||||
(mins > 0).then_some(mins)
|
||||
@@ -339,6 +341,7 @@ mod tests {
|
||||
("every 30m", 30), ("30m", 30), ("30", 30), ("every 30 minutes", 30),
|
||||
("every 4h", 240), ("4h", 240), ("4 hours", 240), ("EVERY 4H", 240),
|
||||
("1d", 1440), ("every 2 days", 2880), (" every 90m ", 90),
|
||||
("1w", 10080), ("every 2 weeks", 20160), ("2 w", 20160),
|
||||
] {
|
||||
assert_eq!(parse_interval(input), Some(want), "{input:?}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user