Very basic thing done
This commit is contained in:
parent
64d8aecd94
commit
e6829aa423
36
main.py
36
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=' | ')
|
||||
|
|
Loading…
Reference in New Issue