ungana

Unnamed repository; edit this file 'description' to name the repository.
Info | Log | Files | Refs | README

commit 2fdbc26d49ad2d0e4017b67fd12e9d52ec7b3e86
parent d798361603998ba187afdcf18b17662ff6a7c012
Author: Carlosokumu <carlosokumu254@gmail.com>
Date:   Wed,  3 Sep 2025 13:46:55 +0300

add setting host,venue and organizer via edit

Diffstat:
Mungana/cmd/args_parser.py | 13+++++++++++--
Mungana/ical/ical_helper.py | 9++++++++-
2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/ungana/cmd/args_parser.py b/ungana/cmd/args_parser.py @@ -105,8 +105,9 @@ class ArgsParser: parser.add_argument("-p", "--poster", help="Event headline image") parser.add_argument("--long", type= self._ensure_no_multiline_input,help="Exhaustive description of the event") parser.add_argument("-c", "--contact",type=self._ensure_no_multiline_input, help="Contact details") - - + parser.add_argument("--host", type=self._ensure_no_multiline_input,help="URL for the event host (entity responsible for local production)") + parser.add_argument("--venue", type=self._ensure_no_multiline_input,help="URL for the venue (entity providing the physical location)") + parser.add_argument("--presenter", type=self._ensure_no_multiline_input,help="URL for the presenter or content provider (entity responsible for content)") def _add_logging_arguments(self, parser): @@ -381,6 +382,14 @@ class ArgsParser: else: updates["CONTACT"] = value + if args.presenter: + updates["URL;ROLE=PRESENTER"] = args.presenter + if args.host: + updates["URL;ROLE=HOST"] = args.host + + if args.venue: + updates["URL;ROLE=VENUE"] = args.venue + for ctx_name in ("poster", "long"): arg_val = getattr(args, ctx_name, None) if arg_val: diff --git a/ungana/ical/ical_helper.py b/ungana/ical/ical_helper.py @@ -1,7 +1,7 @@ from datetime import datetime from typing import Any, Dict, Optional from zoneinfo import ZoneInfo -from icalendar import Calendar, Event +from icalendar import Calendar, Event, vUri class ICalHelper: @@ -22,6 +22,13 @@ class ICalHelper: if component.name == "VEVENT" and str(component.get("UID")) == uid: event_found = True for key, value in updates.items(): + if key.startswith("URL;ROLE="): + role = key.split("=", 1)[1] + url_prop = vUri(value) + url_prop.params["ROLE"] = role + component.add("URL", url_prop) + continue + if key in component: component.pop(key)