Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

Commit

Permalink
feat: stringify the current line when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkVanityOfLight committed Feb 12, 2022
1 parent 82db850 commit e1b9cc4
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions spolylyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ def update_current_line(self):

if newLine and newLine != self.currentLine:
self.currentLine = newLine
print(self.currentLine)
print(self.stringify_current_line())

def stringify_lyrics(self):

if not self.availableLyrics:
self.lyrics = "There are no lyrics for this song"
return
return None

lines = []
for line in self.lyrics:
Expand All @@ -44,6 +43,20 @@ def stringify_lyrics(self):

return "\n".join(lines)

def stringify_current_line(self):

if not self.currentLine:
return "There is no active lyric line"

elif self.isSynced:
words =[]
for word in self.currentLine["words"]:
words.append(word["string"])

return " ".join(words)
else:
return self.stringify_lyrics()



def update_lyrics(self, lyrics):
Expand All @@ -62,6 +75,8 @@ def update_lyrics(self, lyrics):
self.availableLyrics = True
self.lyrics = lyrics

self.currentLine = None

lyric_syncer = LyricSyncer()

app = Flask(__name__)
Expand Down

0 comments on commit e1b9cc4

Please sign in to comment.