2024-05-31 12:53:49 +01:00
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
import urllib.request
|
|
|
|
import json
|
|
|
|
|
|
|
|
def extract_day(datetime_str):
|
|
|
|
dt = datetime.strptime(datetime_str.split()[0], "%Y-%m-%d")
|
|
|
|
return(dt.date())
|
|
|
|
|
2024-05-31 13:05:10 +01:00
|
|
|
all_stuff = None
|
2024-05-31 12:53:49 +01:00
|
|
|
with urllib.request.urlopen("https://www.emfcamp.org/schedule/2024.json") as url:
|
2024-05-31 13:05:10 +01:00
|
|
|
all_stuff = json.load(url)
|
2024-05-31 12:53:49 +01:00
|
|
|
|
2024-05-31 13:05:10 +01:00
|
|
|
# All things happening today
|
2024-05-31 12:53:49 +01:00
|
|
|
today = datetime.today().date()
|
2024-05-31 13:05:10 +01:00
|
|
|
all_today = []
|
|
|
|
for thing in all_stuff:
|
|
|
|
day = extract_day(thing["start_date"])
|
2024-05-31 12:53:49 +01:00
|
|
|
|
|
|
|
if day == today:
|
2024-05-31 13:05:10 +01:00
|
|
|
all_today.append(thing)
|
|
|
|
|
|
|
|
# Only talks
|
|
|
|
all_talks = []
|
|
|
|
for thing in all_today:
|
|
|
|
if thing["type"] == "talk":
|
|
|
|
all_talks.append(thing)
|
|
|
|
|
|
|
|
# talks_not_private = []
|
|
|
|
# for talk in talks_today:
|
|
|
|
# if talk["video_privacy"] != 'public':
|
|
|
|
# talks_not_private.append(talk)
|
2024-05-31 12:53:49 +01:00
|
|
|
|
|
|
|
print(len(all_talks))
|
2024-05-31 13:05:10 +01:00
|
|
|
print(len(all_stuff))
|
|
|
|
# print(len(talks_today))
|
|
|
|
# print(len(talks_not_private))
|