api/lyric_search_new/constructors.py
2025-01-19 07:01:07 -05:00

25 lines
604 B
Python

#!/usr/bin/env python3.12
from dataclasses import dataclass, asdict
@dataclass
class LyricsResult:
"""
Class for returned Lyrics Results
Attributes:
artist (str): returned artist
song (str): returned song
src (str): source result was fetched from
lyrics (str|list): str if plain lyrics, list for lrc
time (float): time taken to retrieve lyrics from source
"""
artist: str
song: str
src: str
lyrics: str|list
confidence: int
time: float = 0.00
def todict(self):
"""Return as dict"""
return asdict(self)