39 lines
728 B
Python
39 lines
728 B
Python
|
import logging
|
||
|
|
||
|
from fastapi import APIRouter
|
||
|
|
||
|
from .. import CLIENT
|
||
|
from ..dav_file import DavFile
|
||
|
|
||
|
router = APIRouter(prefix="/text", tags=["text"])
|
||
|
|
||
|
_logger = logging.getLogger(__name__)
|
||
|
|
||
|
_message = DavFile(client=CLIENT, path="message.txt")
|
||
|
_ticker = DavFile(client=CLIENT, path="ticker.txt")
|
||
|
_title = DavFile(client=CLIENT, path="title.txt")
|
||
|
|
||
|
|
||
|
@router.on_event("startup")
|
||
|
async def on_startup():
|
||
|
_logger.debug("text router startup")
|
||
|
|
||
|
_message.refresh()
|
||
|
_ticker.refresh()
|
||
|
_title.refresh()
|
||
|
|
||
|
|
||
|
@router.get("/message")
|
||
|
async def get_message():
|
||
|
return str(_message)
|
||
|
|
||
|
|
||
|
@router.get("/ticker")
|
||
|
async def get_ticker():
|
||
|
return str(_ticker)
|
||
|
|
||
|
|
||
|
@router.get("/title")
|
||
|
async def get_title():
|
||
|
return str(_title)
|