base: add allowed CORS origins for localhost:4321 (dev purposes); lyric_search: change typeahead to return a maximum of 10 results, prev. 100
This commit is contained in:
2
base.py
2
base.py
@ -26,7 +26,7 @@ app = FastAPI(
|
||||
constants = importlib.import_module("constants").Constants()
|
||||
util = importlib.import_module("util").Utilities(app, constants)
|
||||
|
||||
origins = ["https://codey.lol", "https://api.codey.lol"]
|
||||
origins = ["https://codey.lol", "https://old.codey.lol", "https://api.codey.lol", "https://_new.codey.lol", "http://localhost:4321"]
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware, # type: ignore
|
||||
|
@ -31,7 +31,7 @@ class CacheUtils:
|
||||
_db.row_factory = sqlite3.Row
|
||||
db_query: str = """SELECT DISTINCT(LOWER(TRIM(artist) || " - " || TRIM(song))),\
|
||||
(TRIM(artist) || " - " || TRIM(song)) as ret FROM lyrics WHERE\
|
||||
ret LIKE ? LIMIT 100"""
|
||||
ret LIKE ? LIMIT 10"""
|
||||
db_params: tuple[str] = (f"%%%{query}%%%",)
|
||||
async with _db.execute(db_query, db_params) as _cursor:
|
||||
result: Iterable[sqlite3.Row] = await _cursor.fetchall()
|
||||
@ -175,7 +175,7 @@ class LyricSearch(FastAPI):
|
||||
return JSONResponse(
|
||||
content={
|
||||
"err": True,
|
||||
"errorText": "Sources exhausted, lyrics not located.",
|
||||
"errorText": "Failed to locate lyrics on any available sources.",
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -50,18 +50,19 @@ class RadioUtil:
|
||||
"/usr/local/share", "sqlite_dbs", "track_album_art.db"
|
||||
)
|
||||
self.playback_genres: list[str] = [
|
||||
# "post-hardcore",
|
||||
# "post hardcore",
|
||||
"post-hardcore",
|
||||
"post hardcore",
|
||||
"metalcore",
|
||||
"deathcore",
|
||||
# "edm",
|
||||
# "electronic",
|
||||
# "hard rock",
|
||||
# "ska",
|
||||
# "post punk",
|
||||
# "post-punk",
|
||||
# "pop punk",
|
||||
# "pop-punk",
|
||||
"edm",
|
||||
"electronic",
|
||||
"hard rock",
|
||||
"rock",
|
||||
"ska",
|
||||
"post punk",
|
||||
"post-punk",
|
||||
"pop punk",
|
||||
"pop-punk",
|
||||
]
|
||||
self.active_playlist: list[dict] = []
|
||||
self.playlist_loaded: bool = False
|
||||
|
Reference in New Issue
Block a user