diff --git a/endpoints/karma.py b/endpoints/karma.py index 26c6848..64cee80 100644 --- a/endpoints/karma.py +++ b/endpoints/karma.py @@ -152,7 +152,7 @@ class Karma(FastAPI): for endpoint, handler in self.endpoints.items(): app.add_api_route( - f"/{endpoint}", handler, methods=["POST"], include_in_schema=True + f"/{endpoint}", handler, methods=["POST"], include_in_schema=False ) async def top_karma_handler( diff --git a/endpoints/lyric_search.py b/endpoints/lyric_search.py index 7456d65..7a873b5 100644 --- a/endpoints/lyric_search.py +++ b/endpoints/lyric_search.py @@ -168,6 +168,10 @@ class LyricSearch(FastAPI): ) if not result: + if not data.lrc: + await self.notifier.send( + "DEBUG", f"Could not locate lyrics, request was:\n`{data}`" + ) return JSONResponse( content={ "err": True, diff --git a/endpoints/radio.py b/endpoints/radio.py index f0f4fb2..a98e398 100644 --- a/endpoints/radio.py +++ b/endpoints/radio.py @@ -149,15 +149,12 @@ class Radio(FastAPI): "duration": item.get("duration"), } ) - fallback_playlist_len: int = len( - orig_queue - ) # Used if search term is provided + full_playlist_len: int = len(orig_queue) + filtered_len: int = len(queue_full) out_json = { "draw": data.draw, - "recordsTotal": ( - len(queue_full) if not data.search else fallback_playlist_len - ), - "recordsFiltered": (len(queue_full)), + "recordsTotal": full_playlist_len, + "recordsFiltered": filtered_len, "items": queue_out, } return JSONResponse(content=out_json) diff --git a/gpt/__init__.py b/gpt/__init__.py index 4631fcd..1b859a8 100644 --- a/gpt/__init__.py +++ b/gpt/__init__.py @@ -1,3 +1,4 @@ +import logging from typing import Optional from openai import AsyncOpenAI @@ -13,6 +14,8 @@ class GPT: self.default_system_prompt: str = """You are a helpful assistant who will provide only totally accurate tidbits of \ info on the specific songs the user may listen to.""" + logging.getLogger("httpx").setLevel("CRITICAL") + async def get_completion( self, prompt: str, system_prompt: Optional[str] = None ) -> Optional[str]: diff --git a/lyric_search/sources/lrclib.py b/lyric_search/sources/lrclib.py index 073c017..04a3068 100644 --- a/lyric_search/sources/lrclib.py +++ b/lyric_search/sources/lrclib.py @@ -103,8 +103,8 @@ class LRCLib: best_match = self.matcher.find_best_match( input_track, possible_matches )[0] - except: # noqa - pass + except: # noqa + pass if not best_match: return diff --git a/utils/radio_util.py b/utils/radio_util.py index d489907..6b71268 100644 --- a/utils/radio_util.py +++ b/utils/radio_util.py @@ -332,13 +332,13 @@ class RadioUtil: # GROUP BY artistdashsong ORDER BY RANDOM()' """ - LIMITED GENRES + FULL """ - # db_query: str = ( - # 'SELECT distinct(LOWER(TRIM(artist)) || " - " || LOWER(TRIM(song))), (TRIM(artist) || " - " || TRIM(song))' - # "AS artistdashsong, id, artist, song, album, file_path, duration FROM tracks" - # ) + db_query: str = ( + 'SELECT distinct(LOWER(TRIM(artist)) || " - " || LOWER(TRIM(song))), (TRIM(artist) || " - " || TRIM(song))' + "AS artistdashsong, id, artist, song, album, file_path, duration FROM tracks" + ) """ LIMITED TO ONE/SMALL SUBSET OF GENRES @@ -351,8 +351,8 @@ class RadioUtil: LIMITED TO ONE/SOME ARTISTS... """ - db_query = 'SELECT distinct(artist || " - " || song) AS artistdashsong, id, artist, song, album, file_path, duration FROM tracks\ - WHERE (artist LIKE "%chunk!%") AND (NOT song LIKE "%%stripped%%" AND NOT song LIKE "%(2022)%" AND NOT song LIKE "%(live%%" AND NOT song LIKE "%%acoustic%%" AND NOT song LIKE "%%instrumental%%" AND NOT song LIKE "%%remix%%" AND NOT song LIKE "%%reimagined%%" AND NOT song LIKE "%%alternative%%" AND NOT song LIKE "%%unzipped%%") GROUP BY artistdashsong ORDER BY RANDOM()' # ORDER BY album ASC, id ASC' + # db_query = 'SELECT distinct(artist || " - " || song) AS artistdashsong, id, artist, song, album, file_path, duration FROM tracks\ + # WHERE (artist LIKE "%sullivan king%") AND (NOT song LIKE "%%stripped%%" AND NOT song LIKE "%(2022)%" AND NOT song LIKE "%(live%%" AND NOT song LIKE "%%acoustic%%" AND NOT song LIKE "%%instrumental%%" AND NOT song LIKE "%%remix%%" AND NOT song LIKE "%%reimagined%%" AND NOT song LIKE "%%alternative%%" AND NOT song LIKE "%%unzipped%%") GROUP BY artistdashsong ORDER BY RANDOM()' # ORDER BY album ASC, id ASC' # db_query = 'SELECT distinct(artist || " - " || song) AS artistdashsong, id, artist, song, album, genre, file_path, duration FROM tracks\ # WHERE (artist LIKE "%sullivan king%" OR artist LIKE "%kayzo%" OR artist LIKE "%adventure club%") AND (NOT song LIKE "%%stripped%%" AND NOT song LIKE "%(2022)%" AND NOT song LIKE "%(live%%" AND NOT song LIKE "%%acoustic%%" AND NOT song LIKE "%%instrumental%%" AND NOT song LIKE "%%remix%%" AND NOT song LIKE "%%reimagined%%" AND NOT song LIKE "%%alternative%%" AND NOT song LIKE "%%unzipped%%") GROUP BY artistdashsong ORDER BY RANDOM()'# ORDER BY album ASC, id ASC'