From e6829aa42381e68e6f1b7cad25ee86d3a9e13c5c Mon Sep 17 00:00:00 2001 From: Qumarth Jash Date: Fri, 31 May 2024 13:32:29 +0100 Subject: [PATCH] Very basic thing done --- main.py | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/main.py b/main.py index 86ba7c9..ecc543f 100644 --- a/main.py +++ b/main.py @@ -4,34 +4,40 @@ import urllib.request import json def extract_day(datetime_str): - dt = datetime.strptime(datetime_str.split()[0], "%Y-%m-%d") + dt = datetime.strptime(datetime_str.split()[0], '%Y-%m-%d') return(dt.date()) all_stuff = None -with urllib.request.urlopen("https://www.emfcamp.org/schedule/2024.json") as url: +with urllib.request.urlopen('https://www.emfcamp.org/schedule/2024.json') as url: all_stuff = json.load(url) # All things happening today today = datetime.today().date() all_today = [] for thing in all_stuff: - day = extract_day(thing["start_date"]) + day = extract_day(thing['start_date']) if day == today: all_today.append(thing) -# Only talks -all_talks = [] +# Only stages +all_stages = [] for thing in all_today: - if thing["type"] == "talk": - all_talks.append(thing) + if 'Stage' in thing['venue']: + all_stages.append(thing) -# talks_not_private = [] -# for talk in talks_today: -# if talk["video_privacy"] != 'public': -# talks_not_private.append(talk) +# Everything on stages today that's not public +not_public = [] +for talk in all_stages: + if talk['video_privacy'] != 'public': + not_public.append(talk) -print(len(all_talks)) -print(len(all_stuff)) -# print(len(talks_today)) -# print(len(talks_not_private)) +# Ok, print it +print('TITLE', 'START_TIME', 'END_TIME', 'VENUE', 'PRIVACY', sep=' | ') +print('-'*50) +not_public = sorted(not_public, key = lambda x: x['start_date']) +for e in not_public: + start_time = e['start_date'].split()[1] + end_time = e['end_date'].split()[1] + privacy = 'REVIEW' if e['video_privacy'] == 'review' else 'PRIVATE' + print(e['title'], start_time, end_time, e['venue'], privacy, sep=' | ')