From 92813b05ee25449156faa4bd38484b6dfd11f12c Mon Sep 17 00:00:00 2001 From: boyska Date: Thu, 19 Aug 2021 17:58:09 +0200 Subject: [PATCH] --trust-location --- ics2mdwn.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ics2mdwn.py b/ics2mdwn.py index 869bea7..07d65b9 100755 --- a/ics2mdwn.py +++ b/ics2mdwn.py @@ -25,6 +25,7 @@ def get_parser(): default="data/schedule.yml", type=Path, ) + p.add_argument('--trust-location', type=str, nargs='*', default=[]) p.add_argument("--night-threshold", metavar="HOUR", default=5, type=int) p.add_argument("--mode", choices=["hugo"], default="hugo") return p @@ -54,6 +55,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.changed_files = [] def _fname_to_room(self, fpath: str) -> str: @@ -75,6 +77,12 @@ class Converter: uid = ev.decoded("uid").decode("ascii") self.talks[uid] = ev self.talk_room[uid] = room + self.talk_location[uid] = room + if fpath in self.args.trust_location: + try: + self.talk_location[uid] = ev.decoded('location').decode('utf8') + except: + pass def run(self): self.rooms = [self._fname_to_room(fpath) for fpath in self.args.files] @@ -105,7 +113,7 @@ class HugoConverter(Converter): format="conference", start=talk.decoded("DTSTART"), end=talk.decoded("DTEND"), - location=self.talk_room[uid], + location=self.talk_location[uid], duration=int( ( talk.decoded("DTEND") - talk.decoded("DTSTART")