playlists have been stored to redis for faster retrieval; additional work needed (playlist management, typeahead, etc- to move away from SQLite)
This commit is contained in:
@@ -23,7 +23,6 @@ from fastapi import (
|
||||
from fastapi_throttle import RateLimiter
|
||||
from fastapi.responses import RedirectResponse, JSONResponse
|
||||
|
||||
|
||||
class Radio(FastAPI):
|
||||
"""Radio Endpoints"""
|
||||
|
||||
@@ -34,7 +33,6 @@ class Radio(FastAPI):
|
||||
self.loop = loop
|
||||
self.radio_util = radio_util.RadioUtil(self.constants, self.loop)
|
||||
self.playlists_loaded: bool = False
|
||||
|
||||
self.endpoints: dict = {
|
||||
"radio/np": self.radio_now_playing,
|
||||
"radio/request": self.radio_request,
|
||||
@@ -67,7 +65,7 @@ class Radio(FastAPI):
|
||||
async def on_start(self) -> None:
|
||||
stations = ", ".join(self.radio_util.db_queries.keys())
|
||||
logging.info("radio: Initializing stations:\n%s", stations)
|
||||
self.loop.run_in_executor(None, self.radio_util.load_playlists)
|
||||
await self.radio_util.load_playlists()
|
||||
|
||||
async def radio_skip(
|
||||
self, data: ValidRadioNextRequest, request: Request
|
||||
@@ -300,6 +298,8 @@ class Radio(FastAPI):
|
||||
- **station**: default: "main"
|
||||
"""
|
||||
logging.info("Radio get next")
|
||||
if data.station not in self.radio_util.active_playlist.keys():
|
||||
raise HTTPException(status_code=500, detail="No such station/not ready")
|
||||
if not self.util.check_key(path=request.url.path, req_type=4, key=data.key):
|
||||
raise HTTPException(status_code=403, detail="Unauthorized")
|
||||
if (
|
||||
|
Reference in New Issue
Block a user