refactoring
This commit is contained in:
@ -12,52 +12,12 @@ import aiohttp
|
||||
import aiosqlite as sqlite3
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from pydantic import BaseModel
|
||||
from .constructors import ValidTypeAheadRequest, ValidLyricRequest
|
||||
from lyric_search.sources import aggregate
|
||||
from lyric_search import notifier
|
||||
|
||||
|
||||
class ValidLyricRequest(BaseModel):
|
||||
"""
|
||||
- **a**: artist
|
||||
- **s**: song
|
||||
- **t**: track (artist and song combined) [used only if a & s are not used]
|
||||
- **extra**: include extra details in response [optional, default: false]
|
||||
- **lrc**: Request LRCs?
|
||||
- **sub**: text to search within lyrics, if found lyrics will begin at found verse [optional]
|
||||
- **src**: the script/utility which initiated the request
|
||||
- **excluded_sources**: sources to exclude (new only)
|
||||
"""
|
||||
|
||||
a: str | None = None
|
||||
s: str | None = None
|
||||
t: str | None = None
|
||||
sub: str | None = None
|
||||
extra: bool | None = False
|
||||
lrc: bool | None = False
|
||||
src: str
|
||||
excluded_sources: list | None = None
|
||||
|
||||
model_config = {
|
||||
"json_schema_extra": {
|
||||
"examples": [
|
||||
{
|
||||
"a": "eminem",
|
||||
"s": "rap god",
|
||||
"src": "WEB",
|
||||
"extra": True,
|
||||
"lrc": False,
|
||||
"excluded_sources": [],
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ValidTypeAheadRequest(BaseModel):
|
||||
"""
|
||||
- **query**: query string
|
||||
"""
|
||||
pre_query: str|None = None
|
||||
query: str
|
||||
|
||||
class CacheUtils:
|
||||
"""Lyrics Cache DB Utils"""
|
||||
|
Reference in New Issue
Block a user