-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
37 lines (27 loc) · 989 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
""" Main file of the program."""
import datetime
import json
import os
from srcs.food_master_finder import FoodMasterFinder
from srcs.trash_schedule_grabbers.trash_schedule_grabber import TrashScheduleGrabber
from srcs.notification_producer import NotificationProducer
SUNDAY = 6
def main():
"""Main function of the program."""
# get config and builders
config = json.loads(os.environ["GSTALDERCONFIG"])
trash_schedule_grabber = TrashScheduleGrabber()
food_master_finder = FoodMasterFinder(
config, datetime.date.today() + datetime.timedelta(days=1)
)
notif_producer = NotificationProducer(
food_master_finder, trash_schedule_grabber, config
)
# We send weekly notifications on sundays
if datetime.datetime.today().weekday() == SUNDAY:
notif_producer.send_weekly_schedule()
notif_producer.send_food_master_change()
notif_producer.send_daily_schedule()
return 0
if __name__ == "__main__":
main()