enh: automation

This commit is contained in:
Timothy Jaeryang Baek
2026-04-11 17:06:58 -06:00
parent ee9db91df0
commit 406251c2f3
6 changed files with 85 additions and 0 deletions
+19
View File
@@ -92,6 +92,25 @@ def next_n_runs_ns(s: str, n: int = 5, tz: str = None) -> list[int]:
return result
def rrule_interval_seconds(s: str) -> Optional[int]:
"""Approximate interval between recurrences in seconds.
Returns None for one-shot (COUNT=1) schedules or rules
with fewer than two future occurrences.
"""
if 'COUNT=1' in s:
return None
rule = _parse_rule(s)
now = datetime.now()
first = rule.after(now)
if first is None:
return None
second = rule.after(first)
if second is None:
return None
return int((second - first).total_seconds())
############################
# Worker Loop
############################