From a301a6907807df06f9a128189f6c72d030de72cc Mon Sep 17 00:00:00 2001 From: Ethan Shoham <69990209+Ethan-S-Dev@users.noreply.github.com> Date: Sun, 11 Jul 2021 09:32:35 +0300 Subject: [PATCH] Themes and Templates (#1) * Update templates.json * Update templates.json * Update templates.json * Update spotify.py * Update spotify.py * Update spotify.py * Update spotify.py * Update spotify.py * Update spotify.py * Update spotify.py * Update spotify.py * Update spotify.py * Update templates.json --- api/spotify.py | 7 ++++--- api/templates.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/api/spotify.py b/api/spotify.py index 67ab32f..efba289 100644 --- a/api/spotify.py +++ b/api/spotify.py @@ -86,10 +86,11 @@ def barGen(barCount): def getTemplate(): try: - file = open("templates.json",) - templates = json.load(file) + file = open("api/templates.json","r") + templates = json.loads(file.read()) return templates["templates"][templates["current-theme"]] - except: + except Exception as e: + print(f"Failed to load templates.") return FALLBACK_THEME diff --git a/api/templates.json b/api/templates.json index 94f34fe..a0d08ee 100644 --- a/api/templates.json +++ b/api/templates.json @@ -4,4 +4,4 @@ "light": "spotify.html.j2", "dark": "spotify-dark.html.j2" } -} \ No newline at end of file +}