commit c6093d5b59ebb8065a135e98c1c7f071133df8ef
parent 9439935fc8b78dd41864f665c0145be16fbff9c2
Author: AsherMorgan <59518073+AsherMorgan@users.noreply.github.com>
Date: Mon, 6 Apr 2020 21:14:26 -0700
Implement lines per slide setting.
Diffstat:
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/Songs2Slides.py b/Songs2Slides.py
@@ -39,16 +39,24 @@ def GetLyrics(artist, song):
# Parses the lyrics into blocks
def ParseLyrics(lyrics):
+ # Load settings
+ with open("settings.json") as f:
+ settings = json.load(f)
+
+ # Parse lyrics
rawLines = lyrics.split("\n")
lines = []
- BlockSize = 4
+ BlockSize = settings["lines-per-slide"]
for i in range(0, len(rawLines)):
if (rawLines[i] == "" or rawLines[i][0] == "["):
- BlockSize = 4
- elif (BlockSize == 4):
+ # Start new block on the next line
+ BlockSize = settings["lines-per-slide"]
+ elif (BlockSize == settings["lines-per-slide"]):
+ # Start a new block
lines.append(rawLines[i])
BlockSize = 1
else:
+ # Continue a block
lines[-1] = lines[-1] + "\n" + rawLines[i]
BlockSize += 1
return lines
diff --git a/settings.json b/settings.json
@@ -1,4 +1,6 @@
{
+ "lines-per-slide": 4,
+
"margin-left": 0.5,
"margin-right": 0.5,
"margin-top": 0.5,