Jellyfin(8096), OrbStack(8097) 포트 충돌으로 변경. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
"""Adapter for VJOURNAL."""
|
|
|
|
from recurring_ical_events.adapters.component import ComponentAdapter
|
|
from recurring_ical_events.constants import DATE_MIN_DT
|
|
from recurring_ical_events.types import Time
|
|
from recurring_ical_events.util import cached_property
|
|
|
|
|
|
class JournalAdapter(ComponentAdapter):
|
|
"""Apdater for journal entries."""
|
|
|
|
@staticmethod
|
|
def component_name() -> str:
|
|
"""The icalendar component name."""
|
|
return "VJOURNAL"
|
|
|
|
@property
|
|
def end_property(self) -> None:
|
|
"""There is no end property"""
|
|
|
|
@property
|
|
def raw_start(self) -> Time:
|
|
"""Return DTSTART if it set, do not panic if it's not set."""
|
|
## according to the specification, DTSTART in a VJOURNAL is optional
|
|
dtstart = self._component.get("DTSTART")
|
|
if dtstart is not None:
|
|
return dtstart.dt
|
|
return DATE_MIN_DT
|
|
|
|
@cached_property
|
|
def raw_end(self) -> Time:
|
|
"""The end time is the same as the start."""
|
|
## VJOURNAL cannot have a DTEND. We should consider a VJOURNAL to
|
|
## describe one day if DTSTART is a date, and we can probably
|
|
## consider it to have zero duration if a timestamp is given.
|
|
return self.raw_start
|
|
|
|
|
|
__all__ = ["JournalAdapter"]
|