p3 & dedupe typeahead results

This commit is contained in:
codey 2025-02-16 14:20:39 -05:00
parent 035a52d9b2
commit f68abca2b1
2 changed files with 3 additions and 2 deletions

View File

@ -71,7 +71,7 @@ class RadioUtil:
async with sqlite3.connect(self.active_playlist_path, async with sqlite3.connect(self.active_playlist_path,
timeout=1) as _db: timeout=1) as _db:
_db.row_factory = sqlite3.Row _db.row_factory = sqlite3.Row
db_query: str = 'SELECT (artist || " - " || song) as artistsong FROM tracks WHERE\ db_query: str = 'SELECT DISTINCT(artist || " - " || song) as artistsong FROM tracks WHERE\
artistsong LIKE ? LIMIT 30' artistsong LIKE ? LIMIT 30'
db_params: tuple[str] = (f"%{query}%",) db_params: tuple[str] = (f"%{query}%",)
async with _db.execute(db_query, db_params) as _cursor: async with _db.execute(db_query, db_params) as _cursor:

View File

@ -30,6 +30,7 @@ class RandMsg(FastAPI):
short: Optional[bool] = False short: Optional[bool] = False
if isinstance(data, RandMsgRequest): if isinstance(data, RandMsgRequest):
short = data.short short = data.short
if short:
db_rand_selected: int = 9 db_rand_selected: int = 9
db_rand_selected = random.choice([0, 1, 3]) db_rand_selected = random.choice([0, 1, 3])
title_attr: str = "Unknown" title_attr: str = "Unknown"