2022-09-05 12:54:02 +00:00
|
|
|
"""
|
|
|
|
Python representation of the "config.txt" file inside the WebDAV directory.
|
|
|
|
"""
|
|
|
|
|
2023-10-26 16:21:07 +00:00
|
|
|
import logging
|
2023-10-20 08:43:15 +00:00
|
|
|
from typing import Any
|
2022-09-04 23:03:16 +00:00
|
|
|
|
|
|
|
from pydantic import BaseModel
|
2022-09-06 22:55:23 +00:00
|
|
|
|
2023-10-26 16:21:07 +00:00
|
|
|
_logger = logging.getLogger(__name__)
|
2022-09-04 23:03:16 +00:00
|
|
|
|
|
|
|
|
2022-09-08 23:59:17 +00:00
|
|
|
class TickerUIConfig(BaseModel):
|
|
|
|
"""
|
2022-09-09 14:12:36 +00:00
|
|
|
Configuration for how the UI displays the ticker content.
|
2022-09-08 23:59:17 +00:00
|
|
|
"""
|
|
|
|
|
2022-09-05 23:53:53 +00:00
|
|
|
color: str = "primary"
|
2022-09-04 23:25:40 +00:00
|
|
|
|
|
|
|
|
2022-09-15 22:14:02 +00:00
|
|
|
class TickerConfig(TickerUIConfig):
|
2022-09-08 23:59:17 +00:00
|
|
|
"""
|
|
|
|
Section "[ticker]" in "config.txt".
|
2022-09-09 14:12:36 +00:00
|
|
|
|
|
|
|
Combined configuration for the ticker.
|
2022-09-08 23:59:17 +00:00
|
|
|
"""
|
|
|
|
|
2022-09-15 22:14:02 +00:00
|
|
|
file_name: str = "ticker"
|
|
|
|
separator: str = " +++ "
|
|
|
|
comment_marker: str = "#"
|
|
|
|
|
|
|
|
|
|
|
|
class ImageUIConfig(BaseModel):
|
|
|
|
"""
|
|
|
|
Configuration for how the UI displays the image carousel.
|
|
|
|
"""
|
|
|
|
|
|
|
|
height: int = 300
|
|
|
|
contain: bool = False
|
|
|
|
speed: int = 10000
|
2022-09-08 23:59:17 +00:00
|
|
|
|
|
|
|
|
2022-09-15 22:14:02 +00:00
|
|
|
class ImageConfig(ImageUIConfig):
|
2022-09-05 12:54:02 +00:00
|
|
|
"""
|
2022-09-05 23:53:53 +00:00
|
|
|
Sections "[image*]" in "config.txt".
|
2022-09-05 12:54:02 +00:00
|
|
|
"""
|
|
|
|
|
2022-09-04 23:03:16 +00:00
|
|
|
mode: str = "RGB"
|
|
|
|
save_params: dict[str, Any] = {
|
|
|
|
"format": "JPEG",
|
|
|
|
"quality": 85,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-15 22:14:02 +00:00
|
|
|
class CalendarUIConfig(BaseModel):
|
|
|
|
"""
|
|
|
|
Configuration for how the UI displays the calendar carousel.
|
|
|
|
"""
|
|
|
|
|
|
|
|
speed: int = 10000
|
|
|
|
|
|
|
|
|
|
|
|
class CalendarConfig(CalendarUIConfig):
|
2022-09-06 00:03:44 +00:00
|
|
|
"""
|
2022-09-09 14:12:36 +00:00
|
|
|
Sections "[calendar*]" in "config.txt".
|
2022-09-06 00:03:44 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
future_days: int = 365
|
2022-09-09 14:12:36 +00:00
|
|
|
aggregates: dict[str, list[str]] = {}
|
2022-09-06 00:03:44 +00:00
|
|
|
|
|
|
|
|
2022-09-15 22:14:02 +00:00
|
|
|
class ServerUIConfig(BaseModel):
|
|
|
|
"""
|
|
|
|
Section "[server]" in "config.txt".
|
|
|
|
"""
|
|
|
|
|
|
|
|
name: str = "OEKZident"
|
|
|
|
host: str = "https://oekzident.de"
|
|
|
|
|
|
|
|
|
2022-09-15 22:19:23 +00:00
|
|
|
class LogoUIConfig(BaseModel):
|
|
|
|
"""
|
|
|
|
Section "[logo]" in "config.txt".
|
|
|
|
"""
|
|
|
|
|
2022-09-15 22:35:31 +00:00
|
|
|
above: str = "Technisches Hilfswerk"
|
|
|
|
below: str = "OV Musterstadt"
|
2022-09-15 22:19:23 +00:00
|
|
|
|
|
|
|
|
2022-09-04 23:03:16 +00:00
|
|
|
class Config(BaseModel):
|
2022-09-05 12:54:02 +00:00
|
|
|
"""
|
|
|
|
Main representation of "config.txt".
|
|
|
|
"""
|
|
|
|
|
2022-09-08 14:02:50 +00:00
|
|
|
image_dir: str = "image"
|
|
|
|
text_dir: str = "text"
|
2022-09-18 21:59:02 +00:00
|
|
|
file_dir: str = "file"
|
2022-09-08 14:02:50 +00:00
|
|
|
|
2022-09-15 22:19:23 +00:00
|
|
|
logo: LogoUIConfig = LogoUIConfig()
|
|
|
|
image: ImageConfig = ImageConfig()
|
2022-09-15 22:14:02 +00:00
|
|
|
server: ServerUIConfig = ServerUIConfig()
|
2022-09-05 13:11:57 +00:00
|
|
|
ticker: TickerConfig = TickerConfig()
|
2022-09-06 00:03:44 +00:00
|
|
|
calendar: CalendarConfig = CalendarConfig()
|