resolves #5
This commit is contained in:
		| @@ -43,7 +43,8 @@ class LyricSearch(FastAPI): | |||||||
|         self.constants = constants |         self.constants = constants | ||||||
|         self.lyrics_engine = importlib.import_module("lyrics_engine").LyricsEngine() |         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 = [ |         self.acceptable_request_sources = [ | ||||||
|             "WEB", |             "WEB", | ||||||
|             "IRC-MS", |             "IRC-MS", | ||||||
| @@ -54,7 +55,17 @@ class LyricSearch(FastAPI): | |||||||
|             "LIMNORIA-SHARED" |             "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): |     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) | 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) | lyric_search_endpoint = importlib.import_module("endpoints.lyric_search").LyricSearch(app, util, constants) | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user