eoleedi / TimeTree-Exporter

A Tool for Exporting TimeTree Calendar to iCal / 將 TimeTree 日曆匯出成 iCal 格式
MIT License
37 stars 5 forks source link

Support Public Calendars' Event #57

Open AndCycle opened 2 weeks ago

AndCycle commented 2 weeks ago

thanks for the project that saves me some time to work on personal tool to export timetree data to google calendar,

as I trying to export data from public TimeTree calendar the data doesn't provide any alerts or recurrences

api endpoint https://timetreeapp.com/api/v2/public_calendars/{calendar_id}/public_events

  File "/home/andcycle/.local/share/mise/installs/python/3.12.7/lib/python3.12/site-packages/timetree_exporter/formatter.py", line 208, in to_ical
    for alarm in self.alarms:
                 ^^^^^^^^^^^
  File "/home/andcycle/.local/share/mise/installs/python/3.12.7/lib/python3.12/site-packages/timetree_exporter/formatter.py", line 132, in alarms
    for alert in self.time_tree_event.alerts:
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not iterable
eoleedi commented 2 weeks ago

@AndCycle Could you test if the pr works for public calendars?

AndCycle commented 1 week ago

@eoleedi looks good to me, thanks, there is some other attribute need some work, public event doesn't have uuid, I don't know filling it with id value is a proper solution or not

AndCycle commented 1 week ago

https://github.com/eoleedi/TimeTree-Exporter/blob/1264832ba7fd512bb3071556bf70d35b85477775/timetree_exporter/formatter.py#L193

as I looking into the RFC standard https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.7.3 this should be last-modified

eoleedi commented 1 week ago

https://github.com/eoleedi/TimeTree-Exporter/blob/1264832ba7fd512bb3071556bf70d35b85477775/timetree_exporter/formatter.py#L193

as I looking into the RFC standard https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.7.3 this should be last-modified

Indeed!

eoleedi commented 1 week ago

@AndCycle I believe the events in the public calendar are in API v2 format. We should define different TimeTreeEvent Classes for different calendar and API versions.

AndCycle commented 1 week ago

indeed, should have different class for them, thanks for lookup into this