Rules can be limited to schedule blocks

Each rule has the blocks it acts in (none: always; without a running
schedule always). Stored as a block mask (schedule format 2, version 1
records are converted), in JSON as the blocks' start times. Version 2.7.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-15 22:25:00 +02:00
1 parent 87e242bf89
commit 53e9057d02
11 files changed
+166 -19

No files matched your search

+7
View File
@@ -60,6 +60,8 @@ const char *validateSchedule(const PageSchedule &s)
return "Rule times must be 1 to 3600 seconds";
if (r.interval < RULE_INTERVAL_MIN || r.interval > RULE_INTERVAL_MAX)
return "Rules are read every 2 to 600 seconds";
if (r.blocks >> s.block_count)
return "A rule is set for a block that doesn't exist";
}
return nullptr;
}
@@ -79,6 +81,11 @@ static bool number(const char *text, double &value)
return end != text && *end == '\0';
}
bool ruleInBlock(const TriggerRule &rule, int block)
{
return rule.blocks == 0 || block < 0 || (rule.blocks >> block) & 1;
}
bool ruleMatches(const TriggerRule &rule, const char *value)
{
if (value == nullptr)