Files
off/config.py

30 lines
1.6 KiB
Python

"""Application configuration."""
# ═══════════════════════════════════════════════════════════════════════
# CONFIGURATION — Edit these values to change behavior
# ═══════════════════════════════════════════════════════════════════════
BUDGET_S = 3600 # default 60 min per device (in seconds)
TICK_INTERVAL = 10 # seconds between budget check cycles
ALLOWED_WEEKDAY = "17:50-19:10" # Mon-Fri allowed hours
ALLOWED_WEEKEND = "7:30-19:10" # Sat-Sun allowed hours
# ═══════════════════════════════════════════════════════════════════════
def _parse_time_range(time_str: str) -> tuple[int, int]:
"""Parse a time range string like '15:00-20:30' into (start_minutes, end_minutes).
Returns minutes since midnight for start and end times.
"""
start_str, end_str = time_str.split("-")
sh, sm = map(int, start_str.split(":"))
eh, em = map(int, end_str.split(":"))
return sh * 60 + sm, eh * 60 + em
# ── Parsed values (do not edit) ──────────────────────────────────────
WEEKDAY_START, WEEKDAY_END = _parse_time_range(ALLOWED_WEEKDAY)
WEEKEND_START, WEEKEND_END = _parse_time_range(ALLOWED_WEEKEND)