fix: creation of lyrics

This commit is contained in:
Hellow 2023-12-29 20:18:34 +01:00
parent 4cbbee26e4
commit 2dff8e4e0e
3 changed files with 7 additions and 23 deletions

View File

@ -18,23 +18,11 @@ class Lyrics(OuterProxy):
text: FormattedText text: FormattedText
language: Language language: Language
source_collection: SourceCollection
_default_factories = { _default_factories = {
"text": FormattedText, "text": FormattedText,
"language": Language.by_alpha_2("en"), "language": lambda: Language.by_alpha_2("en"),
"source_collection": SourceCollection,
} }
def __init__(
self,
text: FormattedText,
language: pycountry.Languages = pycountry.languages.get(alpha_2="en"),
_id: str = None,
dynamic: bool = False,
source_list: List[Source] = None,
**kwargs
) -> None:
super().__init__(_id=_id, dynamic=dynamic, **kwargs)
self.text: FormattedText = text or FormattedText()
self.language: pycountry.Languages = language
self.source_collection: SourceCollection = SourceCollection(source_list)

View File

@ -290,9 +290,7 @@ class Album(Base):
@property @property
def options(self) -> List[P]: def options(self) -> List[P]:
options = self.artist_collection.shallow_list options = [*self.artist_collection, self, *self.song_collection]
options.append(self)
options.extend(self.song_collection)
return options return options

View File

@ -306,9 +306,7 @@ class Bandcamp(Page):
track_lyrics = soup.find("div", {"class": "lyricsText"}) track_lyrics = soup.find("div", {"class": "lyricsText"})
if track_lyrics: if track_lyrics:
self.LOGGER.debug(" Lyrics retrieved..") self.LOGGER.debug(" Lyrics retrieved..")
return [Lyrics(FormattedText( return [Lyrics(text=FormattedText(html=track_lyrics.prettify()))]
html=track_lyrics.prettify()
), pycountry.languages.get(alpha_2="en"))]
return [] return []