resolves #5
This commit is contained in:
parent
b1d3f50df2
commit
5ef9c960df
@ -43,7 +43,8 @@ class LyricSearch(FastAPI):
|
||||
self.constants = constants
|
||||
self.lyrics_engine = importlib.import_module("lyrics_engine").LyricsEngine()
|
||||
|
||||
self.endpoint_name = "search"
|
||||
self.endpoint_name = "lyric_search"
|
||||
self.endpoint2_name = "lyric_cache_list"
|
||||
self.acceptable_request_sources = [
|
||||
"WEB",
|
||||
"IRC-MS",
|
||||
@ -54,7 +55,17 @@ class LyricSearch(FastAPI):
|
||||
"LIMNORIA-SHARED"
|
||||
]
|
||||
|
||||
app.add_api_route(f"/{self.endpoint_name}/",self.lyric_search_handler, methods=["POST"]) # pylint: disable=consider-using-f-string trailing-whitespace
|
||||
app.add_api_route(f"/{self.endpoint_name}/",self.lyric_search_handler, methods=["POST"])
|
||||
app.add_api_route(f"/{self.endpoint2_name}/",self.lyric_cache_list_handler, methods=["POST"]) # pylint: disable=trailing-whitespace
|
||||
|
||||
async def lyric_cache_list_handler(self):
|
||||
"""
|
||||
Get currently cached lyrics entries
|
||||
"""
|
||||
return {
|
||||
'err': False,
|
||||
'data': await self.lyrics_engine.listCacheEntries()
|
||||
}
|
||||
|
||||
async def lyric_search_handler(self, data: ValidLyricRequest):
|
||||
"""
|
||||
|
1
main.py
1
main.py
@ -52,6 +52,7 @@ Actionable Routes
|
||||
"""
|
||||
|
||||
randmsg_endpoint = importlib.import_module("endpoints.rand_msg").RandMsg(app, util, constants)
|
||||
# Below also provides: /lyric_cache_list/ (in addition to /lyric_search/)
|
||||
lyric_search_endpoint = importlib.import_module("endpoints.lyric_search").LyricSearch(app, util, constants)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user