diff --git a/endpoints/radio_util.py b/endpoints/radio_util.py index 60c4271..1d9812d 100644 --- a/endpoints/radio_util.py +++ b/endpoints/radio_util.py @@ -71,7 +71,7 @@ class RadioUtil: async with sqlite3.connect(self.active_playlist_path, timeout=1) as _db: _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' db_params: tuple[str] = (f"%{query}%",) async with _db.execute(db_query, db_params) as _cursor: diff --git a/endpoints/rand_msg.py b/endpoints/rand_msg.py index 854b704..e739e51 100644 --- a/endpoints/rand_msg.py +++ b/endpoints/rand_msg.py @@ -30,7 +30,8 @@ class RandMsg(FastAPI): short: Optional[bool] = False if isinstance(data, RandMsgRequest): short = data.short - db_rand_selected: int = 9 + if short: + db_rand_selected: int = 9 db_rand_selected = random.choice([0, 1, 3]) title_attr: str = "Unknown"