Created
July 30, 2016 12:28
-
-
Save mscroggs/4eac9017ef22dd7e20ec81c270f91002 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import urllib2 | |
sched = json.load(urllib2.urlopen("https://www.emfcamp.org/schedule.json")) | |
sorted_sched = {day:{} for day in ["05","06","07"]} | |
for item in sched: | |
day = item["start_date"].split()[0].split("-")[2] | |
if item["venue"] not in sorted_sched[day]: | |
sorted_sched[day][item["venue"]] = [] | |
sorted_sched[day][item["venue"]].append | |
output = "" | |
for dayname,day in [("Friday","05"),("Saturday","06"),("Sunday","07")]: | |
output += "=="+dayname+"==\n" | |
for stage in ["Stage A","Stage B","Stage C","Workshop 1","Workshop 2"]: | |
output += "==="+stage+"===\n" | |
output += "{| class=wikitable\n! Title\n! Speaker\n! Video\n! Slides/Resources\n" | |
sub_sched = [item for item in sched if item["start_date"].split()[0]=="2016-08-"+day and item["venue"]==stage] | |
sub_sched = sorted(sub_sched,key=lambda item:item["start_date"]) | |
for item in sub_sched: | |
output += "|-\n| "+item["title"]+"\n| "+item["speaker"]+"\n|\n|\n" | |
output += "|}\n" | |
with open("output","w") as f: | |
f.write(output.encode('utf-8')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment