--trust-location

This commit is contained in:
boyska 2021-08-19 17:58:09 +02:00
parent 0b0194e096
commit 92813b05ee

View file

@ -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")