music-kraken-core/music_kraken/objects/lyrics.py

40 lines
1022 B
Python
Raw Normal View History

2023-02-25 21:16:32 +00:00
from typing import List
from collections import defaultdict
2023-02-25 21:16:32 +00:00
import pycountry
2023-12-19 21:11:46 +00:00
from .parents import OuterProxy
2023-03-10 08:09:35 +00:00
from .source import Source, SourceCollection
2023-02-25 21:16:32 +00:00
from .formatted_text import FormattedText
2023-12-20 08:55:09 +00:00
from .country import Language
2024-04-09 12:18:34 +00:00
from .metadata import (
Mapping as id3Mapping,
ID3Timestamp,
Metadata
)
2023-02-25 21:16:32 +00:00
2023-12-19 21:11:46 +00:00
class Lyrics(OuterProxy):
2023-12-20 08:55:09 +00:00
text: FormattedText
language: Language
2023-12-29 19:18:34 +00:00
source_collection: SourceCollection
2023-12-20 08:55:09 +00:00
_default_factories = {
"text": FormattedText,
2023-12-29 19:18:34 +00:00
"language": lambda: Language.by_alpha_2("en"),
2023-02-25 21:16:32 +00:00
2023-12-29 19:18:34 +00:00
"source_collection": SourceCollection,
}
2023-12-29 20:16:09 +00:00
# This is automatically generated
def __init__(self, text: FormattedText = None, language: Language = None, source_list: SourceCollection = None,
**kwargs) -> None:
super().__init__(text=text, language=language, source_list=source_list, **kwargs)
2024-04-09 12:18:34 +00:00
@property
def metadata(self) -> Metadata:
return Metadata({
id3Mapping.UNSYNCED_LYRICS: [self.text.html]
2024-04-09 12:18:34 +00:00
})