commit 21ec9d6f8a0908b8129ce54bde08d068f1a61a3e
parent 002a691a7c82efcc438b8d1eb1a8b0971834fe49
Author: AsherMorgan <59518073+AsherMorgan@users.noreply.github.com>
Date: Wed, 8 Apr 2020 12:24:05 -0700
Add feature to add on to existing powerpoints.
Diffstat:
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/Songs2Slides.py b/Songs2Slides.py
@@ -63,13 +63,19 @@ def ParseLyrics(lyrics):
# Create powerpoint
-def CreatePptx(parsedLyrics, filepath):
+def CreatePptx(parsedLyrics, filepath, openFirst):
# Load settings
with open("settings.json") as f:
settings = json.load(f)
# Create presentation
- prs = Presentation()
+ if (openFirst):
+ try:
+ prs = Presentation(filepath)
+ except:
+ prs = Presentation()
+ else:
+ prs = Presentation()
blank_slide_layout = prs.slide_layouts[6]
for lyric in parsedLyrics:
@@ -159,6 +165,7 @@ if (__name__ == "__main__"):
# Get filepath
filepath = input("Please enter a filepath to save your powerpoint to: ")
+ openFirst = (input("Would you like to add on to the powerpoint if it already exists? (y/n): ").lower() == "y")
# Add extension
if (len(filepath) == 0):
@@ -172,7 +179,7 @@ if (__name__ == "__main__"):
# Create powerpoint
try:
- CreatePptx(lyrics, filepath)
+ CreatePptx(lyrics, filepath, openFirst)
except:
print("We were unable to create the powerpoint.")
sys.exit()