Skip to content

Commit 61557bd

Browse files
committedDec 26, 2022
jev22: extend + optimize config
1 parent 19bb745 commit 61557bd

File tree

3 files changed

+72
-53
lines changed

3 files changed

+72
-53
lines changed
 

‎html2meta.py

+33-32
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
acronym = 'jev22' # args.acronym.lower()
2525

26-
2726
@dataclass
2827
class Location:
2928
id: str
@@ -72,37 +71,39 @@ def fetch_post(source_url):
7271
cid = chapter['id'].split('-')[3]
7372
print("\n==", cid, chapter.string)
7473

75-
region = None
76-
location = None
77-
subsection = None
78-
79-
# TODO: next_siblings vs next_elements
80-
for region in chapter.find_next_siblings('h3'):
81-
print(region.string)
82-
83-
for element in region.find_next_siblings('h4'):
84-
location = Location(
85-
id=element['id'],
86-
name=element.string,
87-
region=region,
88-
country=cid
89-
)
90-
print("-", location.name)
91-
conferences.append(location)
92-
93-
subsection = None
94-
for p in element.find_all('p'):
95-
if p.get('class') == ['subsection']:
96-
subsection = p.string.strip()
97-
continue
98-
99-
if subsection == 'Info':
100-
location.infos = [list(li.children) for li in p.select('li')]
101-
continue
102-
103-
if subsection and location:
104-
location.description[subsection] += p.text.prettify()
105-
continue
74+
elements = chapter.find_next_siblings('h4')
75+
element = next(elements)
76+
77+
while True:
78+
location = Location(
79+
id=element['id'],
80+
name=element.string,
81+
region=element.find_previous_sibling('h3'),
82+
country=cid
83+
)
84+
print("-", location.name)
85+
conferences.append(location)
86+
87+
subsection = None
88+
for p in element.next_siblings:
89+
if p.name != 'p':
90+
break
91+
92+
if p.get('class') == ['subsection']:
93+
subsection = p.string.strip()
94+
continue
95+
96+
if subsection == 'Info':
97+
location.infos = [list(li.children) for li in p.select('li')]
98+
continue
99+
100+
if subsection and location:
101+
location.description[subsection] += p.text.prettify()
102+
continue
103+
104+
element = next(elements)
105+
if not element or element.previous_sibling.name == 'h2':
106+
break
106107

107108
return conferences
108109

‎schedule_jev22.py

+37-19
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python3
22
# -*- coding: UTF-8 -*-
33

4-
import os
54
from typing import List
65
import requests
76
import json
@@ -83,6 +82,21 @@
8382
},
8483
options={"track": "Hellarious"},
8584
),
85+
GenericConference(
86+
url="https://data.jtbx.de/jev22_ccl/schedule.json",
87+
data={
88+
"name": "Curious Community Labs e.V.", # (27.–29.)
89+
"location": "Hamburg",
90+
"links": [
91+
"https://curious.bio/2022/11/remote-chaos-experience/",
92+
],
93+
"osm_url": "https://www.openstreetmap.org/node/9615054340#v1"
94+
},
95+
options={
96+
"track": "Curious Community Labs",
97+
"id_offsets": -200
98+
},
99+
),
86100
PretalxConference(
87101
url="https://pretalx.c3voc.de/xrelog-2022",
88102
data={
@@ -94,6 +108,16 @@
94108
],
95109
},
96110
),
111+
PretalxConference(
112+
url="https://talks.w.icmp.camp/wicmp1",
113+
data={
114+
"slug": "wicmp1",
115+
"name": "Wintergalaktische Club Mate Party", # (27.–30.)
116+
"location": "Erlangen, Bits'n'Bugs + ZAM",
117+
"links": ["https://w.icmp.camp"],
118+
},
119+
options={"track": "Erlangen"},
120+
),
97121
WebcalConference(
98122
url="webcals://ramac.mudbyte.de/remote.php/dav/public-calendars/YTtwyZcXsmZDfSoo/?export",
99123
data={
@@ -105,16 +129,6 @@
105129
"track": "Gießen/Wetzlar",
106130
},
107131
),
108-
PretalxConference(
109-
url="https://talks.w.icmp.camp/wicmp1",
110-
data={
111-
"slug": "wicmp1",
112-
"name": "Wintergalaktische Club Mate Party", # (27.–30.)
113-
"location": "Erlangen, Bits'n'Bugs + ZAM",
114-
"links": ["https://w.icmp.camp"],
115-
},
116-
options={"track": "Erlangen"},
117-
),
118132
GenericConference(
119133
url="https://laborluxeria.github.io/winterchaos2022/schedule.json",
120134
# https://github.com/laborluxeria/winterchaos2022/tree/main/_sessions – michi
@@ -162,7 +176,8 @@
162176
},
163177
),
164178
GenericConference(
165-
url="TBD",
179+
# TODO: add XML import from https://dezentrale.space/2022/12/localverse2022-fahrplan.xml
180+
url="TBD", # https://dezentrale.space/2022/12/localverse2022-fahrplan.xml",
166181
data={
167182
"name": "localverse2022", # (27.–30.)
168183
"location": "Leipzig",
@@ -173,16 +188,18 @@
173188
},
174189
),
175190
GenericConference(
176-
url="https://data.jtbx.de/jev22_ccl/schedule.json",
191+
url="https://woodbine.nyc/2022/12/dweb-jev/schedule.json",
177192
data={
178-
"name": "jev22_ccl", # (27.–29.)
179-
"location": "Hamburg",
193+
"name": "DWeb NY Pre-kickoff + RemoteCCC @ Woodbine",
194+
"location": "New York, USA",
195+
"address": "Basement, Woodbine, 585 Woodward Ave, Ridgewood, Queens, NY 11385",
196+
"description": "A new DWeb Node is being formed! What does this mean? Come and find out! \n\n Relevant topics include: decentralized web, digital commons, co-ops, governance, privacy, anti-surveillance, software freedom.",
180197
"links": [
181-
"https://curious.bio/2022/11/remote-chaos-experience/",
198+
"https://dweb.events/stuff/ny/2022/woodbine-remoteccc/",
182199
],
183-
},
184-
options={"track": "Curious Community Labs"},
185-
)
200+
"osm_url": "https://www.openstreetmap.org/node/5365063316#v13"
201+
}
202+
),
186203
]
187204

188205
targets = [
@@ -314,6 +331,7 @@ def main():
314331
git("rm events/*")
315332

316333
# write seperate file for each event, to get better git diffs
334+
# TODO: use Event.export()
317335
def export_event(event: Event):
318336
origin_system = None
319337
if isinstance(event, Event):

‎voc/schedule.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ def add_events_from(self, other_schedule, id_offset=None, options={}, context: E
437437
event["do_not_record"] = options['do_not_record'](event) if callable(options["do_not_record"]) else options["do_not_record"]
438438

439439
if options.get("remove_title_additions"):
440-
event["title"], subtitle, event_type = re.match(r"^(.+?)(?:( ?[:–] .+?))?(?: \((.+?)\))?$", event["title"]).groups()
440+
event["title"], subtitle, event_type = re.match(r"^(.{5,}?)(?:( ?[:–] .+?))?(?: \((.+?)\))?$", event["title"]).groups()
441441
if not event.get("subtitle") and subtitle:
442442
event["subtitle"] = subtitle
443443

@@ -457,7 +457,7 @@ def add_events_from(self, other_schedule, id_offset=None, options={}, context: E
457457
# TODO? offset for person IDs?
458458

459459
# workaround for fresh pretalx instances
460-
elif options.get("randomize_small_ids") and int(event["id"]) < 1000:
460+
elif options.get("randomize_small_ids") and int(event["id"]) < 1500:
461461
event["id"] = int(re.sub("[^0-9]+", "", event["guid"])[0:4])
462462

463463
# overwrite slug for pretalx schedule.json input

0 commit comments

Comments
 (0)
Please sign in to comment.