Compare commits
No commits in common. "a16ff9d98ca95048dbf7888bf10aa97abdeb7adf" and "89a7ffe977135e58acfc911d67608f5990568645" have entirely different histories.
a16ff9d98c
...
89a7ffe977
3 changed files with 29 additions and 53 deletions
|
|
@ -18,19 +18,11 @@ from .settings import SETTINGS
|
||||||
_logger = getLogger(__name__)
|
_logger = getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class TickerUIConfig(BaseModel):
|
class TickerAPIConfig(BaseModel):
|
||||||
"""
|
|
||||||
Configuration for how the UI displays the ticker content.
|
|
||||||
"""
|
"""
|
||||||
|
Section "[ticker.api]" in "config.txt".
|
||||||
|
|
||||||
color: str = "primary"
|
Configuration for how the API generates the ticker content.
|
||||||
|
|
||||||
|
|
||||||
class TickerConfig(TickerUIConfig):
|
|
||||||
"""
|
|
||||||
Section "[ticker]" in "config.txt".
|
|
||||||
|
|
||||||
Combined configuration for the ticker.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
file_name: str = "ticker"
|
file_name: str = "ticker"
|
||||||
|
|
@ -38,17 +30,30 @@ class TickerConfig(TickerUIConfig):
|
||||||
comment_marker: str = "#"
|
comment_marker: str = "#"
|
||||||
|
|
||||||
|
|
||||||
class ImageUIConfig(BaseModel):
|
class TickerUIConfig(BaseModel):
|
||||||
"""
|
"""
|
||||||
Configuration for how the UI displays the image carousel.
|
Section "[ticker.ui]" in "config.txt".
|
||||||
|
|
||||||
|
Configuration for how the UI displays the ticker content.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
height: int = 300
|
display: bool = True
|
||||||
contain: bool = False
|
color: str = "primary"
|
||||||
speed: int = 10000
|
speed: int = 30
|
||||||
|
|
||||||
|
|
||||||
class ImageConfig(ImageUIConfig):
|
class TickerConfig(BaseModel):
|
||||||
|
"""
|
||||||
|
Section "[ticker]" in "config.txt".
|
||||||
|
|
||||||
|
Combined configuration for the ticker.
|
||||||
|
"""
|
||||||
|
|
||||||
|
api: TickerAPIConfig = TickerAPIConfig()
|
||||||
|
ui: TickerUIConfig = TickerUIConfig()
|
||||||
|
|
||||||
|
|
||||||
|
class ImageConfig(BaseModel):
|
||||||
"""
|
"""
|
||||||
Sections "[image*]" in "config.txt".
|
Sections "[image*]" in "config.txt".
|
||||||
"""
|
"""
|
||||||
|
|
@ -60,15 +65,7 @@ class ImageConfig(ImageUIConfig):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CalendarUIConfig(BaseModel):
|
class CalendarConfig(BaseModel):
|
||||||
"""
|
|
||||||
Configuration for how the UI displays the calendar carousel.
|
|
||||||
"""
|
|
||||||
|
|
||||||
speed: int = 10000
|
|
||||||
|
|
||||||
|
|
||||||
class CalendarConfig(CalendarUIConfig):
|
|
||||||
"""
|
"""
|
||||||
Sections "[calendar*]" in "config.txt".
|
Sections "[calendar*]" in "config.txt".
|
||||||
"""
|
"""
|
||||||
|
|
@ -77,24 +74,6 @@ class CalendarConfig(CalendarUIConfig):
|
||||||
aggregates: dict[str, list[str]] = {}
|
aggregates: dict[str, list[str]] = {}
|
||||||
|
|
||||||
|
|
||||||
class ServerUIConfig(BaseModel):
|
|
||||||
"""
|
|
||||||
Section "[server]" in "config.txt".
|
|
||||||
"""
|
|
||||||
|
|
||||||
name: str = "OEKZident"
|
|
||||||
host: str = "https://oekzident.de"
|
|
||||||
|
|
||||||
|
|
||||||
class LogoUIConfig(BaseModel):
|
|
||||||
"""
|
|
||||||
Section "[logo]" in "config.txt".
|
|
||||||
"""
|
|
||||||
|
|
||||||
name: str = "Technisches Hilfswerk"
|
|
||||||
host: str = "OV Musterstadt"
|
|
||||||
|
|
||||||
|
|
||||||
class Config(BaseModel):
|
class Config(BaseModel):
|
||||||
"""
|
"""
|
||||||
Main representation of "config.txt".
|
Main representation of "config.txt".
|
||||||
|
|
@ -103,10 +82,8 @@ class Config(BaseModel):
|
||||||
image_dir: str = "image"
|
image_dir: str = "image"
|
||||||
text_dir: str = "text"
|
text_dir: str = "text"
|
||||||
|
|
||||||
logo: LogoUIConfig = LogoUIConfig()
|
|
||||||
image: ImageConfig = ImageConfig()
|
|
||||||
server: ServerUIConfig = ServerUIConfig()
|
|
||||||
ticker: TickerConfig = TickerConfig()
|
ticker: TickerConfig = TickerConfig()
|
||||||
|
image: ImageConfig = ImageConfig()
|
||||||
calendar: CalendarConfig = CalendarConfig()
|
calendar: CalendarConfig = CalendarConfig()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ async def start_router() -> None:
|
||||||
|
|
||||||
async def get_ticker_lines() -> Iterator[str]:
|
async def get_ticker_lines() -> Iterator[str]:
|
||||||
cfg = await Config.get()
|
cfg = await Config.get()
|
||||||
file_name = await text_unique(cfg.ticker.file_name)
|
file_name = await text_unique(cfg.ticker.api.file_name)
|
||||||
|
|
||||||
ticker = await DavFile(
|
ticker = await DavFile(
|
||||||
f"{await text_lister.remote_path}/{file_name}",
|
f"{await text_lister.remote_path}/{file_name}",
|
||||||
|
|
@ -52,7 +52,7 @@ async def get_ticker_content_lines(
|
||||||
return (
|
return (
|
||||||
line
|
line
|
||||||
for line in ticker_lines
|
for line in ticker_lines
|
||||||
if not line.startswith(cfg.ticker.comment_marker)
|
if not line.startswith(cfg.ticker.api.comment_marker)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ async def get_ticker_content(
|
||||||
ticker_content_lines: Iterator[str] = Depends(get_ticker_content_lines),
|
ticker_content_lines: Iterator[str] = Depends(get_ticker_content_lines),
|
||||||
) -> str:
|
) -> str:
|
||||||
cfg = await Config.get()
|
cfg = await Config.get()
|
||||||
ticker_content = cfg.ticker.separator.join(
|
ticker_content = cfg.ticker.api.separator.join(
|
||||||
["", *ticker_content_lines, ""],
|
["", *ticker_content_lines, ""],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -88,4 +88,4 @@ async def get_raw_ticker(
|
||||||
async def get_ui_config(
|
async def get_ui_config(
|
||||||
cfg: Config = Depends(Config.get),
|
cfg: Config = Depends(Config.get),
|
||||||
) -> TickerUIConfig:
|
) -> TickerUIConfig:
|
||||||
return cfg.ticker
|
return cfg.ticker.ui
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
<TickerBar
|
<TickerBar
|
||||||
v-if="ticker_html !== ''"
|
v-if="ticker_html !== ''"
|
||||||
:content="ticker_html"
|
:content="ticker_html"
|
||||||
:color="ticker_color"
|
color="primary"
|
||||||
/>
|
/>
|
||||||
</v-layout>
|
</v-layout>
|
||||||
</v-app>
|
</v-app>
|
||||||
|
|
@ -81,7 +81,6 @@ export default class App extends Vue {
|
||||||
private dashboard_ip = "0.0.0.0";
|
private dashboard_ip = "0.0.0.0";
|
||||||
|
|
||||||
private ticker_html = "<p>changeme</p>";
|
private ticker_html = "<p>changeme</p>";
|
||||||
private ticker_color = "primary";
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue