250 lines
4.9 KiB
Python
250 lines
4.9 KiB
Python
from typing import Optional
|
|
from typing import Literal
|
|
from pydantic import BaseModel
|
|
|
|
Station = Literal["main", "rock", "rap", "electronic", "pop"]
|
|
|
|
"""
|
|
Rand Msg
|
|
"""
|
|
|
|
|
|
class RandMsgRequest(BaseModel):
|
|
"""
|
|
Request model for random message.
|
|
|
|
Attributes:
|
|
- **short** (Optional[bool]): Short randmsg?
|
|
"""
|
|
|
|
short: Optional[bool] = False
|
|
|
|
|
|
"""
|
|
YT
|
|
"""
|
|
|
|
|
|
class ValidYTSearchRequest(BaseModel):
|
|
"""
|
|
Request model for YouTube search.
|
|
|
|
Attributes:
|
|
- **t** (str): Title to search.
|
|
"""
|
|
|
|
t: str = "rick astley - never gonna give you up"
|
|
|
|
|
|
"""
|
|
Transcriptions
|
|
"""
|
|
|
|
|
|
class ValidShowEpisodeListRequest(BaseModel):
|
|
"""
|
|
Request model for show episode list.
|
|
|
|
Attributes:
|
|
- **s** (int): Show ID.
|
|
"""
|
|
|
|
s: int
|
|
|
|
|
|
class ValidShowEpisodeLineRequest(BaseModel):
|
|
"""
|
|
Request model for show episode lines.
|
|
|
|
Attributes:
|
|
- **s** (int): Show ID.
|
|
- **e** (int): Episode ID.
|
|
"""
|
|
|
|
s: int
|
|
e: int
|
|
|
|
|
|
"""
|
|
Lyric Search
|
|
"""
|
|
|
|
|
|
class ValidLyricRequest(BaseModel):
|
|
"""
|
|
Request model for lyric search.
|
|
|
|
Attributes:
|
|
- **a** (Optional[str]): Artist.
|
|
- **s** (Optional[str]): Song.
|
|
- **t** (Optional[str]): Track (artist and song combined).
|
|
- **extra** (Optional[bool]): Include extra details in response.
|
|
- **lrc** (Optional[bool]): Request LRCs?
|
|
- **sub** (Optional[str]): Text to search within lyrics.
|
|
- **src** (str): The script/utility which initiated the request.
|
|
- **excluded_sources** (Optional[list]): Sources to exclude.
|
|
"""
|
|
|
|
a: Optional[str] = None
|
|
s: Optional[str] = None
|
|
t: Optional[str] = None
|
|
sub: Optional[str] = None
|
|
extra: Optional[bool] = False
|
|
lrc: Optional[bool] = False
|
|
src: str
|
|
excluded_sources: Optional[list] = None
|
|
|
|
model_config = {
|
|
"json_schema_extra": {
|
|
"examples": [
|
|
{
|
|
"a": "eminem",
|
|
"s": "rap god",
|
|
"src": "WEB",
|
|
"extra": True,
|
|
"lrc": False,
|
|
"excluded_sources": [],
|
|
}
|
|
]
|
|
}
|
|
}
|
|
|
|
|
|
class ValidTypeAheadRequest(BaseModel):
|
|
"""
|
|
Request model for typeahead query.
|
|
|
|
Attributes:
|
|
- **query** (str): Query string.
|
|
"""
|
|
|
|
query: str
|
|
|
|
|
|
"""
|
|
Radio
|
|
"""
|
|
|
|
|
|
class RadioException(Exception):
|
|
pass
|
|
|
|
|
|
class ValidRadioSongRequest(BaseModel):
|
|
"""
|
|
Request model for radio song request.
|
|
|
|
Attributes:
|
|
- **key** (str): API Key.
|
|
- **artist** (Optional[str]): Artist to search.
|
|
- **song** (Optional[str]): Song to search.
|
|
- **artistsong** (Optional[str]): Combined artist-song string.
|
|
- **alsoSkip** (Optional[bool]): Whether to skip immediately to this track.
|
|
- **station** (Station): Station name.
|
|
"""
|
|
|
|
key: str
|
|
artist: Optional[str] = None
|
|
song: Optional[str] = None
|
|
artistsong: Optional[str] = None
|
|
alsoSkip: Optional[bool] = False
|
|
station: Station = "main"
|
|
|
|
|
|
class ValidRadioTypeaheadRequest(BaseModel):
|
|
"""
|
|
Request model for radio typeahead.
|
|
|
|
Attributes:
|
|
- **query** (str): Typeahead query.
|
|
"""
|
|
|
|
query: str
|
|
|
|
|
|
class ValidRadioQueueGetRequest(BaseModel):
|
|
"""
|
|
Request model for radio queue get.
|
|
|
|
Attributes:
|
|
- **key** (Optional[str]): API key.
|
|
- **limit** (Optional[int]): Result limit.
|
|
"""
|
|
|
|
key: Optional[str] = None
|
|
limit: Optional[int] = 15_000
|
|
|
|
|
|
class ValidRadioNextRequest(BaseModel):
|
|
"""
|
|
Request model for radio next track.
|
|
|
|
Attributes:
|
|
- **key** (str): API Key.
|
|
- **skipTo** (Optional[str]): UUID to skip to.
|
|
- **station** (Station): Station name.
|
|
"""
|
|
|
|
key: str
|
|
skipTo: Optional[str] = None
|
|
station: Station = "main"
|
|
|
|
|
|
class ValidRadioReshuffleRequest(ValidRadioNextRequest):
|
|
"""
|
|
Request model for radio reshuffle.
|
|
|
|
Attributes:
|
|
- **key** (str): API Key.
|
|
- **station** (Station): Station name.
|
|
"""
|
|
|
|
|
|
class ValidRadioQueueRequest(BaseModel):
|
|
"""
|
|
Request model for radio queue.
|
|
|
|
Attributes:
|
|
- **draw** (Optional[int]): DataTables draw count.
|
|
- **start** (Optional[int]): Paging start position.
|
|
- **search** (Optional[str]): Search query.
|
|
- **station** (Station): Station name.
|
|
"""
|
|
|
|
draw: Optional[int] = 1
|
|
start: Optional[int] = 0
|
|
search: Optional[str] = None
|
|
station: Station = "main"
|
|
|
|
|
|
class ValidRadioQueueShiftRequest(BaseModel):
|
|
"""
|
|
Request model for radio queue shift.
|
|
|
|
Attributes:
|
|
- **key** (str): API Key.
|
|
- **uuid** (str): UUID to shift.
|
|
- **next** (Optional[bool]): Play next if true.
|
|
- **station** (Station): Station name.
|
|
"""
|
|
|
|
key: str
|
|
uuid: str
|
|
next: Optional[bool] = False
|
|
station: Station = "main"
|
|
|
|
|
|
class ValidRadioQueueRemovalRequest(BaseModel):
|
|
"""
|
|
Request model for radio queue removal.
|
|
|
|
Attributes:
|
|
- **key** (str): API Key.
|
|
- **uuid** (str): UUID to remove.
|
|
- **station** (Station): Station name.
|
|
"""
|
|
|
|
key: str
|
|
uuid: str
|
|
station: Station = "main"
|