songs2slides

A tool that automatically finds song lyrics and creates lyric slideshows
git clone https://git.ashermorgan.net/songs2slides/
Log | Files | Refs | README

commit 2b91e7dc2f7488b9725cdbc4d90dc4f985d93669
parent 5db65d64fd8be435909c3adcb4f78629a4a9a98a
Author: AsherMorgan <59518073+AsherMorgan@users.noreply.github.com>
Date:   Sun, 11 Oct 2020 18:36:30 -0700

Fix compatibility issues with opening files.

Diffstat:
Mcliapp.py | 14++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/cliapp.py b/cliapp.py @@ -45,7 +45,12 @@ if (__name__ == "__main__"): temp.close() # Open temp file and wait - subprocess.Popen(["notepad", temp.name]).wait() + if (sys.platform == "win32"): + subprocess.Popen(["notepad", temp.name]).wait() + elif (sys.platform == "darwin"): + subprocess.Popen(["open", temp.name]).wait() + else: + subprocess.Popen(["xdg-open", temp.name]).wait() # Read file with open(temp.name) as f: @@ -89,7 +94,12 @@ if (__name__ == "__main__"): # Open powerpoint if (input("Do you want to view the powerpoint now? (y/n): ").lower() == "y"): try: - os.startfile(filepath) + if (sys.platform == "win32"): + os.startfile(filepath) + elif (sys.platform == "darwin"): + subprocess.Popen(["open", filepath]) + else: + subprocess.Popen(["xdg-open", filepath]) except: print("There was an error while opening the powerpoint.") input("Press enter to exit...")