Página preparar-misa.html y fragmentos de canciones

This commit is contained in:
Carlos Galindo 2025-05-19 18:48:32 +02:00
commit 434cbc1c25
10 changed files with 391 additions and 21 deletions

View file

@ -49,6 +49,9 @@ class Song:
return True
return False
def first_chord(self):
return next(filter(None, map(Verse.first_chord, self.verses)), None)
def has_audios(self):
return len(self.audios) > 0
@ -72,6 +75,9 @@ class Verse:
return True
return False
def first_chord(self):
return next(filter(None, map(Line.first_chord, self.lines)), None)
class Line:
ECHO_BEGIN = '<span class="echo">'
@ -85,7 +91,7 @@ class Line:
self.build()
self.remove_brackets()
assert len(self.chord_arr) == len(self.lyric_arr)
self.zipped_arr = zip(self.chord_arr, self.lyric_arr)
self.zipped_arr = list(zip(self.chord_arr, self.lyric_arr))
def __str__(self):
return self.text
@ -166,6 +172,9 @@ class Line:
return True
return False
def first_chord(self):
return next((i["data"] for key in self.extras for i in self.extras[key] if i["type"] == "chord"), None)
def chord_eng2lat(text, transpose = 0):
return Chord.CHORDS_LAT[(Chord.ENG_INDEX[text] + transpose + len(Chord.CHORDS_LAT)) % len(Chord.CHORDS_LAT)]