parent
7a50ea6016
commit
61e17d9c96
10 changed files with 416 additions and 4 deletions
13
update.py
13
update.py
|
|
@ -21,6 +21,7 @@ import agenda.mail
|
|||
import agenda.thespacedevs
|
||||
import agenda.types
|
||||
import agenda.uk_holiday
|
||||
import agenda.uk_school_holiday
|
||||
from agenda.event import Event
|
||||
from agenda.types import StrDict
|
||||
from web_view import app
|
||||
|
|
@ -37,6 +38,17 @@ async def update_bank_holidays(config: flask.config.Config) -> None:
|
|||
print(f"took {time_taken:.1f} seconds")
|
||||
|
||||
|
||||
async def update_school_holidays(config: flask.config.Config) -> None:
|
||||
"""Update cached copy of Bristol school holidays."""
|
||||
t0 = time()
|
||||
events = await agenda.uk_school_holiday.get_holiday_list(config["DATA_DIR"])
|
||||
time_taken = time() - t0
|
||||
if not sys.stdin.isatty():
|
||||
return
|
||||
print(len(events), "school holidays in list")
|
||||
print(f"took {time_taken:.1f} seconds")
|
||||
|
||||
|
||||
async def update_bristol_bins(config: flask.config.Config) -> None:
|
||||
"""Update waste schedule from Bristol City Council."""
|
||||
t0 = time()
|
||||
|
|
@ -476,6 +488,7 @@ def main() -> None:
|
|||
with app.app_context():
|
||||
if hour % 3 == 0:
|
||||
asyncio.run(update_bank_holidays(app.config))
|
||||
asyncio.run(update_school_holidays(app.config))
|
||||
asyncio.run(update_bristol_bins(app.config))
|
||||
update_gwr_advance_ticket_date(app.config)
|
||||
# TODO: debug why update gandi fails
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue