Compare commits
No commits in common. "58f295cc540d7f8f82b429ee0922983821a78f3e" and "29d6d1d2b516335d3a7db178c3a8617f6183721f" have entirely different histories.
58f295cc54
...
29d6d1d2b5
1 changed files with 1 additions and 20 deletions
|
|
@ -82,33 +82,14 @@ class CalEvent(BaseModel):
|
|||
"""
|
||||
|
||||
data = {}
|
||||
keys = ("summary", "description", "dtstart", "dtend", "duration")
|
||||
|
||||
for key in keys:
|
||||
for key in cls().dict().keys():
|
||||
try:
|
||||
data[key] = event.contents[key][0].value # type: ignore
|
||||
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
print(data)
|
||||
|
||||
if "dtend" not in data:
|
||||
data["dtend"] = data["dtstart"]
|
||||
|
||||
if "duration" in data:
|
||||
try:
|
||||
data["dtend"] += data["duration"]
|
||||
|
||||
except (ValueError, TypeError, AttributeError):
|
||||
_logger.warn(
|
||||
"Could not add duration %s to %s",
|
||||
repr(data["duration"]),
|
||||
repr(data["dtstart"]),
|
||||
)
|
||||
|
||||
del data["duration"]
|
||||
|
||||
return cls.parse_obj(data)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue