Afegir control visual de les lletres per a partitures
This commit is contained in:
@@ -32,13 +32,16 @@ class LyricsText:
|
||||
|
||||
@classmethod
|
||||
def from_lyrics(cls, lyrics: temes.Lyrics, max_cols: int = 3) -> Self:
|
||||
# Use stored max_columns if available, otherwise use the provided max_cols
|
||||
effective_max_cols = lyrics.max_columns if lyrics.max_columns is not None else max_cols
|
||||
# Remove ~ characters before processing
|
||||
paragraphs = [
|
||||
LyricsParagraph(lines=par_str.splitlines())
|
||||
LyricsParagraph(lines=[line.replace("~", "") for line in par_str.splitlines()])
|
||||
for par_str in lyrics.content.split("\n\n") if par_str
|
||||
]
|
||||
return cls(lines=[
|
||||
LyricsLine(paragraphs=list(line_pars))
|
||||
for line_pars in batched(paragraphs, max_cols)
|
||||
for line_pars in batched(paragraphs, effective_max_cols)
|
||||
])
|
||||
|
||||
def hash(self) -> bytes:
|
||||
|
||||
@@ -60,6 +60,7 @@ class Lyrics:
|
||||
tema_id: int
|
||||
title: str
|
||||
content: str
|
||||
max_columns: int | None = None
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
|
||||
Reference in New Issue
Block a user