p3 & dedupe typeahead results
This commit is contained in:
parent
035a52d9b2
commit
f68abca2b1
@ -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:
|
||||||
|
@ -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"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user