commit 53c2811cb3b2012bc8acc5c956e51e6b82071a4d
parent ba110de0dd274d2f50b4a992bd9d2024cdbab2fc
Author: AsherMorgan <59518073+AsherMorgan@users.noreply.github.com>
Date: Sun, 17 May 2020 09:45:00 -0700
Make lyric review mandatory.
Diffstat:
4 files changed, 4 insertions(+), 43 deletions(-)
diff --git a/Songs2Slides/routes.py b/Songs2Slides/routes.py
@@ -31,22 +31,11 @@ def pptx():
settings = request.json["settings"]
else:
settings = defaultSettings
-
- if "songs" in request.json:
- lyrics = []
- for song in request.json["songs"]:
- try:
- lyrics += models.ParseLyrics(song[0], song[1], settings)
- except:
- pass
- elif "lyrics" in request.json:
- # Get lyrics
- lyrics = request.json["lyrics"]
try:
# Create powerpoint
temp = tempfile.NamedTemporaryFile(mode="w+t", suffix=".pptx", delete=False)
- models.CreatePptx(lyrics, temp.name, settings, False)
+ models.CreatePptx(request.json["lyrics"], temp.name, settings, False)
temp.close()
# Read file into stream
diff --git a/Songs2Slides/static/index.css b/Songs2Slides/static/index.css
@@ -57,10 +57,7 @@ button {
#songsButtons {
margin-top: 15px;
height: 25px;
-}
-
-#settingsLink {
- float: left;
+ text-align: left;
}
#reviewButton {
diff --git a/Songs2Slides/static/index.js b/Songs2Slides/static/index.js
@@ -162,30 +162,6 @@ function getSongs() {
-// Gets the powerpoint by submitting songs
-async function SubmitSongs() {
- // Get songs
- songs = getSongs();
-
- // Send POST request
- const rawResponse = await fetch("/pptx", {
- method: 'POST',
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json'
- }, body: JSON.stringify({"songs":songs,"settings":JSON.parse(localStorage.getItem("settings"))})
- });
-
- // Download powerpoint
- download(await rawResponse.blob());
-
- // Show and hide elements
- document.getElementById("songsContainer").hidden = true;
- document.getElementById("thankyou").hidden = false;
-}
-
-
-
// Get the parsed lyrics for the user to review
async function ReviewLyrics() {
// Show and hide elements
diff --git a/Songs2Slides/templates/index.html b/Songs2Slides/templates/index.html
@@ -27,9 +27,8 @@
</div>
<div id="songsButtons">
- <a id="settingsLink" href="javascript:showSettings();">Settings</a>
- <button id="submitSongsButton" onclick="SubmitSongs();">Create Powerpoint</button>
- <button id="reviewButton" onclick="ReviewLyrics();">Review Lyrics</button>
+ <a href="javascript:showSettings();">Settings</a>
+ <button id="reviewButton" onclick="ReviewLyrics();">Next</button>
</div>
</div>