|
@@ -70,7 +70,7 @@ class Converter:
|
|
|
self.rooms = []
|
|
|
self.talks = {}
|
|
|
self.talk_room = {} # map talk uid to room name
|
|
|
- self.talk_location = {} # same, but see --trust-location
|
|
|
+ self.talk_location = {} # same, but see --trust-location
|
|
|
self.changed_files = []
|
|
|
|
|
|
def _fname_to_room(self, fpath: str) -> str:
|
|
@@ -95,7 +95,9 @@ class Converter:
|
|
|
self.talk_location[uid] = room
|
|
|
if fpath in self.args.trust_location:
|
|
|
try:
|
|
|
- self.talk_location[uid] = ev.decoded('location').decode('utf8')
|
|
|
+ self.talk_location[uid] = ev.decoded("location").decode(
|
|
|
+ "utf8"
|
|
|
+ )
|
|
|
except:
|
|
|
pass
|
|
|
|
|
@@ -119,20 +121,18 @@ class HugoConverter(Converter):
|
|
|
fpath = self.args.out_md_dir / fname
|
|
|
self.changed_files.append(fpath)
|
|
|
frontmatter = dict(
|
|
|
- key=uid,
|
|
|
- title=talk.decoded("SUMMARY").decode("utf8"),
|
|
|
- format="conference",
|
|
|
- start=talk.decoded("DTSTART"),
|
|
|
- end=talk.decoded("DTEND"),
|
|
|
- location=self.talk_location[uid],
|
|
|
- duration=int(
|
|
|
- (
|
|
|
- talk.decoded("DTEND") - talk.decoded("DTSTART")
|
|
|
- ).total_seconds()
|
|
|
- // 60
|
|
|
- ),
|
|
|
- tags=[],
|
|
|
- )
|
|
|
+ key=uid,
|
|
|
+ title=talk.decoded("SUMMARY").decode("utf8"),
|
|
|
+ format="conference",
|
|
|
+ start=talk.decoded("DTSTART"),
|
|
|
+ end=talk.decoded("DTEND"),
|
|
|
+ location=self.talk_location[uid],
|
|
|
+ duration=int(
|
|
|
+ (talk.decoded("DTEND") - talk.decoded("DTSTART")).total_seconds()
|
|
|
+ // 60
|
|
|
+ ),
|
|
|
+ tags=[],
|
|
|
+ )
|
|
|
if "CATEGORIES" in talk:
|
|
|
try:
|
|
|
vobject = talk.get("CATEGORIES")
|
|
@@ -143,8 +143,8 @@ class HugoConverter(Converter):
|
|
|
frontmatter["tags"] = [str(vobject)]
|
|
|
except Exception as exc:
|
|
|
logging.warning("Error parsing categories: %s", str(exc))
|
|
|
- if 'base' in frontmatter['tags']:
|
|
|
- frontmatter['level'] = 'beginner'
|
|
|
+ if "base" in frontmatter["tags"]:
|
|
|
+ frontmatter["level"] = "beginner"
|
|
|
with open(str(fpath), "w") as buf:
|
|
|
buf.write("---\n")
|
|
|
yaml.safe_dump(frontmatter, buf)
|