Ability to have hourly range and daily range
in progress
Tyler Kelly
I have found myself wanting to schedule things hourly (morning shows on weekday, after midnight shows, saturday morning cartoons, box office movies in the evening) and the current strategy involves me writing a lot of yaml.
I have this code in util.py and it works but doesn't work when combined with range :( hoping someone can help me out or just take it over
elif run_time.startswith("myhourly_range"):
logger.error("In hourly range")
match = re.match("^([0-9]|0[0-9]|1[0-9]|2[0-3])-([0-9]|0[0-9]|1[0-9]|2[0-3])$", param)
if not match:
logger.error(f"Schedule Error: hourly_range {display} must be in the hour-hour format i.e. hourly_range(07-15)")
continue
hour_start = int(match.group(1))
hour_end = int(match.group(2))
if hour_start <= hour_end:
hours = list(range(hour_start, hour_end + 1))
else:
hours = list(range(hour_start, 24)) + list(range(0, hour_end + 1))
hourly_strings = [f"hourly({hour})" for hour in hours]
hour_range_string = ", ".join(hourly_strings)
range_collection = True
schedule_str += schedule_check(attribute, hour_range_string, current_time, run_hour, is_all=False)
all_check += 1
Sohjiro
you should be able to do
all[daily(monday|tuesday),hourly(7-11)]
and it should run whenever PMM runs on monday or tuesday between the hours of 7 and 11 if thats not working like that let me knowTyler Kelly
Sohjiro: That didn’t work for me on 1.19.0-nightly103
got this error:
Value: ['all[daily(saturday|sunday), hourly(07-12)]'] |
[2023-08-30 09:11:24,998] [util.py:620] [ERROR] | Schedule Error: hourly hourly(7-12) each must be a different integer between 0 and 23
Sohjiro
Tyler Kelly: try again with the latest nightly105
Tyler Kelly
Sohjiro: 105 works, thank you!
Tyler Kelly
Sohjiro: You know what this actually isn’t working properly. There are no errors but visible_library: all[daily(saturday|sunday), hourly(07-12)] will still apply today. It seems to approve everything…
EDIT: I should say it seems to not respect the daily range in this case, but the hourly range is respected
Yozora
Tyler Kelly: are you on the Discord? it may help to provide logs and chat there
Tyler Kelly
Yozora: yea I’m tcjelly on there
Tyler Kelly
Whoops my bad I was using daily instead of weekly. Works as intended! thanks again
Tyler Kelly
The hourly and day selection are great but it would be really nice to combine them for my use case. As it is currently I’d still need the full gauntlet of alls like this:
all[daily(monday), hourly(7)]
all[daily(monday), hourly(8)]
…
I recommend an “any” schedule so we could do something like this:
all[any[daily(monday|tuesday)], any[hourly(7-11)]]
Thoughts Sohjiro?
Sohjiro
in progress
added to nightly
Yozora
Why not just do more than one schedule?
for example: Morning Shows scheduled for hourly(1),hourly(2),hourly(3)
Metabot
Discord Discussion Can be found Here