Easy theme selection

This commit is contained in:
Ethan Shoham
2021-07-09 20:44:19 +03:00
committed by Andrew Novac
parent 5f2e500dc8
commit 0c1db0a9fe

View File

@@ -17,6 +17,9 @@ SPOTIFY_CLIENT_ID = os.getenv("SPOTIFY_CLIENT_ID")
SPOTIFY_SECRET_ID = os.getenv("SPOTIFY_SECRET_ID") SPOTIFY_SECRET_ID = os.getenv("SPOTIFY_SECRET_ID")
SPOTIFY_REFRESH_TOKEN = os.getenv("SPOTIFY_REFRESH_TOKEN") SPOTIFY_REFRESH_TOKEN = os.getenv("SPOTIFY_REFRESH_TOKEN")
#########################
# change theme light/dark
TEMPLATE_THEME = "dark" TEMPLATE_THEME = "dark"
REFRESH_TOKEN_URL = "https://accounts.spotify.com/api/token" REFRESH_TOKEN_URL = "https://accounts.spotify.com/api/token"
@@ -84,7 +87,7 @@ def barGen(barCount):
left += 4 left += 4
return barCSS return barCSS
def template(theme): def getTemplate(theme):
return{ return{
'dark':'spotify-dark.html.j2', 'dark':'spotify-dark.html.j2',
'light':'spotify.html.js' 'light':'spotify.html.js'
@@ -129,7 +132,7 @@ def makeSVG(data):
"status": currentStatus, "status": currentStatus,
} }
return render_template(template(TEMPLATE_THEME), **dataDict) return render_template(getTemplate(TEMPLATE_THEME), **dataDict)
@app.route("/", defaults={"path": ""}) @app.route("/", defaults={"path": ""})