calendar + aggregate config
This commit is contained in:
parent
e804ae68f8
commit
1e9efd9cf3
1 changed files with 14 additions and 5 deletions
|
@ -38,15 +38,24 @@ class ImageConfig(BaseModel):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class AggregateCalendarConfig(BaseModel):
|
class CalAggregateConfig(BaseModel):
|
||||||
"""
|
"""
|
||||||
Sections "[[aggregate]]" in "config.txt".
|
Sections "[[calendar.aggregate]]" in "config.txt".
|
||||||
"""
|
"""
|
||||||
|
|
||||||
name: str = "All Events"
|
name: str = "All Events"
|
||||||
calendars: list[str]
|
calendars: list[str]
|
||||||
|
|
||||||
|
|
||||||
|
class CalendarConfig(BaseModel):
|
||||||
|
"""
|
||||||
|
Section "[calendar]" in "config.txt".
|
||||||
|
"""
|
||||||
|
|
||||||
|
future_days: int = 365
|
||||||
|
aggregate: list[CalAggregateConfig] = []
|
||||||
|
|
||||||
|
|
||||||
class Config(BaseModel):
|
class Config(BaseModel):
|
||||||
"""
|
"""
|
||||||
Main representation of "config.txt".
|
Main representation of "config.txt".
|
||||||
|
@ -54,7 +63,7 @@ class Config(BaseModel):
|
||||||
|
|
||||||
ticker: TickerConfig = TickerConfig()
|
ticker: TickerConfig = TickerConfig()
|
||||||
image: ImageConfig = ImageConfig()
|
image: ImageConfig = ImageConfig()
|
||||||
aggregate: list[AggregateCalendarConfig] = []
|
calendar: CalendarConfig = CalendarConfig()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def get(cls) -> "Config":
|
async def get(cls) -> "Config":
|
||||||
|
@ -71,8 +80,8 @@ class Config(BaseModel):
|
||||||
|
|
||||||
except RemoteResourceNotFound:
|
except RemoteResourceNotFound:
|
||||||
cfg = cls()
|
cfg = cls()
|
||||||
cfg.aggregate.append(
|
cfg.calendar.aggregate.append(
|
||||||
AggregateCalendarConfig(calendars=await caldav_list()),
|
CalAggregateConfig(calendars=await caldav_list()),
|
||||||
)
|
)
|
||||||
|
|
||||||
buffer = BytesIO()
|
buffer = BytesIO()
|
||||||
|
|
Loading…
Reference in a new issue