From ea37a40ef78c67f6c12fbe5f48297456c2ecbe01 Mon Sep 17 00:00:00 2001 From: Lucas Oskorep Date: Tue, 28 Jun 2022 16:43:42 -0400 Subject: [PATCH] adding day of the week checker to calendar sign demo --- pi-calendar-sign.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pi-calendar-sign.py b/pi-calendar-sign.py index 2c3fcc0..64a4db8 100644 --- a/pi-calendar-sign.py +++ b/pi-calendar-sign.py @@ -10,7 +10,8 @@ from calendar_grabber import CalGrab TIMEZONE = timezone('US/Eastern') WORK_START = time(9, 00) WORK_STOP = time(17, 00) -CALENDAR = "lucas.oskorep@gmail.com" +WORK_DAYS = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"] +CALENDAR = "" # Add your desired calendar here COLOR_RED = [100, 0, 0] COLOR_GREEN = [0, 100, 0] @@ -51,16 +52,20 @@ def update_display(color, text, cursor=False, blink=False): def process_events(events): now = datetime.now(tz=TIMEZONE) is_working_time = is_work_time(now.time()) + is_weekend = now.weekday() not in WORK_DAYS + if is_event_active(events, now): - if is_working_time: + if is_weekend: + update_display(color=COLOR_PURPLE, text="Welp its the weekend and still working -_-") + elif is_working_time: update_display(color=COLOR_RED, text="Meeting in Progress") else: - update_display(color=COLOR_RED, text="Fuck this -_-") + update_display(color=COLOR_RED, text="Get me out of here -_-") else: - if is_working_time: - update_display(color=COLOR_BLUE, text="Work time - No event") + if is_weekend or not is_working_time: + update_display(color=COLOR_GREEN, text="Non-working time. No event. ") else: - update_display(color=COLOR_GREEN, text="Ayooo Looks like 420 lets blaze!") + update_display(color=COLOR_BLUE, text="Work time - No event") def main():