Skip to content

Commit 0bfbebb

Browse files
committed
Extra_places
1 parent 315deb9 commit 0bfbebb

5 files changed

Lines changed: 55 additions & 25 deletions

File tree

_layouts/summary.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ <h1>
198198
<a href="#">{{conf.place}}</a>
199199
{% else %}
200200
<a href="http://maps.google.com/?q={{conf.place}}">{{conf.place}}</a>
201+
{% if conf.extra_places %}
202+
{% for place in conf.extra_places %}
203+
& <a href="http://maps.google.com/?q={{place}}">{{place}}</a>
204+
{% endfor %}
205+
{% endif %}
201206
{% endif %}
202207
</span>
203208
</div>

_pages/archive.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ <h1 id="past-events-title">Past Events</h1>
118118
<a href="#">{{conf.place}}</a>
119119
{% else %}
120120
<a href="http://maps.google.com/?q={{conf.place}}">{{conf.place}}</a>
121+
{% if conf.extra_places %}
122+
{% for place in conf.extra_places %}
123+
& <a href="http://maps.google.com/?q={{place}}">{{place}}</a>
124+
{% endfor %}
125+
{% endif %}
121126
{% endif %}
122127
</span>
123128
</div>

index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ <h1>
121121
<a href="#">{{conf.place}}</a>
122122
{% else %}
123123
<a href="http://maps.google.com/?q={{conf.place}}">{{conf.place}}</a>
124+
{% if conf.extra_places %}
125+
{% for place in conf.extra_places %}
126+
& <a href="http://maps.google.com/?q={{place}}">{{place}}</a>
127+
{% endfor %}
128+
{% endif %}
124129
{% endif %}
125130
</span>
126131
</div>

utils/schema.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
tutorial_deadline: 'YYYY-MM-DD HH:mm:ss' # Tutorial deadline if different from cfp (Optional)
1010
timezone: Asia/Seoul # Standard IANA Timezones (Omit for AoE)
1111
place: Incheon, South Korea # City, Country
12+
extra_places: [Online] # Extra places for hybrid conferences
1213
date: September 18 - 22, 2022 # Nicely written dates of conference
1314
start: YYYY-MM-DD # Start date of conference for calendar
1415
end: YYYY-MM-DD # End date of conference for calendar

utils/tidy_conf/latlon.py

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def add_latlon(data):
2121
continue
2222
elif "location" in q:
2323
# If location is already present, add it to the cache
24-
cache[q["place"]] = q["location"]
25-
continue
24+
cache[q["place"]] = q["location"][0]
25+
# continue
2626
else:
2727
# Add to the copy if location is not present for speed
2828
data_copy.append((i, q))
@@ -36,30 +36,44 @@ def add_latlon(data):
3636
tqdm.write(f"IndexError: {q['place']}")
3737

3838
# Check if the location is already in the cache
39-
if q["place"] in cache and cache[q["place"]] is not None:
40-
data[i]["location"] = {
41-
"latitude": cache[q["place"]]["latitude"],
42-
"longitude": cache[q["place"]]["longitude"],
43-
}
44-
45-
else:
46-
# Get the location from Openstreetmaps
47-
url = "https://nominatim.openstreetmap.org/search" + "?format=json&q=" + urllib.parse.quote(q["place"])
48-
response = requests.get(url)
39+
places = [q["place"]]
40+
if "extra_places" in q:
41+
places += q["extra_places"]
4942

50-
if response:
51-
try:
52-
response = response.json()
53-
data[i]["location"] = {
54-
"latitude": float(response[0]["lat"]),
55-
"longitude": float(response[0]["lon"]),
43+
new_location = []
44+
for place in places:
45+
place = place.strip()
46+
if place in cache and cache[place] is not None:
47+
new_location += [
48+
{
49+
"latitude": cache[place]["latitude"],
50+
"longitude": cache[place]["longitude"],
5651
}
57-
cache[q["place"]] = data[i]["location"]
58-
except IndexError:
59-
cache[q["place"]] = None
60-
tqdm.write(f"No response from Openstreetmaps for {q['place']}")
61-
time.sleep(2)
52+
]
53+
6254
else:
63-
cache[q["place"]] = None
64-
tqdm.write(f"No response from Openstreetmaps for {q['place']}")
55+
# Get the location from Openstreetmaps
56+
url = "https://nominatim.openstreetmap.org/search" + "?format=json&q=" + urllib.parse.quote(place)
57+
response = requests.get(url)
58+
59+
if response:
60+
try:
61+
response = response.json()
62+
new_location += [
63+
{
64+
"latitude": float(response[0]["lat"]),
65+
"longitude": float(response[0]["lon"]),
66+
}
67+
]
68+
cache[place] = new_location[-1]
69+
except IndexError:
70+
cache[place] = None
71+
tqdm.write(f"No response from Openstreetmaps for {q['place']}")
72+
time.sleep(2)
73+
else:
74+
cache[place] = None
75+
tqdm.write(f"No response from Openstreetmaps for {q['place']}")
76+
else:
77+
if new_location:
78+
data[i]["location"] = new_location
6579
return data

0 commit comments

Comments
 (0)