diff --git a/agenda/accommodation.py b/agenda/accommodation.py new file mode 100644 index 0000000..08b4501 --- /dev/null +++ b/agenda/accommodation.py @@ -0,0 +1,24 @@ +"""Accomodation""" + +import yaml + +from .types import Event + + +def get_events(filepath: str) -> list[Event]: + """Get accomodation from YAML.""" + with open(filepath) as f: + return [ + Event( + date=item["from"], + end_date=item["to"], + name="accommodation", + title=( + f'{item["location"]} Airbnb' + if item["operator"] == "airbnb" + else item["name"] + ), + url=item.get("url"), + ) + for item in yaml.safe_load(f) + ]