api/lyric_search/constructors.py

50 lines
822 B
Python
Raw Normal View History

2025-02-15 21:09:33 -05:00
from dataclasses import dataclass
from typing import Union
2025-01-13 20:47:39 -05:00
2025-01-13 20:47:39 -05:00
@dataclass
class LyricsResult:
2025-01-19 07:01:07 -05:00
"""
Class for returned Lyrics Results
Attributes:
artist (str): returned artist
song (str): returned song
src (str): source result was fetched from
2025-02-15 21:09:33 -05:00
lyrics (Union[str, list]): str if plain lyrics, list for lrc
2025-01-19 07:01:07 -05:00
time (float): time taken to retrieve lyrics from source
2025-01-17 07:50:21 -05:00
"""
2025-01-13 20:47:39 -05:00
artist: str
song: str
src: str
2025-02-15 21:09:33 -05:00
lyrics: Union[str, list]
2025-01-17 06:41:56 -05:00
confidence: int
2025-02-18 14:56:24 -05:00
time: float = 0.00
2025-02-18 14:56:24 -05:00
"""
Generic
"""
2025-02-18 14:56:24 -05:00
class InvalidLyricSearchResponseException(Exception):
pass
2025-02-18 14:56:24 -05:00
"""
Genius
"""
class InvalidGeniusResponseException(InvalidLyricSearchResponseException):
2025-02-18 14:56:24 -05:00
pass
2025-02-18 14:56:24 -05:00
"""
LRCLib
"""
class InvalidLRCLibResponseException(InvalidLyricSearchResponseException):
pass